@almadar/shell-runtime 0.0.0-stage → 0.1.0
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/dist/chunk-2JU7Y4KU.js +21 -0
- package/dist/chunk-46RWK2B5.js +28 -0
- package/dist/chunk-4J2QEIUV.js +78 -0
- package/dist/chunk-4SEK5ER2.js +8 -0
- package/dist/chunk-4ZICQ5PM.js +192 -0
- package/dist/chunk-53IPZXDP.js +76 -0
- package/dist/chunk-5D63EMO5.js +16 -0
- package/dist/chunk-64IH2SMY.js +22 -0
- package/dist/chunk-7SDV3QWR.js +67 -0
- package/dist/chunk-CPSQXEJ6.js +55 -0
- package/dist/chunk-CQP5XAX6.js +173 -0
- package/dist/chunk-CROS2GEX.js +49 -0
- package/dist/chunk-D4XJTBLB.js +217 -0
- package/dist/chunk-D5USD2EX.js +232 -0
- package/dist/chunk-DYOJGLIX.js +25 -0
- package/dist/chunk-ELBLT2HZ.js +1 -0
- package/dist/chunk-EV56K4GB.js +63 -0
- package/dist/chunk-EZZYLTWY.js +1 -0
- package/dist/chunk-FQ6IZMIU.js +10 -0
- package/dist/chunk-FWA5K7Q2.js +48 -0
- package/dist/chunk-HC6ERSAH.js +55 -0
- package/dist/chunk-HLOUDLPI.js +48 -0
- package/dist/chunk-HMK6YMQS.js +135 -0
- package/dist/chunk-HNOAZWFH.js +19 -0
- package/dist/chunk-IHQLE5M7.js +62 -0
- package/dist/chunk-IOPUS6Q5.js +15 -0
- package/dist/chunk-JFWFDUTR.js +35 -0
- package/dist/chunk-LZIOTBFX.js +1 -0
- package/dist/chunk-MHYSHSRG.js +54 -0
- package/dist/chunk-MLKGABMK.js +7 -0
- package/dist/chunk-MZKIL5IN.js +74 -0
- package/dist/chunk-NAECVIAR.js +322 -0
- package/dist/chunk-NATGCIVM.js +583 -0
- package/dist/chunk-O57GKTYU.js +30 -0
- package/dist/chunk-ODJCZ27I.js +50 -0
- package/dist/chunk-P53CKOME.js +1 -0
- package/dist/chunk-Q2H75UYT.js +92 -0
- package/dist/chunk-Q7JK4KY7.js +9 -0
- package/dist/chunk-QELZ6TEJ.js +208 -0
- package/dist/chunk-QQRDUMB2.js +40 -0
- package/dist/chunk-RBUMDYFS.js +681 -0
- package/dist/chunk-REPX5QPI.js +57 -0
- package/dist/chunk-SAS5KKCR.js +43 -0
- package/dist/chunk-SKLMWHQD.js +109 -0
- package/dist/chunk-SOQDEPME.js +131 -0
- package/dist/chunk-SWPDU752.js +28 -0
- package/dist/chunk-T775TUCD.js +18 -0
- package/dist/chunk-UBN5JJKZ.js +26 -0
- package/dist/chunk-UJHOUZAL.js +36 -0
- package/dist/chunk-UP6GGGAN.js +34 -0
- package/dist/chunk-VMOBW7RK.js +21 -0
- package/dist/chunk-VNMG7NKY.js +69 -0
- package/dist/chunk-WNPNNYXY.js +22 -0
- package/dist/chunk-XB5GYODW.js +28 -0
- package/dist/chunk-XXWNMJI6.js +15 -0
- package/dist/chunk-YL2SO5TP.js +334 -0
- package/dist/chunk-YO4LWS3I.js +606 -0
- package/dist/chunk-ZAQSS47X.js +157 -0
- package/dist/chunk-ZCQUUJIF.js +129 -0
- package/dist/client/EventTransport.d.ts +131 -0
- package/dist/client/EventTransport.js +2 -0
- package/dist/client/ServerBridge.d.ts +126 -0
- package/dist/client/ServerBridge.js +3 -0
- package/dist/client/awaiting.d.ts +28 -0
- package/dist/client/awaiting.js +2 -0
- package/dist/client/channel-transport.d.ts +69 -0
- package/dist/client/channel-transport.js +2 -0
- package/dist/client/circuit-store.d.ts +76 -0
- package/dist/client/circuit-store.js +4 -0
- package/dist/client/client-kernel.d.ts +113 -0
- package/dist/client/client-kernel.js +1 -0
- package/dist/client/declared-input-dispatch.d.ts +5 -0
- package/dist/client/declared-input-dispatch.js +2 -0
- package/dist/client/inbound-dispatch.d.ts +5 -0
- package/dist/client/inbound-dispatch.js +2 -0
- package/dist/client/local-fold.d.ts +26 -0
- package/dist/client/local-fold.js +2 -0
- package/dist/client/render-sigils.d.ts +24 -0
- package/dist/client/render-sigils.js +2 -0
- package/dist/client/state-book.d.ts +37 -0
- package/dist/client/state-book.js +2 -0
- package/dist/client/trait-mount-error.d.ts +9 -0
- package/dist/client/trait-mount-error.js +2 -0
- package/dist/client/trait-types.d.ts +67 -0
- package/dist/client/trait-types.js +1 -0
- package/dist/credentials/env-vars.d.ts +14 -0
- package/dist/credentials/env-vars.js +3 -0
- package/dist/credentials/scope.d.ts +50 -0
- package/dist/credentials/scope.js +2 -0
- package/dist/credentials/seed.d.ts +21 -0
- package/dist/credentials/seed.js +2 -0
- package/dist/credentials/store.d.ts +110 -0
- package/dist/credentials/store.js +2 -0
- package/dist/effects/in-flight-calls.d.ts +36 -0
- package/dist/effects/in-flight-calls.js +2 -0
- package/dist/effects/on-device-model.d.ts +22 -0
- package/dist/effects/on-device-model.js +2 -0
- package/dist/events/EventBus.d.ts +90 -0
- package/dist/events/EventBus.js +2 -0
- package/dist/events/emit-stamp.d.ts +47 -0
- package/dist/events/emit-stamp.js +2 -0
- package/dist/index-hT1xCdTq.d.ts +46 -0
- package/dist/index.d.ts +60 -0
- package/dist/index.js +59 -0
- package/dist/kernel/beacon.d.ts +32 -0
- package/dist/kernel/beacon.js +2 -0
- package/dist/kernel/decode.d.ts +15 -0
- package/dist/kernel/decode.js +2 -0
- package/dist/kernel/engine.d.ts +94 -0
- package/dist/kernel/engine.js +11 -0
- package/dist/kernel/frame-applier.d.ts +43 -0
- package/dist/kernel/frame-applier.js +2 -0
- package/dist/kernel/host.d.ts +95 -0
- package/dist/kernel/host.js +9 -0
- package/dist/kernel/http.d.ts +302 -0
- package/dist/kernel/http.js +6 -0
- package/dist/kernel/lane.d.ts +28 -0
- package/dist/kernel/lane.js +2 -0
- package/dist/kernel/oauth-effects.d.ts +25 -0
- package/dist/kernel/oauth-effects.js +7 -0
- package/dist/kernel/oauth-port.d.ts +31 -0
- package/dist/kernel/oauth-port.js +2 -0
- package/dist/kernel/os-port.d.ts +133 -0
- package/dist/kernel/os-port.js +2 -0
- package/dist/kernel/program-effects.d.ts +65 -0
- package/dist/kernel/program-effects.js +2 -0
- package/dist/kernel/wire.d.ts +66 -0
- package/dist/kernel/wire.js +1 -0
- package/dist/loader/http-loader.d.ts +111 -0
- package/dist/loader/http-loader.js +2 -0
- package/dist/loader/lazy-page.d.ts +12 -0
- package/dist/loader/lazy-page.js +2 -0
- package/dist/loader/schema-loader.d.ts +160 -0
- package/dist/loader/schema-loader.js +1 -0
- package/dist/persistence/native-memory.d.ts +28 -0
- package/dist/persistence/native-memory.js +2 -0
- package/dist/runtime/effects/composition/compose-behaviors.d.ts +58 -0
- package/dist/runtime/effects/composition/compose-behaviors.js +4 -0
- package/dist/runtime/effects/composition/event-wiring.d.ts +38 -0
- package/dist/runtime/effects/composition/event-wiring.js +2 -0
- package/dist/runtime/effects/composition/index.d.ts +5 -0
- package/dist/runtime/effects/composition/index.js +6 -0
- package/dist/runtime/effects/composition/layout-strategy.d.ts +35 -0
- package/dist/runtime/effects/composition/layout-strategy.js +2 -0
- package/dist/runtime/effects/composition/pipe.d.ts +25 -0
- package/dist/runtime/effects/composition/pipe.js +2 -0
- package/dist/runtime/entities/mockStoreSeed.d.ts +56 -0
- package/dist/runtime/entities/mockStoreSeed.js +3 -0
- package/dist/runtime/entities/seedBrowserStore.d.ts +28 -0
- package/dist/runtime/entities/seedBrowserStore.js +2 -0
- package/dist/runtime/entities/std-mock-seed.d.ts +87 -0
- package/dist/runtime/entities/std-mock-seed.js +2 -0
- package/dist/runtime/evaluation/local-store-transport.d.ts +68 -0
- package/dist/runtime/evaluation/local-store-transport.js +18 -0
- package/dist/runtime/evaluation/residence-transport.d.ts +15 -0
- package/dist/runtime/evaluation/residence-transport.js +2 -0
- package/dist/runtime/evaluation/routed-persistence.d.ts +9 -0
- package/dist/runtime/evaluation/routed-persistence.js +2 -0
- package/dist/runtime/events/identity/routing.d.ts +84 -0
- package/dist/runtime/events/identity/routing.js +2 -0
- package/dist/runtime/time/TickScheduler.d.ts +77 -0
- package/dist/runtime/time/TickScheduler.js +3 -0
- package/dist/runtime/time/cron.d.ts +25 -0
- package/dist/runtime/time/cron.js +2 -0
- package/dist/runtime/time/duration.d.ts +20 -0
- package/dist/runtime/time/duration.js +2 -0
- package/dist/runtime/traits/OrbitalTraitParsing.d.ts +34 -0
- package/dist/runtime/traits/OrbitalTraitParsing.js +2 -0
- package/dist/runtime/traits/listen-targets.d.ts +16 -0
- package/dist/runtime/traits/listen-targets.js +3 -0
- package/dist/runtime/traits/trait-index.d.ts +35 -0
- package/dist/runtime/traits/trait-index.js +3 -0
- package/dist/runtime/types.d.ts +574 -0
- package/dist/runtime/types.js +2 -0
- package/dist/service/default-call-service.d.ts +23 -0
- package/dist/service/default-call-service.js +3 -0
- package/dist/service/service-provider.d.ts +37 -0
- package/dist/service/service-provider.js +2 -0
- package/package.json +46 -3
- package/README.md +0 -3
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The in-flight `call-service` registry of ONE running app: a call declared
|
|
3
|
+
* with a `key` registers here for as long as it runs, and `cancel-call` aborts
|
|
4
|
+
* every call running under that key. One instance is shared by every transition of the app.
|
|
5
|
+
*/
|
|
6
|
+
type KeyedCallOutcome<T> = {
|
|
7
|
+
cancelled: true;
|
|
8
|
+
} | {
|
|
9
|
+
cancelled: false;
|
|
10
|
+
value: T;
|
|
11
|
+
};
|
|
12
|
+
interface KeyedCallLease {
|
|
13
|
+
signal: AbortSignal;
|
|
14
|
+
release(): void;
|
|
15
|
+
}
|
|
16
|
+
declare class InFlightCalls {
|
|
17
|
+
private readonly calls;
|
|
18
|
+
/** Whether a call started with `key` is still running. */
|
|
19
|
+
inFlight(key: string): boolean;
|
|
20
|
+
/**
|
|
21
|
+
* Run `work` registered under `key`, handing it the abort signal; `work` must settle promptly once the
|
|
22
|
+
* signal aborts (see `untilAborted`). The call is cancelled when the signal was aborted by the time
|
|
23
|
+
* `work` settles, whatever it settled with.
|
|
24
|
+
*/
|
|
25
|
+
run<T>(key: string, work: (signal: AbortSignal) => Promise<T>): Promise<KeyedCallOutcome<T>>;
|
|
26
|
+
reserve(key: string): KeyedCallLease | undefined;
|
|
27
|
+
private track;
|
|
28
|
+
cancelAll(): void;
|
|
29
|
+
/** Abort every call running under `key`; false (a no-op) when none is. */
|
|
30
|
+
cancel(key: string): boolean;
|
|
31
|
+
}
|
|
32
|
+
/** `promise`, or a rejection as soon as `signal` aborts: a provider that ignores the signal is not waited for. */
|
|
33
|
+
declare function untilAborted<T>(signal: AbortSignal, promise: Promise<T>): Promise<T>;
|
|
34
|
+
|
|
35
|
+
export { InFlightCalls, untilAborted };
|
|
36
|
+
export type { KeyedCallLease, KeyedCallOutcome };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { OnDeviceFailureKind, OnDeviceFailurePayload, OnDeviceModelPorts } from '@almadar/core';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* `browser/prompt` and `browser/embed`: the host's on-device model and embedder behind one contract, shared by the
|
|
5
|
+
* interpreter (`EffectExecutor`) and the kernel host (`answerRequest`). A host with no port fails `unconfigured`, a
|
|
6
|
+
* model that cannot answer now fails `unavailable`, and one that errors fails `failed`.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
declare const NO_ON_DEVICE_MODEL = "browser/prompt: no on-device model is wired into this host";
|
|
10
|
+
declare const NO_ON_DEVICE_EMBEDDER = "browser/embed: no on-device embedder is wired into this host";
|
|
11
|
+
/** An on-device call that gave no answer; `payload` is what the failure route receives. */
|
|
12
|
+
declare class OnDeviceModelFailure extends Error {
|
|
13
|
+
readonly kind: OnDeviceFailureKind;
|
|
14
|
+
readonly payload: OnDeviceFailurePayload;
|
|
15
|
+
constructor(kind: OnDeviceFailureKind, message: string, key: string | null);
|
|
16
|
+
}
|
|
17
|
+
/** The reply text of one prompt; the schema text must be a JSON object. */
|
|
18
|
+
declare function promptOnDevice(ports: OnDeviceModelPorts | undefined, text: string, schemaText: string, key: string | null, signal?: AbortSignal): Promise<string>;
|
|
19
|
+
/** One vector per text, in input order; an empty list is answered without asking the embedder. */
|
|
20
|
+
declare function embedOnDevice(ports: OnDeviceModelPorts | undefined, texts: readonly string[], key: string | null, signal?: AbortSignal): Promise<number[][]>;
|
|
21
|
+
|
|
22
|
+
export { NO_ON_DEVICE_EMBEDDER, NO_ON_DEVICE_MODEL, OnDeviceModelFailure, embedOnDevice, promptOnDevice };
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { IEventBus, RuntimeEvent, EventListener, Unsubscribe } from '../runtime/types.js';
|
|
2
|
+
import { EventPayload } from '@almadar/core';
|
|
3
|
+
import '../service/default-call-service.js';
|
|
4
|
+
import '../service/service-provider.js';
|
|
5
|
+
import '../kernel/program-effects.js';
|
|
6
|
+
import '../runtime/effects/composition/compose-behaviors.js';
|
|
7
|
+
import '../runtime/effects/composition/event-wiring.js';
|
|
8
|
+
import '../runtime/effects/composition/layout-strategy.js';
|
|
9
|
+
import '../runtime/effects/composition/pipe.js';
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* EventBus - Platform-Agnostic Pub/Sub Implementation
|
|
13
|
+
*
|
|
14
|
+
* Pure TypeScript event bus for cross-trait communication.
|
|
15
|
+
* Works on both client (browser) and server (Node.js).
|
|
16
|
+
*
|
|
17
|
+
* @packageDocumentation
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* EventBus - Simple pub/sub event bus
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* ```typescript
|
|
25
|
+
* const bus = new EventBus({ debug: true });
|
|
26
|
+
*
|
|
27
|
+
* // Subscribe
|
|
28
|
+
* const unsub = bus.on('ORDER_CONFIRMED', (event) => {
|
|
29
|
+
* log.debug('order-confirmed', { orderId: event.payload?.orderId });
|
|
30
|
+
* });
|
|
31
|
+
*
|
|
32
|
+
* // Emit
|
|
33
|
+
* bus.emit('ORDER_CONFIRMED', { orderId: '123' });
|
|
34
|
+
*
|
|
35
|
+
* // Unsubscribe
|
|
36
|
+
* unsub();
|
|
37
|
+
* ```
|
|
38
|
+
*/
|
|
39
|
+
declare class EventBus implements IEventBus {
|
|
40
|
+
private listeners;
|
|
41
|
+
/** Maximum recursion depth before circuit breaker activates (RCG-05) */
|
|
42
|
+
private maxDepth;
|
|
43
|
+
/** Current emission depth for circular loop detection */
|
|
44
|
+
private depth;
|
|
45
|
+
constructor(options?: {
|
|
46
|
+
debug?: boolean;
|
|
47
|
+
maxDepth?: number;
|
|
48
|
+
});
|
|
49
|
+
/**
|
|
50
|
+
* Emit an event to all registered listeners.
|
|
51
|
+
*
|
|
52
|
+
* Includes circuit breaker (RCG-05): if emit is called recursively
|
|
53
|
+
* beyond `maxDepth`, the event is dropped and an error is logged.
|
|
54
|
+
* This prevents infinite loops from circular emit/listen chains.
|
|
55
|
+
*/
|
|
56
|
+
emit(type: string, payload?: EventPayload, source?: RuntimeEvent['source'], routingKey?: string): void;
|
|
57
|
+
/**
|
|
58
|
+
* Subscribe to an event type
|
|
59
|
+
*/
|
|
60
|
+
on(type: string, listener: EventListener): Unsubscribe;
|
|
61
|
+
/**
|
|
62
|
+
* Subscribe to ALL events (wildcard listener)
|
|
63
|
+
* Useful for event tracking, logging, debugging
|
|
64
|
+
*/
|
|
65
|
+
onAny(listener: EventListener): Unsubscribe;
|
|
66
|
+
/**
|
|
67
|
+
* Check if there are listeners for an event type
|
|
68
|
+
*/
|
|
69
|
+
hasListeners(type: string): boolean;
|
|
70
|
+
/**
|
|
71
|
+
* Get all registered event types
|
|
72
|
+
*/
|
|
73
|
+
getRegisteredEvents(): string[];
|
|
74
|
+
/**
|
|
75
|
+
* Clear all listeners
|
|
76
|
+
*/
|
|
77
|
+
clear(): void;
|
|
78
|
+
/**
|
|
79
|
+
* Get listener count for an event type (for testing)
|
|
80
|
+
*/
|
|
81
|
+
getListenerCount(type: string): number;
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Create a new EventBus instance
|
|
85
|
+
*/
|
|
86
|
+
declare function createEventBus(options?: {
|
|
87
|
+
debug?: boolean;
|
|
88
|
+
}): IEventBus;
|
|
89
|
+
|
|
90
|
+
export { EventBus, createEventBus };
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { OrbitalId, TraitId, EventId, BusEventSource } from '@almadar/core';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* emit-stamp — the ONE emit-source stamper.
|
|
5
|
+
*
|
|
6
|
+
* Extracted from `OrbitalServerRuntime.executeEffects`'s emit handler so
|
|
7
|
+
* every execution path (stateful server, stateless per-request, any future
|
|
8
|
+
* emitter) stamps emitted events identically. G-RUNTIME-030 was exactly
|
|
9
|
+
* this decision existing twice with different outcomes: a stamp missing
|
|
10
|
+
* the V4 `traitId`/`orbitalId`/`eventId` triple silently never matches an
|
|
11
|
+
* id-scoped `listens` matcher (`buildSourceMatcher`), and the fan-out dies
|
|
12
|
+
* without an error.
|
|
13
|
+
*
|
|
14
|
+
* All four ids are optional dual-carry: absent → name-only stamp (legacy,
|
|
15
|
+
* name-keyed routing), present → id-keyed routing via `eventRouteKey`.
|
|
16
|
+
*
|
|
17
|
+
* @packageDocumentation
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
interface StampEmitIdentity {
|
|
21
|
+
/** The dispatching orbital's declared name (name-stamp fallback). */
|
|
22
|
+
orbitalName: string;
|
|
23
|
+
/** The emitting trait's declared name (name-stamp fallback). */
|
|
24
|
+
traitName: string;
|
|
25
|
+
/** V4 ids, when the schema carries them. */
|
|
26
|
+
orbitalId?: OrbitalId;
|
|
27
|
+
traitId?: TraitId;
|
|
28
|
+
/**
|
|
29
|
+
* The emitting trait's `emits[]` contract entry id for THIS event — the
|
|
30
|
+
* single canonical event id (mirrors `resolveSourceEmitEventId` on the
|
|
31
|
+
* listen side; the listener's own declared id can be stale, the emit
|
|
32
|
+
* contract's is what the emitter actually stamps).
|
|
33
|
+
*/
|
|
34
|
+
emitContractEventId?: EventId;
|
|
35
|
+
/** The originating tab's client id, when this emit is client-driven. */
|
|
36
|
+
originClientId?: string;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Fill a bus-event source stamp with the V4 identity triple + origin.
|
|
40
|
+
* Mutates and returns `source` when given (handlers pass their closure
|
|
41
|
+
* source through); otherwise synthesizes one from the lexical identity.
|
|
42
|
+
* Never overwrites a field already set on the stamp.
|
|
43
|
+
*/
|
|
44
|
+
declare function stampEmitSource(source: BusEventSource | undefined, identity: StampEmitIdentity): BusEventSource;
|
|
45
|
+
|
|
46
|
+
export { stampEmitSource };
|
|
47
|
+
export type { StampEmitIdentity };
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { ComposeBehaviorsInput, ComposeBehaviorsResult, composeBehaviors } from './runtime/effects/composition/compose-behaviors.js';
|
|
2
|
+
import { EventWiringEntry, applyEventWiring } from './runtime/effects/composition/event-wiring.js';
|
|
3
|
+
import { LayoutStrategy, detectLayoutStrategy } from './runtime/effects/composition/layout-strategy.js';
|
|
4
|
+
import { PipeStep, pipeBehaviors } from './runtime/effects/composition/pipe.js';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Composition Module
|
|
8
|
+
*
|
|
9
|
+
* Runtime-side TypeScript composition layer for behavior/* operators.
|
|
10
|
+
*
|
|
11
|
+
* Composition is normally a compile-time concept, evaluated by the Rust
|
|
12
|
+
* compiler pass before code generation. The runtime ships an equivalent
|
|
13
|
+
* TypeScript implementation so dev-mode hot reload, agent-driven dynamic
|
|
14
|
+
* composition, and the legacy `composeBehaviors()` callers all have a
|
|
15
|
+
* usable in-process implementation. The handlers are wired into
|
|
16
|
+
* `EffectExecutor` as optional handlers (`composeBehaviors`,
|
|
17
|
+
* `applyEventWiring`, `detectLayoutStrategy`, `pipeBehaviors`) so
|
|
18
|
+
* consumers that do not need composition pay no cost.
|
|
19
|
+
*
|
|
20
|
+
* @packageDocumentation
|
|
21
|
+
*/
|
|
22
|
+
|
|
23
|
+
declare const index_ComposeBehaviorsInput: typeof ComposeBehaviorsInput;
|
|
24
|
+
declare const index_ComposeBehaviorsResult: typeof ComposeBehaviorsResult;
|
|
25
|
+
declare const index_EventWiringEntry: typeof EventWiringEntry;
|
|
26
|
+
declare const index_LayoutStrategy: typeof LayoutStrategy;
|
|
27
|
+
declare const index_PipeStep: typeof PipeStep;
|
|
28
|
+
declare const index_applyEventWiring: typeof applyEventWiring;
|
|
29
|
+
declare const index_composeBehaviors: typeof composeBehaviors;
|
|
30
|
+
declare const index_detectLayoutStrategy: typeof detectLayoutStrategy;
|
|
31
|
+
declare const index_pipeBehaviors: typeof pipeBehaviors;
|
|
32
|
+
declare namespace index {
|
|
33
|
+
export {
|
|
34
|
+
index_ComposeBehaviorsInput as ComposeBehaviorsInput,
|
|
35
|
+
index_ComposeBehaviorsResult as ComposeBehaviorsResult,
|
|
36
|
+
index_EventWiringEntry as EventWiringEntry,
|
|
37
|
+
index_LayoutStrategy as LayoutStrategy,
|
|
38
|
+
index_PipeStep as PipeStep,
|
|
39
|
+
index_applyEventWiring as applyEventWiring,
|
|
40
|
+
index_composeBehaviors as composeBehaviors,
|
|
41
|
+
index_detectLayoutStrategy as detectLayoutStrategy,
|
|
42
|
+
index_pipeBehaviors as pipeBehaviors,
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export { index as i };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
export { AccessTokenProvider, COMPRESSED_BODY_MIN_BYTES, EventTransport, EventTransportRegisterResult, HostDispatchListener, HttpTransportOptions, InProcessTransportOptions, OrbitalEvaluator, PushTarget, createHttpTransport, createInProcessTransport, deriveCarriesCircuitState, encodeJsonBody } from './client/EventTransport.js';
|
|
2
|
+
export { ServerBridge, ServerBridgeConfig, ServerBridgeState, createServerBridge } from './client/ServerBridge.js';
|
|
3
|
+
export { AwaitingRegistry } from './client/awaiting.js';
|
|
4
|
+
export { ChannelMessage, ChannelTransportOptions, ServedChannel, TransportChannel, createChannelTransport, holdUntilServed, serveChannel } from './client/channel-transport.js';
|
|
5
|
+
export { CircuitStore, TraitSnapshot, createMemoryCircuitStore } from './client/circuit-store.js';
|
|
6
|
+
export { ClientDispatchHooks, ClientKernel, ClientKernelOutcome, ClientMountHooks, ClientMountOutcome, LocalFoldKernel } from './client/client-kernel.js';
|
|
7
|
+
export { dispatchDeclaredInput } from './client/declared-input-dispatch.js';
|
|
8
|
+
export { dispatchInbound } from './client/inbound-dispatch.js';
|
|
9
|
+
export { LocalFoldOptions, createLocalFold, mirrorResponse, traceResponse } from './client/local-fold.js';
|
|
10
|
+
export { DEFAULT_THEME_KEY, appNavItems, inlineNavItems, sigilThemeKey } from './client/render-sigils.js';
|
|
11
|
+
export { StateBook, createInitialTraitState, findInitialState, findMatchingTransitions, findTransition } from './client/state-book.js';
|
|
12
|
+
export { TraitMountError } from './client/trait-mount-error.js';
|
|
13
|
+
export { RollbackCause, TraitState, TransitionObserver } from './client/trait-types.js';
|
|
14
|
+
export { STORE_BOOTSTRAP_ENV_VARS, allCredentialEnvVars } from './credentials/env-vars.js';
|
|
15
|
+
export { CREDENTIALS_SOURCE_ENV, CredentialMode, CredentialModeControl, CredentialScopeStorage, credentialModeFromEnv, credentialsFromStoreOnly, getEffectiveCredentialStore, getInstalledCredentialStore, getModeControl, installCredentialScopeStorage, installCredentialStore, installModeControl, resolveCredentialRef, runWithCredentialScope, uninstallCredentialStore } from './credentials/scope.js';
|
|
16
|
+
export { CredentialSeedKernel, DeclaredCredential, seedCredentialStore } from './credentials/seed.js';
|
|
17
|
+
export { CREDENTIAL_ENTITY_TYPE, CREDENTIAL_MASTER_KEY_ENV, CREDENTIAL_PREVIOUS_MASTER_KEY_ENV, CredentialEntry, CredentialPersistence, CredentialStore, DERIVED_ENTITY_TYPE, DerivedPersistence } from './credentials/store.js';
|
|
18
|
+
export { InFlightCalls, KeyedCallLease, KeyedCallOutcome, untilAborted } from './effects/in-flight-calls.js';
|
|
19
|
+
export { NO_ON_DEVICE_EMBEDDER, NO_ON_DEVICE_MODEL, OnDeviceModelFailure, embedOnDevice, promptOnDevice } from './effects/on-device-model.js';
|
|
20
|
+
export { EventBus, createEventBus } from './events/EventBus.js';
|
|
21
|
+
export { StampEmitIdentity, stampEmitSource } from './events/emit-stamp.js';
|
|
22
|
+
export { BeaconDelivery, BeaconDeliveryPorts, BeaconFetchInit, deliverBeacon } from './kernel/beacon.js';
|
|
23
|
+
export { decodeHttpBody, decodeHttpRequest, decodeHttpResponse, decodeOAuthAsk, decodeProgress, decodeRequest, decodeResolveProgress } from './kernel/decode.js';
|
|
24
|
+
export { KernelEngine, KernelEvaluation, evaluateOnKernel, kernelRequest } from './kernel/engine.js';
|
|
25
|
+
export { FrameApplied, FrameDispatch, FramePostPort, TickEffects, applyFrame, decodeFrame, isFrameWire } from './kernel/frame-applier.js';
|
|
26
|
+
export { DeferredCallOutcome, KernelAnswerScope, KernelCallService, KernelHostPorts, SubstrateStreamSource, answerRequest, declareCapabilities, writeRows } from './kernel/host.js';
|
|
27
|
+
export { BeaconSettled, BrowserHttpPortsOptions, CredentialAdminPort, Exchange, HttpEffectFailure, HttpKernel, HttpOutcome, HttpPorts, HttpPortsOptions, HttpRunOptions, HttpSecrets, HttpSecretsHost, HttpUnavailableError, NetPort, OAuthAuthorizeKernel, OAuthPort, PinnedFetch, PinnedInit, PinnedResponse, RANDOM_BYTES_MAX, RandomSource, ResolvedHost, StreamFrame, StreamFramingWire, base64Standard, base64Url, checkOAuthReply, createBrowserHttpPorts, createCredentialAdminPort, createHttpPorts, createHttpSecrets, credentialForgetPayload, credentialStatusPayload, installNetPort, isOAuthCode, isOAuthReason, randomBytesPayload, runHttpCall, sendBeaconRequest, sendHttp, streamHttp, systemRandom, unavailableFailure, userCredentialKey } from './kernel/http.js';
|
|
28
|
+
export { DispatchLane, LaneGuard, LaneHeldByParkedDispatch, LaneTurn } from './kernel/lane.js';
|
|
29
|
+
export { OAuthEffectFailure, oauthAuthorizePayload, oauthConnectionPayload } from './kernel/oauth-effects.js';
|
|
30
|
+
export { OAuthConsentRequest, OAuthPortOptions, PENDING_GRACE_MS, createOAuthPort } from './kernel/oauth-port.js';
|
|
31
|
+
export { AnchoredPath, OsAnchorProblem, OsAnchors, OsCompletionEvent, OsCompletionMatchers, OsCompletionPort, OsDesktopKind, OsFsMode, OsGrantKernel, OsGrantMatchers, OsGrantPort, OsHostPort, OsNetKind, OsRequirement, OsStdioKind, OsSysKind, anchoredGrants, expandAnchor, kernelOsCompletions, kernelOsGrants } from './kernel/os-port.js';
|
|
32
|
+
export { CascadeOutcome, PROGRAM_EFFECTS, PlayedStep, ProgramEffectName, ProgramEffectOutcome, ProgramValidationReport, StepRequest, isProgramEffect } from './kernel/program-effects.js';
|
|
33
|
+
export { KernelModule, KernelServerClass, KernelServerHandle } from './kernel/wire.js';
|
|
34
|
+
export { HttpImportChain, HttpLoader, createHttpLoader } from './loader/http-loader.js';
|
|
35
|
+
export { loadLazyPage } from './loader/lazy-page.js';
|
|
36
|
+
export { BaseLoaderOptions, HttpLoaderOptions, ImportChainLike, LoadResult, LoadedOrbital, LoadedSchema, SchemaLoader } from './loader/schema-loader.js';
|
|
37
|
+
export { ComposeBehaviorsInput, ComposeBehaviorsResult, composeBehaviors } from './runtime/effects/composition/compose-behaviors.js';
|
|
38
|
+
export { EventWiringEntry, applyEventWiring } from './runtime/effects/composition/event-wiring.js';
|
|
39
|
+
export { i as composition } from './index-hT1xCdTq.js';
|
|
40
|
+
export { LayoutStrategy, detectLayoutStrategy } from './runtime/effects/composition/layout-strategy.js';
|
|
41
|
+
export { PipeStep, pipeBehaviors } from './runtime/effects/composition/pipe.js';
|
|
42
|
+
export { MockSeedHost, MockSeedViewer, MockSeeded, bindDeclaredCollections, restampMockOwner, seedMockStore } from './runtime/entities/mockStoreSeed.js';
|
|
43
|
+
export { MockSeedEngine, MockSeedRun, SeedConfig, SeedOwnerCell, SeedOwnerChange, SeedOwnerJournal, SeedRestamp, SeededDataset, StdMockSeed, declaredSeedConfig, readSeededStores } from './runtime/entities/std-mock-seed.js';
|
|
44
|
+
export { BrowserSeedHost, seedBrowserStore } from './runtime/entities/seedBrowserStore.js';
|
|
45
|
+
export { LocalKernelOptions, LocalStoreTransportOptions, createLocalStoreTransport, localStorePersistence, openLocalKernel, resolveLocalRows } from './runtime/evaluation/local-store-transport.js';
|
|
46
|
+
export { ResidenceTransportOptions, createResidenceTransport } from './runtime/evaluation/residence-transport.js';
|
|
47
|
+
export { routeByEntity } from './runtime/evaluation/routed-persistence.js';
|
|
48
|
+
export { ListenSourceDescriptor, RouteSourceMeta, buildSourceMatcher, eventRouteKey, parseListenSource } from './runtime/events/identity/routing.js';
|
|
49
|
+
export { TickHandle, TickScheduler, createTickScheduler } from './runtime/time/TickScheduler.js';
|
|
50
|
+
export { CronFields, cronMatches, cronMinuteKey, isValidCronExpression, parseCron, parseCronField } from './runtime/time/cron.js';
|
|
51
|
+
export { isValidDurationString, parseDurationString } from './runtime/time/duration.js';
|
|
52
|
+
export { ParsedOrbitalTraits, parseOrbitalTraits } from './runtime/traits/OrbitalTraitParsing.js';
|
|
53
|
+
export { CollectedListenerTarget, collectListenerTargets } from './runtime/traits/listen-targets.js';
|
|
54
|
+
export { buildTraitIndex } from './runtime/traits/trait-index.js';
|
|
55
|
+
export { BindingContext, BrowserFileMeta, BrowserFilePickerOptions, BrowserGeolocationOptions, BrowserGeolocationPosition, ConfigContext, Effect, EffectContext, EffectHandlers, EffectResult, EvaluationContextExtensions, EventListener, ExecutionEnvironment, HANDLER_MANIFEST, HttpEffectReport, IEventBus, PatternProps, PersistBatchSummary, RuntimeConfig, RuntimeEvent, RuntimePatternValue, RuntimeRenderPattern, TransitionResult, Unsubscribe, isEffectTuple } from './runtime/types.js';
|
|
56
|
+
export { CallServiceHandler, ServiceMessageRoute, defaultCallService } from './service/default-call-service.js';
|
|
57
|
+
export { ServiceCallContext, ServiceCallError, ServiceCallErrorCode, ServiceProvider, callRegisteredService, registerServiceProvider, registeredServices, unregisterServiceProvider } from './service/service-provider.js';
|
|
58
|
+
export { NativeMemoryPersistenceAdapter, NativeMemoryWriteError } from './persistence/native-memory.js';
|
|
59
|
+
export { CallRoutesWire, CallSiteWire, CallerWire, HttpBody, HttpFailureWire, HttpRequestWire, HttpResponseWire, IoAnswerWire, IoReplyWire, IoRequestWire, PendingRequestWire, ResolveProgressWire, ServerProgressWire, Settled, SubstrateFailureWire } from '@almadar/core/kernel-wire';
|
|
60
|
+
export { EntityRow, EventPayload, FetchResult, HttpCall, ServiceParams } from '@almadar/core';
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
export { HANDLER_MANIFEST, isEffectTuple } from './chunk-WNPNNYXY.js';
|
|
2
|
+
export { TickScheduler, createTickScheduler } from './chunk-CQP5XAX6.js';
|
|
3
|
+
export { cronMatches, cronMinuteKey, isValidCronExpression, parseCron, parseCronField } from './chunk-CROS2GEX.js';
|
|
4
|
+
export { isValidDurationString, parseDurationString } from './chunk-46RWK2B5.js';
|
|
5
|
+
export { collectListenerTargets } from './chunk-XB5GYODW.js';
|
|
6
|
+
export { buildSourceMatcher, eventRouteKey, parseListenSource } from './chunk-IHQLE5M7.js';
|
|
7
|
+
export { composition_exports as composition } from './chunk-5D63EMO5.js';
|
|
8
|
+
export { pipeBehaviors } from './chunk-FQ6IZMIU.js';
|
|
9
|
+
export { bindDeclaredCollections, restampMockOwner, seedMockStore } from './chunk-JFWFDUTR.js';
|
|
10
|
+
export { seedBrowserStore } from './chunk-T775TUCD.js';
|
|
11
|
+
export { StdMockSeed, declaredSeedConfig, readSeededStores } from './chunk-HMK6YMQS.js';
|
|
12
|
+
export { createLocalStoreTransport, localStorePersistence, openLocalKernel, resolveLocalRows } from './chunk-VNMG7NKY.js';
|
|
13
|
+
export { defaultCallService } from './chunk-4SEK5ER2.js';
|
|
14
|
+
export { ServiceCallError, callRegisteredService, registerServiceProvider, registeredServices, unregisterServiceProvider } from './chunk-UBN5JJKZ.js';
|
|
15
|
+
export { routeByEntity } from './chunk-O57GKTYU.js';
|
|
16
|
+
export { buildTraitIndex } from './chunk-CPSQXEJ6.js';
|
|
17
|
+
export { parseOrbitalTraits } from './chunk-SAS5KKCR.js';
|
|
18
|
+
export { createResidenceTransport } from './chunk-UJHOUZAL.js';
|
|
19
|
+
import './chunk-EZZYLTWY.js';
|
|
20
|
+
export { HttpImportChain, HttpLoader, createHttpLoader } from './chunk-YL2SO5TP.js';
|
|
21
|
+
export { loadLazyPage } from './chunk-XXWNMJI6.js';
|
|
22
|
+
import './chunk-ELBLT2HZ.js';
|
|
23
|
+
export { NativeMemoryPersistenceAdapter, NativeMemoryWriteError } from './chunk-7SDV3QWR.js';
|
|
24
|
+
export { composeBehaviors } from './chunk-ZCQUUJIF.js';
|
|
25
|
+
export { detectLayoutStrategy } from './chunk-EV56K4GB.js';
|
|
26
|
+
export { applyEventWiring } from './chunk-MHYSHSRG.js';
|
|
27
|
+
export { KernelEngine, evaluateOnKernel, kernelRequest } from './chunk-D4XJTBLB.js';
|
|
28
|
+
export { applyFrame, decodeFrame, isFrameWire } from './chunk-4J2QEIUV.js';
|
|
29
|
+
export { answerRequest, declareCapabilities, writeRows } from './chunk-NATGCIVM.js';
|
|
30
|
+
export { PROGRAM_EFFECTS, isProgramEffect } from './chunk-HNOAZWFH.js';
|
|
31
|
+
export { DispatchLane, LaneHeldByParkedDispatch } from './chunk-53IPZXDP.js';
|
|
32
|
+
export { OAuthEffectFailure, oauthAuthorizePayload, oauthConnectionPayload } from './chunk-ZAQSS47X.js';
|
|
33
|
+
export { HttpEffectFailure, HttpUnavailableError, RANDOM_BYTES_MAX, base64Standard, base64Url, checkOAuthReply, createBrowserHttpPorts, createCredentialAdminPort, createHttpPorts, createHttpSecrets, credentialForgetPayload, credentialStatusPayload, installNetPort, isOAuthCode, isOAuthReason, randomBytesPayload, runHttpCall, sendBeaconRequest, sendHttp, streamHttp, systemRandom, unavailableFailure, userCredentialKey } from './chunk-YO4LWS3I.js';
|
|
34
|
+
export { PENDING_GRACE_MS, createOAuthPort } from './chunk-4ZICQ5PM.js';
|
|
35
|
+
export { anchoredGrants, expandAnchor, kernelOsCompletions, kernelOsGrants } from './chunk-REPX5QPI.js';
|
|
36
|
+
export { InFlightCalls, untilAborted } from './chunk-MZKIL5IN.js';
|
|
37
|
+
export { NO_ON_DEVICE_EMBEDDER, NO_ON_DEVICE_MODEL, OnDeviceModelFailure, embedOnDevice, promptOnDevice } from './chunk-FWA5K7Q2.js';
|
|
38
|
+
export { EventBus, createEventBus } from './chunk-SOQDEPME.js';
|
|
39
|
+
export { stampEmitSource } from './chunk-64IH2SMY.js';
|
|
40
|
+
export { deliverBeacon } from './chunk-VMOBW7RK.js';
|
|
41
|
+
export { decodeHttpBody, decodeHttpRequest, decodeHttpResponse, decodeOAuthAsk, decodeProgress, decodeRequest, decodeResolveProgress } from './chunk-RBUMDYFS.js';
|
|
42
|
+
export { createLocalFold, mirrorResponse, traceResponse } from './chunk-QQRDUMB2.js';
|
|
43
|
+
export { DEFAULT_THEME_KEY, appNavItems, inlineNavItems, sigilThemeKey } from './chunk-UP6GGGAN.js';
|
|
44
|
+
export { TraitMountError } from './chunk-IOPUS6Q5.js';
|
|
45
|
+
import './chunk-P53CKOME.js';
|
|
46
|
+
export { STORE_BOOTSTRAP_ENV_VARS, allCredentialEnvVars } from './chunk-Q7JK4KY7.js';
|
|
47
|
+
export { CREDENTIAL_ENTITY_TYPE, CREDENTIAL_MASTER_KEY_ENV, CREDENTIAL_PREVIOUS_MASTER_KEY_ENV, CredentialStore, DERIVED_ENTITY_TYPE } from './chunk-NAECVIAR.js';
|
|
48
|
+
export { CREDENTIALS_SOURCE_ENV, credentialModeFromEnv, credentialsFromStoreOnly, getEffectiveCredentialStore, getInstalledCredentialStore, getModeControl, installCredentialScopeStorage, installCredentialStore, installModeControl, resolveCredentialRef, runWithCredentialScope, uninstallCredentialStore } from './chunk-HLOUDLPI.js';
|
|
49
|
+
export { seedCredentialStore } from './chunk-SWPDU752.js';
|
|
50
|
+
export { ServerBridge, createServerBridge } from './chunk-D5USD2EX.js';
|
|
51
|
+
export { COMPRESSED_BODY_MIN_BYTES, createHttpTransport, createInProcessTransport, deriveCarriesCircuitState, encodeJsonBody } from './chunk-QELZ6TEJ.js';
|
|
52
|
+
export { createChannelTransport, holdUntilServed, serveChannel } from './chunk-SKLMWHQD.js';
|
|
53
|
+
export { createMemoryCircuitStore } from './chunk-ODJCZ27I.js';
|
|
54
|
+
export { StateBook, createInitialTraitState, findInitialState, findMatchingTransitions, findTransition } from './chunk-Q2H75UYT.js';
|
|
55
|
+
export { AwaitingRegistry } from './chunk-HC6ERSAH.js';
|
|
56
|
+
import './chunk-LZIOTBFX.js';
|
|
57
|
+
export { dispatchDeclaredInput } from './chunk-DYOJGLIX.js';
|
|
58
|
+
export { dispatchInbound } from './chunk-2JU7Y4KU.js';
|
|
59
|
+
import './chunk-MLKGABMK.js';
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/** The keepalive fetch a beacon falls back to: always the same method, mode and `text/plain` header. */
|
|
2
|
+
interface BeaconFetchInit {
|
|
3
|
+
method: 'POST';
|
|
4
|
+
body: string;
|
|
5
|
+
keepalive: true;
|
|
6
|
+
mode: 'cors';
|
|
7
|
+
headers: {
|
|
8
|
+
'Content-Type': 'text/plain';
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
/** What a host offers a beacon: a queue that may accept the text (true) or decline, and a status-only fetch. */
|
|
12
|
+
interface BeaconDeliveryPorts {
|
|
13
|
+
queue?: (url: string, text: string) => boolean;
|
|
14
|
+
fetch: (url: string, init: BeaconFetchInit) => Promise<{
|
|
15
|
+
status: number;
|
|
16
|
+
}>;
|
|
17
|
+
}
|
|
18
|
+
/** How a beacon was taken: the queue accepted it, or one fetch answered `status` (null when the fetch threw). */
|
|
19
|
+
type BeaconDelivery = {
|
|
20
|
+
via: 'queue';
|
|
21
|
+
} | {
|
|
22
|
+
via: 'fetch';
|
|
23
|
+
status: number | null;
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* The queue-first, fetch-fallback decision, once. text/plain keeps the request CORS "simple": no preflight,
|
|
27
|
+
* adblocker-friendly when proxied. A declined, throwing or absent queue falls back; the fetch body is never read.
|
|
28
|
+
*/
|
|
29
|
+
declare function deliverBeacon(url: string, text: string, ports: BeaconDeliveryPorts): Promise<BeaconDelivery>;
|
|
30
|
+
|
|
31
|
+
export { deliverBeacon };
|
|
32
|
+
export type { BeaconDelivery, BeaconDeliveryPorts, BeaconFetchInit };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { HttpBody, HttpRequestWire, HttpResponseWire, OAuthAsk, ServerProgressWire, IoRequestWire, ResolveProgressWire } from '@almadar/core/kernel-wire';
|
|
2
|
+
import { JsonValue } from '@almadar/core';
|
|
3
|
+
|
|
4
|
+
/** Decoders for what the kernel hands back as JSON: narrowed by checks, never cast. */
|
|
5
|
+
|
|
6
|
+
declare function decodeHttpBody(value: JsonValue): HttpBody;
|
|
7
|
+
declare function decodeHttpRequest(value: JsonValue): HttpRequestWire;
|
|
8
|
+
declare function decodeHttpResponse(value: JsonValue): HttpResponseWire;
|
|
9
|
+
declare function decodeRequest(value: JsonValue): IoRequestWire;
|
|
10
|
+
declare function decodeProgress(json: string): ServerProgressWire;
|
|
11
|
+
declare function decodeResolveProgress(json: string): ResolveProgressWire;
|
|
12
|
+
/** The driver's `oauth` ask, decoded against the closed ask set before it reaches the host's store. */
|
|
13
|
+
declare function decodeOAuthAsk(value: JsonValue | undefined): OAuthAsk;
|
|
14
|
+
|
|
15
|
+
export { decodeHttpBody, decodeHttpRequest, decodeHttpResponse, decodeOAuthAsk, decodeProgress, decodeRequest, decodeResolveProgress };
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { OrbitalSchema, MessageCatalogs, MountSeed, RowSetRef, RowQueryPage, OrbitalEventRequest, OrbitalEventResponse, EventStreamItem, UserContext } from '@almadar/core';
|
|
2
|
+
import { KernelHostPorts, KernelAnswerScope } from './host.js';
|
|
3
|
+
import { KernelModule, KernelServerHandle } from './wire.js';
|
|
4
|
+
import '../effects/in-flight-calls.js';
|
|
5
|
+
import '../service/service-provider.js';
|
|
6
|
+
import './program-effects.js';
|
|
7
|
+
import './http.js';
|
|
8
|
+
import './beacon.js';
|
|
9
|
+
import '../credentials/store.js';
|
|
10
|
+
import './decode.js';
|
|
11
|
+
import '@almadar/core/kernel-wire';
|
|
12
|
+
import './os-port.js';
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* The kernel-backed implementation of `evaluateOrbitalEvent` / `OrbitalServerRuntime`: the Rust kernel
|
|
16
|
+
* (`@almadar/kernel`, WebAssembly) decides every execution step; this host answers the I/O it asks for
|
|
17
|
+
* and nothing else. The continuation of a stopped dispatch never leaves the wasm instance.
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
declare class KernelEngine {
|
|
21
|
+
private readonly kernel;
|
|
22
|
+
private readonly schemaJson;
|
|
23
|
+
private readonly ports;
|
|
24
|
+
private readonly entityTypes;
|
|
25
|
+
private readonly preserveProgramContext;
|
|
26
|
+
private handle;
|
|
27
|
+
private readonly lane;
|
|
28
|
+
private tickMount;
|
|
29
|
+
private messages;
|
|
30
|
+
constructor(kernel: KernelModule, schemaJson: string, ports: KernelHostPorts, entityTypes?: readonly string[], forkedFrom?: KernelServerHandle, providedHandle?: KernelServerHandle, preserveProgramContext?: boolean);
|
|
31
|
+
/**
|
|
32
|
+
* A kernel on the same program, registered once, holding none of this one's session: every trait at its initial
|
|
33
|
+
* state, no rows the kernel held, its locales and mounted ticks kept. A stateless host serves each request a
|
|
34
|
+
* fork (EXEC-DIST-5), `ports` answering it.
|
|
35
|
+
*/
|
|
36
|
+
fork(ports?: KernelHostPorts): KernelEngine;
|
|
37
|
+
forkProgram(program: OrbitalSchema, ports?: KernelHostPorts): KernelEngine;
|
|
38
|
+
/** A server over the host's ports. */
|
|
39
|
+
private openServer;
|
|
40
|
+
private declare;
|
|
41
|
+
static open(kernel: KernelModule, schema: OrbitalSchema, ports: KernelHostPorts): KernelEngine;
|
|
42
|
+
/** A fresh kernel on the same program: every trait back at its initial state. */
|
|
43
|
+
reset(): void;
|
|
44
|
+
private managedProgram;
|
|
45
|
+
/** The program whose declared credentials this kernel's credential effects manage beside its own (a console's app). */
|
|
46
|
+
setManagedProgram(program: OrbitalSchema): void;
|
|
47
|
+
/** The program's declared locales and merged catalogs (a lazy page's behavior contributes its namespaced keys). */
|
|
48
|
+
setMessages(locales: readonly string[], catalogs: MessageCatalogs): void;
|
|
49
|
+
/** The traits some client has mounted: a tick that is not `[background]` fires only for these. */
|
|
50
|
+
setTickMount(traits: string[]): void;
|
|
51
|
+
/** What this host mounts when it starts: the kernel's boot mounts for the side it serves (EXEC-ENDPOINT-3). */
|
|
52
|
+
bootMounts(side: 'server' | 'process'): MountSeed[];
|
|
53
|
+
/** What mounts when a client opens `routePath` (EXEC-ENDPOINT-3). */
|
|
54
|
+
routeMounts(routePath: string): MountSeed[];
|
|
55
|
+
/** Mock-seed the `[runtime]` entities the kernel holds itself, owner columns stamped with `viewerId`. */
|
|
56
|
+
seedRuntimeMock(viewerId: string | undefined): void;
|
|
57
|
+
dispose(): void;
|
|
58
|
+
liveItemDelivered(item: object, viewer: object | null, clientId?: string): boolean;
|
|
59
|
+
/** `OsGrants::allows` over the grants of the program this kernel runs. */
|
|
60
|
+
osAllows(requirementJson: string): boolean;
|
|
61
|
+
/** Place the program's anchored grants and arguments under the host's anchors. */
|
|
62
|
+
setOsAnchors(anchorsJson: string): string;
|
|
63
|
+
/** An `os/` call's arguments with its anchored parts resolved under the host's anchors. */
|
|
64
|
+
osResolveArgs(op: string, argsJson: string): string;
|
|
65
|
+
/** The current state of a trait instance, `''` when it has none. */
|
|
66
|
+
stateOf(traitName: string, entityId?: string): string;
|
|
67
|
+
/**
|
|
68
|
+
* `reference` resolved for `scope.user` against the host-answered store (EXEC-RENDER-3): the rows that still
|
|
69
|
+
* match its query and the viewer's `@read` in the reference's order, a missing or hidden row omitted, and `total`
|
|
70
|
+
* re-counted (a `total: none` reference is not re-counted: the total is the resolved window). Each read the
|
|
71
|
+
* kernel makes is answered here, as in `evaluate`.
|
|
72
|
+
*/
|
|
73
|
+
resolveRows(reference: RowSetRef, scope: KernelAnswerScope): Promise<RowQueryPage>;
|
|
74
|
+
/** Run `request` against `orbital`: start it, answer every request the kernel asks for, resume until done. */
|
|
75
|
+
evaluate(orbital: string, request: OrbitalEventRequest, scope: KernelAnswerScope): Promise<OrbitalEventResponse>;
|
|
76
|
+
}
|
|
77
|
+
/** What `evaluateOrbitalEvent` needs to run a request on the kernel instead of the JS composition. */
|
|
78
|
+
interface KernelEvaluation {
|
|
79
|
+
engine: KernelEngine;
|
|
80
|
+
/** The orbital the request is addressed to. */
|
|
81
|
+
orbital: string;
|
|
82
|
+
outsideEventQueue?: <T>(work: () => Promise<T>) => Promise<T>;
|
|
83
|
+
onStream?: (item: EventStreamItem) => void;
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* The request as the kernel takes it: the viewer and locale the host resolved, the `_targetTrait` sidecar
|
|
87
|
+
* promoted to `targetTrait`, and the `_activeTraits` sidecar dropped (the kernel's mounted set is explicit,
|
|
88
|
+
* not carried per request).
|
|
89
|
+
*/
|
|
90
|
+
declare function kernelRequest(request: OrbitalEventRequest, user: UserContext | undefined, locale: string | undefined): OrbitalEventRequest;
|
|
91
|
+
declare function evaluateOnKernel(kernel: KernelEvaluation, request: OrbitalEventRequest, user: UserContext | undefined, locale: string | undefined): Promise<OrbitalEventResponse>;
|
|
92
|
+
|
|
93
|
+
export { KernelEngine, evaluateOnKernel, kernelRequest };
|
|
94
|
+
export type { KernelEvaluation };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export { KernelEngine, evaluateOnKernel, kernelRequest } from '../chunk-D4XJTBLB.js';
|
|
2
|
+
import '../chunk-NATGCIVM.js';
|
|
3
|
+
import '../chunk-HNOAZWFH.js';
|
|
4
|
+
import '../chunk-53IPZXDP.js';
|
|
5
|
+
import '../chunk-YO4LWS3I.js';
|
|
6
|
+
import '../chunk-MZKIL5IN.js';
|
|
7
|
+
import '../chunk-FWA5K7Q2.js';
|
|
8
|
+
import '../chunk-VMOBW7RK.js';
|
|
9
|
+
import '../chunk-RBUMDYFS.js';
|
|
10
|
+
import '../chunk-HLOUDLPI.js';
|
|
11
|
+
import '../chunk-MLKGABMK.js';
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { FiredTick, FrameWire, RoutedLeg } from '@almadar/core/kernel-wire';
|
|
2
|
+
import { OrbitalEventResponse, JsonValue } from '@almadar/core';
|
|
3
|
+
import { ClientKernelOutcome, LocalFoldKernel } from '../client/client-kernel.js';
|
|
4
|
+
import '../client/circuit-store.js';
|
|
5
|
+
import '../client/awaiting.js';
|
|
6
|
+
import '../client/state-book.js';
|
|
7
|
+
import '../client/trait-types.js';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Applies one host frame of the tick clock (`Kernel.frame`'s `FrameWire`) to the view. The in-process
|
|
11
|
+
* kernel already ran the frame, so it folds locally (`LocalFoldKernel`), never through the server fold:
|
|
12
|
+
* the aggregate response first (embed.rs: "the host folds `response` before the dispatches"; it is built
|
|
13
|
+
* from the fired ticks' own outcomes, not from the dispatches, so the two are disjoint), then each tick
|
|
14
|
+
* dispatch. Every post a dispatch owes (its server legs or stateful leg) and every browser-store leg goes
|
|
15
|
+
* through the injected `FramePostPort`; the answers settle off the frame (`tickSettled`) so a tick round trip
|
|
16
|
+
* never delays the next frame.
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
declare function isFrameWire(value: JsonValue): value is JsonValue & FrameWire;
|
|
20
|
+
/** `frame()`'s JSON; `undefined` (no tick due) decodes to `undefined`. */
|
|
21
|
+
declare function decodeFrame(json: string | undefined): FrameWire | undefined;
|
|
22
|
+
type TickEffects = Pick<OrbitalEventResponse, 'clientEffects' | 'clientEffectsByTrait'>;
|
|
23
|
+
type FrameDispatch = FrameWire['dispatches'][number];
|
|
24
|
+
/** The host transport's side of a frame: posts what a fired tick owes and folds the answer back through the kernel. */
|
|
25
|
+
interface FramePostPort {
|
|
26
|
+
/** Posts one dispatch's server legs (or stateful leg); resolves to what the server's fold added. */
|
|
27
|
+
postDispatch(dispatch: FrameDispatch): Promise<TickEffects>;
|
|
28
|
+
/** Sends a leg the kernel routed to the browser store; `frameResponse` is the frame's aggregate response. */
|
|
29
|
+
sendBrowserLeg(leg: RoutedLeg, frameResponse: OrbitalEventResponse): Promise<TickEffects>;
|
|
30
|
+
}
|
|
31
|
+
interface FrameApplied {
|
|
32
|
+
fired: FiredTick[];
|
|
33
|
+
folded: number;
|
|
34
|
+
browserLegs: number;
|
|
35
|
+
droppedServerEffects: number;
|
|
36
|
+
/** The head is the frame's aggregate response, then one outcome per browser leg, then one per dispatch. */
|
|
37
|
+
outcomes: ClientKernelOutcome[];
|
|
38
|
+
errors: string[];
|
|
39
|
+
}
|
|
40
|
+
declare function applyFrame(json: string | undefined, kernel: LocalFoldKernel, post: FramePostPort | undefined): Promise<FrameApplied>;
|
|
41
|
+
|
|
42
|
+
export { applyFrame, decodeFrame, isFrameWire };
|
|
43
|
+
export type { FrameApplied, FrameDispatch, FramePostPort, TickEffects };
|