@almadar/shell-node 0.1.0 → 1.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/index.d.ts CHANGED
@@ -1,19 +1,44 @@
1
- import { PinnedFetch, CredentialScopeStorage, NetPort, ResolvedHost, OsAnchors, OsGrantPort, OsHostPort, KernelModule, HttpKernel, CredentialSeedKernel, NativeMemoryPersistenceAdapter, ServiceCallContext, StepRequest, PlayedStep, ProgramValidationReport, ProgramEffectName, ProgramEffectOutcome } from '@almadar/shell-runtime';
2
- import { JsonValue, KernelMemoryStoreExports, OrbitalSchema, EvaluatedProgram, ProgramValidationIssue, CatalogScope, CatalogEntry, DependencyGraph, TraitValue, TraitDescription, DescribeTarget, BehaviorDescription, BehaviorRef, BehaviorValueMountResult, TraitValueMountResult } from '@almadar/core';
3
- export { ClientEffectTuple, ClientNavigateBackTuple, ClientNavigateTuple, ClientRenderUITuple, OrbitalEventRequest, OrbitalEventResponse, TransitionRejection } from '@almadar/core';
4
- import * as installedModule from '@almadar/kernel';
1
+ import { CredentialVaultModule, CredentialVault, CredentialRowsPort, OsAnchors, OsGrantPort, OsHostPort, TokenEndpointPost, KernelModule, NativeMemoryPersistenceAdapter, ServiceCallContext, StepRequest, PlayedStep, ProgramValidationReport, ProgramEffectName, ProgramEffectOutcome } from '@almadar/shell-runtime';
2
+ import { JsonValue, KernelMemoryStoreExports, OrbitalSchema, EvaluatedProgram, ProgramValidationIssue, CatalogScope, CatalogEntry, DependencyGraph, TraitValue, TraitDescription, DescribeTarget, BehaviorDescription } from '@almadar/core';
3
+ export { ClientEffectTuple, ClientNavigateBackTuple, ClientNavigateTuple, ClientRenderUITuple, EventRequest, EventResponse, TransitionRejection } from '@almadar/core';
4
+ import { RequestOptions } from 'node:https';
5
+ import { IncomingMessage, ClientRequest } from 'node:http';
6
+ import { OsGrantsReport, ProveReport, StepRefusal } from '@almadar/core/kernel-wire';
5
7
  import { LayoutStrategy } from '@almadar/core/builders';
6
- export { G as GCS_ENDPOINT, K as KernelProgram, a as KernelProgramOptions, b as KernelWorkspaceBucket, c as KernelWorkspaceHostOptions, P as ProgramRun, W as WORKSPACE_HMAC_KEY_ID, d as WORKSPACE_HMAC_SECRET, e as WorkspaceHost, f as WorkspacePort, g as emitPayload, i as installWorkspaceHost, h as installedWorkspaceHost, k as kernelWorkspaceHost, r as resolveKernelDir, j as resolveProgramFile, u as uninstallWorkspaceHost, w as workspaceBucketFromEnv, l as workspaceOwnerSegment, m as workspacesRoot } from './kernel-workspace-host-CU56iOlt.js';
7
- export { HostDispatchItem, LiveBroadcastItem, LoaderConfig, OrbitalInfo, OrbitalServerRuntime, OrbitalServerRuntimeConfig, OrbitalSummary, PushItem, RegisterOptions, RegisteredOrbital, RuntimeOrbital, RuntimeOrbitalSchema, RuntimeTrait, RuntimeTraitTick, UnresolvedProgramError, createOrbitalServerRuntime } from './OrbitalServerRuntime.js';
8
+ export { K as KernelProgram, a as KernelProgramOptions, b as KernelWorkspaceBucket, c as KernelWorkspaceHostOptions, P as ProgramRun, W as WorkspaceHost, d as WorkspacePort, e as emitPayload, i as installWorkspaceHost, f as installedWorkspaceHost, k as kernelWorkspaceHost, r as resolveProgramFile, u as uninstallWorkspaceHost, w as workspaceBucketFromEnv, g as workspaceOwnerSegment, h as workspacesRoot } from './kernel-workspace-host-cT9JGJur.js';
9
+ export { HostDispatchItem, LiveBroadcastItem, LoaderConfig, OrbitalServerRuntime, OrbitalServerRuntimeConfig, PushItem, RegisterOptions, RegisteredOrbital, RuntimeOrbital, RuntimeOrbitalSchema, UnresolvedProgramError } from './OrbitalServerRuntime.js';
8
10
  export { ProgramHandlers, ProgramHostConfig, createProgramHandlers } from './createProgramHandlers.js';
9
11
 
10
- declare const pinnedFetchNode: PinnedFetch;
11
-
12
- declare function resolveHostNode(host: string): Promise<ResolvedHost>;
13
- declare const nodeNetPort: NetPort;
14
- declare function nodeCredentialScope(): CredentialScopeStorage;
15
- /** Install the Node ports `@almadar/shell-runtime` leaves open: the pinned `http` fetch + resolver and per-tenant credential scopes. Idempotent. */
12
+ /** Install the Node ports `@almadar/shell-runtime` leaves open: per-tenant credential scopes. Idempotent. */
16
13
  declare function installNodeHostPorts(): void;
14
+ interface NodeCredentialVaultOptions {
15
+ /** The kernel module that carries the vault class (`@almadar/kernel`, initialised). */
16
+ kernel: CredentialVaultModule;
17
+ /** Defaults to the process env, which the native host reads the same keys and file from. */
18
+ env?: Record<string, string | undefined>;
19
+ /** Defaults to the working directory, where the native host looks for `.almadar/dev-credentials.json`. */
20
+ cwd?: string;
21
+ }
22
+ /**
23
+ * The durable credential vault of a Node host, as the native host opens it: the key in `ALMADAR_CREDENTIAL_MASTER_KEY`
24
+ * (and `..._PREVIOUS` in a rotation window), the rows in the encrypted file `ALMADAR_CREDENTIALS_FILE` names, else
25
+ * `.almadar/dev-credentials.json`, so one file serves both hosts. With no master key set the host has no store and this
26
+ * answers `null`; a key that is not 64 hex digits, or a row the kernel cannot read, rejects. The vault is installed as the
27
+ * process-wide credential store.
28
+ */
29
+ declare function installNodeCredentialVault(options: NodeCredentialVaultOptions): Promise<CredentialVault | null>;
30
+
31
+ declare const DEFAULT_CREDENTIALS_FILE = ".almadar/dev-credentials.json";
32
+ /** `ALMADAR_CREDENTIALS_FILE`, else `.almadar/dev-credentials.json` under the working directory, as the native host resolves it. */
33
+ declare function credentialsFilePath(env?: Record<string, string | undefined>, cwd?: string): string;
34
+ /**
35
+ * The kernel's credential rows kept in a JSON file, the layout the native host writes: an array of rows each carrying an
36
+ * `id`, written whole through a temporary file and a rename. A missing file is no rows; a file that cannot be read, is not
37
+ * JSON, is not an array of rows or holds a row without an id is a failure. Operations here run one after another, so the
38
+ * conditional delete is atomic against every other port over the same file in this process; a second process is not
39
+ * covered, as with the native host.
40
+ */
41
+ declare function fileCredentialRows(path: string): CredentialRowsPort;
17
42
 
18
43
  /**
19
44
  * A development host's credential-store master key: read from `<dir>/dev-credential-master-key`,
@@ -68,7 +93,6 @@ interface KvBackend {
68
93
  /** Replace the namespace content atomically: a failure leaves the previous content. */
69
94
  commit(ns: KvNamespace, table: KvTable): Promise<void>;
70
95
  }
71
- declare function namespaceId(ns: KvNamespace): string;
72
96
  declare function memoryKvBackend(): KvBackend;
73
97
  declare function directoryKvBackend(stateDir: string): KvBackend;
74
98
  interface KvHost {
@@ -91,8 +115,25 @@ interface KvHost {
91
115
  }
92
116
  declare function createKvHost(backend: KvBackend): KvHost;
93
117
 
118
+ interface ResolvedAddress {
119
+ address: string;
120
+ family: number;
121
+ }
122
+ interface NodeTokenPostOptions {
123
+ /** The kernel's egress rule over the program's declared origins. */
124
+ egressAllows(url: string): boolean;
125
+ /** The kernel's public-address rule. */
126
+ isPublicAddress(ip: string): boolean;
127
+ request?: (options: RequestOptions, onResponse: (response: IncomingMessage) => void) => ClientRequest;
128
+ resolve?: (host: string) => Promise<ResolvedAddress[]>;
129
+ }
130
+ declare class TokenPostRefusal extends Error {
131
+ constructor(message: string);
132
+ }
133
+ declare function createNodeTokenPost(options: NodeTokenPostOptions): TokenEndpointPost;
134
+
94
135
  /** The whole server kernel as Node loads it: the shared module plus the server-only exports the client build omits. */
95
- interface LoadedKernel extends KernelModule, HttpKernel, CredentialSeedKernel, KernelMemoryStoreExports {
136
+ interface LoadedKernel extends KernelModule, KernelMemoryStoreExports {
96
137
  initSync(input: {
97
138
  module: Uint8Array;
98
139
  }): object;
@@ -103,26 +144,17 @@ interface LoadKernelOptions {
103
144
  /** Where the installed `@almadar/core` and `@almadar/std` are found, node-style. Required: the caller names its own root. */
104
145
  languageFrom: string;
105
146
  }
106
- /**
107
- * Loads the kernel and installs the language data the installed packages declare (the operator table that
108
- * routes `program/*` and the other host effects), as `orb` reads it. The first install in a process wins.
109
- */
110
- declare function loadKernelModule(kernelDir: string, options: LoadKernelOptions): Promise<LoadedKernel>;
111
- /**
112
- * The kernel of the `@almadar/kernel` package this host installs, initialised synchronously with the language data
113
- * the packages under `languageFrom` declare. `languageFrom` is required; the first call in a process wins.
114
- */
115
- declare function initKernelSync(languageFrom: string): typeof installedModule;
116
147
  /**
117
148
  * The kernel of the `@almadar/kernel` package this host installs, loaded once per process with the language data
118
149
  * the packages under `languageFrom` declare. A host with no package installed rejects, never falls back.
119
150
  */
120
151
  declare function loadInstalledKernel(languageFrom: string): Promise<LoadedKernel>;
121
152
  /**
122
- * The `http` effect's builder exports of the same package (`buildHttpRequest`, `isPublicAddress`, …): the
123
- * interpreter's only way to build a request. A directory that does not hold a built kernel rejects, never falls back.
153
+ * Loads the kernel from `kernelDir` (the one with `pkg/`) and installs the language data the installed packages declare
154
+ * (the operator table that routes `program/*` and the other host effects), as `orb` reads it. The first install in a
155
+ * process wins.
124
156
  */
125
- declare function loadHttpKernel(kernelDir: string, options: LoadKernelOptions): Promise<HttpKernel>;
157
+ declare function loadKernelModule(kernelDir: string, options: LoadKernelOptions): Promise<LoadedKernel>;
126
158
  /**
127
159
  * Where the native kernel add-on is: `ALMADAR_KERNEL_NODE`, else `kernel.node` in the `@almadar/orb-<platform>-<arch>`
128
160
  * package this platform installs. Rejects when neither exists, so a host can fall back to the wasm kernel by choice.
@@ -151,26 +183,25 @@ interface ProgramHostOptions {
151
183
  /** Explicit `orb` binary; defaults to {@link resolveOrbBinary}. */
152
184
  readonly orbBin?: string;
153
185
  }
154
- /** `behavior/catalog`: installed behaviors under registry folders; `vectors: false` omits the vectors (`--no-vectors`). */
186
+ /** `behavior/catalog`: installed behaviors under registry folders; `traits: false` omits each entry's traits (`--no-traits`). */
155
187
  declare function behaviorCatalog(scope: CatalogScope, opts: ProgramHostOptions, options?: {
156
- readonly vectors?: boolean;
188
+ readonly traits?: boolean;
157
189
  }): Promise<CatalogEntry[]>;
158
190
  /** {@link behaviorCatalog} for a caller that cannot await. */
159
191
  declare function behaviorCatalogSync(scope: CatalogScope, opts: ProgramHostOptions): CatalogEntry[];
160
- /** `behavior/describe`: a trait value's knobs and events; an orbital value's or a whole behavior's orbitals.
161
- * `knobVectors: true` attaches a trait's knob vectors (`--knob-vectors`). */
162
- declare function behaviorDescribe(value: TraitValue, opts: ProgramHostOptions, options?: {
163
- readonly knobVectors?: boolean;
164
- }): Promise<TraitDescription>;
165
- declare function behaviorDescribe(value: DescribeTarget, opts: ProgramHostOptions, options?: {
166
- readonly knobVectors?: boolean;
167
- }): Promise<TraitDescription | BehaviorDescription>;
192
+ /** `behavior/describe`: a trait value's knobs and events; an orbital value's or a whole behavior's orbitals. */
193
+ declare function behaviorDescribe(value: TraitValue, opts: ProgramHostOptions): Promise<TraitDescription>;
194
+ declare function behaviorDescribe(value: DescribeTarget, opts: ProgramHostOptions): Promise<TraitDescription | BehaviorDescription>;
168
195
  /** `behavior/source`: the behavior a value belongs to, as a program (`.orb` IR). */
169
196
  declare function behaviorSource(value: Pick<TraitValue, 'behavior'>, opts: ProgramHostOptions): Promise<OrbitalSchema>;
170
197
  /** `program/read`: `.lolo` text → a program (`.orb` IR). */
171
198
  declare function programRead(text: string, opts: ProgramHostOptions): Promise<OrbitalSchema>;
172
199
  /** `program/print`: a program (`.orb` IR) → `.lolo` text. */
173
200
  declare function programPrint(program: OrbitalSchema, opts: ProgramHostOptions): Promise<string>;
201
+ /** What `program/os-grants` returns: the static `os/` grant check's typed findings. */
202
+ type ProgramOsGrantsReport = OsGrantsReport;
203
+ /** What `program/prove` returns: every spec proposition the program cannot be shown to keep. */
204
+ type ProgramProveReport = ProveReport;
174
205
  /** Who runs a program effect: the signed-in caller, as `call-service` receives it. */
175
206
  type ProgramCallContext = Pick<ServiceCallContext, 'principal' | 'role'>;
176
207
  /**
@@ -204,6 +235,28 @@ type ProgramEvalResult = {
204
235
  * to the workspace or the project.
205
236
  */
206
237
  declare function programValidate(program: OrbitalSchema, opts: Pick<ProgramEvalOptions, 'cwd' | 'prior' | 'final'> & ProgramHostOptions): Promise<ProgramValidationReport>;
238
+ /**
239
+ * `program/prove`: the kernel prover's findings on a program, asked of `orb prove` (the prover is the kernel's, so the
240
+ * node host carries no copy of it). A program value is written to a temp file and resolved like any file; `path` names
241
+ * the file directly.
242
+ */
243
+ declare function programProve(target: {
244
+ readonly program: OrbitalSchema;
245
+ } | {
246
+ readonly path: string;
247
+ }, opts: ProgramHostOptions): Promise<ProgramProveReport>;
248
+ /**
249
+ * `program/os-grants`: the kernel's static `os/` grant findings on a program, asked of `orb os-grants` (the check is the
250
+ * kernel's, so the node host carries no copy of it). `final` checks the finished program, where a config-fed target is a
251
+ * literal. A program value is written to a temp file and resolved like any file; `path` names the file directly.
252
+ */
253
+ declare function programOsGrants(target: {
254
+ readonly program: OrbitalSchema;
255
+ } | {
256
+ readonly path: string;
257
+ }, opts: ProgramHostOptions & {
258
+ readonly final?: boolean;
259
+ }): Promise<ProgramOsGrantsReport>;
207
260
  /**
208
261
  * `program/eval`: validate through {@link stampAndValidate}, and on success write the program to `orbitals/<name>.orb` in its workspace (or `cwd`)
209
262
  * and return its traits as values. Failures come back as data.
@@ -218,27 +271,12 @@ interface ProgramComposeOptions {
218
271
  }
219
272
  /**
220
273
  * `program/compose`: assemble programs, in the order given, into one app
221
- * program — core `composeAppFromFiles` (pages, layout, wiring, the app nav).
222
- * The composer's registry lookups (an import's source orbital, an atom's trait,
223
- * an organism's orbital order) are served from `orb behaviors source` for every
224
- * behavior the programs import, loaded once up front.
274
+ * program. The composer is `orb compose` (the Rust composer, `program/compose`
275
+ * of the kernel's program host): the programs are written to a scratch folder
276
+ * and handed to it, and its JSON is the answer. Pages, layout, wiring, the app
277
+ * nav and every registry read are `orb`'s.
225
278
  */
226
279
  declare function programCompose(programs: readonly OrbitalSchema[], options: ProgramComposeOptions, opts: ProgramHostOptions): Promise<OrbitalSchema>;
227
- /**
228
- * Turn a trait value into a program a host can run: a one-orbital wrapper that
229
- * imports the value's owning orbital with `only { T }` and the value's overrides
230
- * as `traits { T { … } }` (LOLO §8b), validated at the 0/0 bar (the binding's
231
- * admission check) and resolved by `orb`. A project-relative behavior
232
- * (`./orbitals/X`) is imported relatively from a wrapper written at `cwd`, since
233
- * `orb`'s loader refuses an absolute import.
234
- */
235
- declare function mountTraitValue(value: TraitValue, opts: ProgramHostOptions, context?: ProgramCallContext): Promise<TraitValueMountResult>;
236
- /**
237
- * Make a behavior value runnable: the program as written is validated at the
238
- * 0/0 bar (the embed's admission check) and resolved by `orb`; the frame opens
239
- * it on its default page (the one marked `initial`, else the first).
240
- */
241
- declare function mountBehaviorValue(value: BehaviorRef, opts: ProgramHostOptions, context?: ProgramCallContext): Promise<BehaviorValueMountResult>;
242
280
  /** A program file resolved by `orb` (every import flattened, every composed trait inlined): what a host registers. */
243
281
  declare function programResolve(path: string, opts: ProgramHostOptions): Promise<OrbitalSchema>;
244
282
  /** An unresolved program resolved by `orb` from the project root `opts.cwd`, so its relative imports resolve there. */
@@ -249,9 +287,7 @@ declare function behaviorResolve(value: Pick<TraitValue, 'behavior'>, opts: Prog
249
287
  }>;
250
288
  /** `behavior/dependencies`: a program's dependency graph — each orbital's imports, then every installed behavior they reach, with its layer and its own imports. */
251
289
  declare function behaviorDependencies(program: OrbitalSchema, opts: ProgramHostOptions): Promise<DependencyGraph>;
252
- declare function programStep(program: OrbitalSchema, requests: readonly StepRequest[], opts: ProgramHostOptions, live?: boolean): Promise<PlayedStep[] | {
253
- error: string;
254
- }>;
290
+ declare function programStep(program: OrbitalSchema, requests: readonly StepRequest[], opts: ProgramHostOptions, live?: boolean): Promise<PlayedStep[] | StepRefusal>;
255
291
  type EffectArg = JsonValue;
256
292
  /**
257
293
  * Parse one program effect's positional arguments (the trailing emit config
@@ -261,5 +297,5 @@ type EffectArg = JsonValue;
261
297
  */
262
298
  declare function runProgramEffect(op: ProgramEffectName, args: readonly EffectArg[], opts: ProgramHostOptions, context?: ProgramCallContext): Promise<ProgramEffectOutcome>;
263
299
 
264
- export { KvFailure, behaviorCatalog, behaviorCatalogSync, behaviorDependencies, behaviorDescribe, behaviorResolve, behaviorSource, createKvHost, createNodeOsHost, directoryKvBackend, initKernelSync, installNodeHostPorts, loadHttpKernel, loadInstalledKernel, loadKernelModule, loadNativeKernelModule, loadOrCreateDevMasterKey, memoryKvBackend, mountBehaviorValue, mountTraitValue, namespaceId, nativeMemoryOf, nodeCredentialScope, nodeNetPort, pinnedFetchNode, processAnchors, programCompose, programEval, programPrint, programRead, programResolve, programResolveSchema, programStep, programValidate, resolveHostNode, resolveNativeAddon, runProgramEffect, workspaceAccessError };
265
- export type { KvBackend, KvBatchOp, KvErrorKind, KvHost, KvNamespace, KvResult, KvScanEntry, KvTable, LoadKernelOptions, LoadedKernel, NodeOsHostOptions, ProgramCallContext, ProgramComposeOptions, ProgramEvalOptions, ProgramEvalResult, ProgramHostOptions };
300
+ export { DEFAULT_CREDENTIALS_FILE, KvFailure, TokenPostRefusal, behaviorCatalog, behaviorCatalogSync, behaviorDependencies, behaviorDescribe, behaviorResolve, behaviorSource, createKvHost, createNodeOsHost, createNodeTokenPost, credentialsFilePath, directoryKvBackend, fileCredentialRows, installNodeCredentialVault, installNodeHostPorts, loadInstalledKernel, loadKernelModule, loadNativeKernelModule, loadOrCreateDevMasterKey, memoryKvBackend, nativeMemoryOf, processAnchors, programCompose, programEval, programOsGrants, programPrint, programProve, programRead, programResolve, programResolveSchema, programStep, programValidate, resolveNativeAddon, runProgramEffect, workspaceAccessError };
301
+ export type { KvBackend, KvBatchOp, KvErrorKind, KvHost, KvNamespace, KvResult, LoadKernelOptions, LoadedKernel, NodeCredentialVaultOptions, NodeOsHostOptions, NodeTokenPostOptions, ProgramCallContext, ProgramComposeOptions, ProgramEvalOptions, ProgramEvalResult, ProgramHostOptions, ProgramOsGrantsReport, ProgramProveReport, ResolvedAddress };
package/dist/index.js CHANGED
@@ -1,9 +1,9 @@
1
- export { OrbitalServerRuntime, UnresolvedProgramError, createOrbitalServerRuntime } from './chunk-A2TIXOLJ.js';
2
- export { createProgramHandlers } from './chunk-WZFQ7T7V.js';
3
- export { GCS_ENDPOINT, KernelProgram, WORKSPACE_HMAC_KEY_ID, WORKSPACE_HMAC_SECRET, createNodeOsHost, emitPayload, kernelWorkspaceHost, processAnchors, resolveKernelDir, resolveProgramFile, workspaceBucketFromEnv, workspacesRoot } from './chunk-BJA6GYC5.js';
4
- export { installNodeHostPorts, nodeCredentialScope, nodeNetPort, pinnedFetchNode, resolveHostNode } from './chunk-23YAOI6P.js';
5
- export { initKernelSync, loadHttpKernel, loadInstalledKernel, loadKernelModule, loadNativeKernelModule, nativeMemoryOf, resolveNativeAddon } from './chunk-UBZT5LDW.js';
6
- export { behaviorCatalog, behaviorCatalogSync, behaviorDependencies, behaviorDescribe, behaviorResolve, behaviorSource, mountBehaviorValue, mountTraitValue, programCompose, programEval, programPrint, programRead, programResolve, programResolveSchema, programStep, programValidate, runProgramEffect, workspaceAccessError } from './chunk-QYAPNUBH.js';
1
+ export { OrbitalServerRuntime, UnresolvedProgramError } from './chunk-34JOE763.js';
2
+ export { createProgramHandlers } from './chunk-LNEOE5TD.js';
3
+ export { KernelProgram, createNodeOsHost, emitPayload, kernelWorkspaceHost, processAnchors, resolveProgramFile, workspaceBucketFromEnv, workspacesRoot } from './chunk-HXA6OB35.js';
4
+ export { DEFAULT_CREDENTIALS_FILE, TokenPostRefusal, createNodeTokenPost, credentialsFilePath, fileCredentialRows, installNodeCredentialVault, installNodeHostPorts } from './chunk-VQVAHUAX.js';
5
+ export { loadInstalledKernel, loadKernelModule, loadNativeKernelModule, nativeMemoryOf, resolveNativeAddon } from './chunk-EEYGL7AB.js';
6
+ export { behaviorCatalog, behaviorCatalogSync, behaviorDependencies, behaviorDescribe, behaviorResolve, behaviorSource, programCompose, programEval, programOsGrants, programPrint, programProve, programRead, programResolve, programResolveSchema, programStep, programValidate, runProgramEffect, workspaceAccessError } from './chunk-7QE32QQR.js';
7
7
  export { installWorkspaceHost, installedWorkspaceHost, uninstallWorkspaceHost, workspaceOwnerSegment } from './chunk-BWMLDDCL.js';
8
8
  import { randomBytes } from 'crypto';
9
9
  import { existsSync, readFileSync, mkdirSync, writeFileSync } from 'fs';
@@ -214,4 +214,4 @@ function createKvHost(backend) {
214
214
  };
215
215
  }
216
216
 
217
- export { KvFailure, createKvHost, directoryKvBackend, loadOrCreateDevMasterKey, memoryKvBackend, namespaceId };
217
+ export { KvFailure, createKvHost, directoryKvBackend, loadOrCreateDevMasterKey, memoryKvBackend };
@@ -0,0 +1 @@
1
+ export { loadInstalledKernel, loadKernelModule, loadNativeKernelModule, nativeMemoryOf, resolveNativeAddon } from './chunk-EEYGL7AB.js';
@@ -1,4 +1,4 @@
1
- import { ServiceCallContext, HttpPortsOptions } from '@almadar/shell-runtime';
1
+ import { ServiceCallContext, SecretPortsOptions } from '@almadar/shell-runtime';
2
2
  import { OrbitalSchema, EntityRow, EventPayload, UserContext, EmittedEvent, TransitionRejection, InboundDelivery, InboundAnswer } from '@almadar/core';
3
3
 
4
4
  /**
@@ -52,8 +52,8 @@ interface KernelProgramOptions {
52
52
  kernelDir?: string;
53
53
  /** Where the installed `@almadar/core` and `@almadar/std` are found, node-style. */
54
54
  languageFrom: string;
55
- /** Transport overrides of the `http` effect: pinned fetch, address resolver, secret store. */
56
- http?: Pick<HttpPortsOptions, 'fetch' | 'resolve' | 'secrets' | 'random'>;
55
+ /** Overrides of the secret store and the CSPRNG. */
56
+ secretPorts?: Pick<SecretPortsOptions, 'secrets' | 'random'>;
57
57
  /** Rows the program's in-memory store starts with, by entity name (a catalog the host already holds). */
58
58
  seed?: Record<string, EntityRow[]>;
59
59
  /** Answer the program's `os` effects with the Node host (its grants are the program's own); absent, every `os` ask is denied. */
@@ -67,8 +67,6 @@ interface ProgramRun {
67
67
  rejections: TransitionRejection[];
68
68
  error?: string;
69
69
  }
70
- /** `ALMADAR_KERNEL_DIR`, else the `@almadar/kernel` package that `from` (default: the working directory) resolves. */
71
- declare function resolveKernelDir(from?: string): string;
72
70
  /** The payload of the first emit named `event`, read through `read`; `undefined` when the run emitted none. */
73
71
  declare function emitPayload<T>(run: ProgramRun, event: string, read: (payload: EventPayload) => T): T | undefined;
74
72
  /**
@@ -80,11 +78,11 @@ declare class KernelProgram {
80
78
  private readonly engine;
81
79
  private readonly os;
82
80
  private readonly schema;
83
- private readonly http;
81
+ private readonly secretPorts;
84
82
  private readonly persistence;
85
83
  private constructor();
86
84
  static open(schema: OrbitalSchema, options: KernelProgramOptions): Promise<KernelProgram>;
87
- /** Fire `event` at the orbital as `user` (the program's `@user`), wait for its whole cascade (every `http` ask included), and return what it emitted. */
85
+ /** Fire `event` at the orbital as `user` (the program's `@user`), wait for its whole cascade (every secret ask included), and return what it emitted. */
88
86
  dispatch(orbital: string, event: string, payload?: EventPayload, targetTrait?: string, user?: UserContext): Promise<ProgramRun>;
89
87
  /** Fire `trait`'s tick `name` once, as a host timer would; the kernel evaluates the tick's guard and effects. */
90
88
  tick(orbital: string, trait: string, name: string): Promise<ProgramRun>;
@@ -108,9 +106,6 @@ interface KernelWorkspaceBucket {
108
106
  /** The name of the credential (an environment variable) holding the HMAC secret. */
109
107
  secretAccessKey: string;
110
108
  }
111
- declare const GCS_ENDPOINT = "https://storage.googleapis.com";
112
- declare const WORKSPACE_HMAC_KEY_ID = "ALMADAR_WORKSPACE_HMAC_KEY_ID";
113
- declare const WORKSPACE_HMAC_SECRET = "ALMADAR_WORKSPACE_HMAC_SECRET";
114
109
  /** The bucket a host's environment names: `ALMADAR_WORKSPACE_BUCKET` on Google Cloud Storage, keyed by the two HMAC credentials; absent, the project's disk. */
115
110
  declare function workspaceBucketFromEnv(env: Record<string, string | undefined>): KernelWorkspaceBucket | undefined;
116
111
  interface KernelWorkspaceHostOptions {
@@ -131,5 +126,5 @@ declare function workspacesRoot(projectRoot: string): string;
131
126
  */
132
127
  declare function kernelWorkspaceHost(options: KernelWorkspaceHostOptions): WorkspaceHost;
133
128
 
134
- export { GCS_ENDPOINT as G, KernelProgram as K, WORKSPACE_HMAC_KEY_ID as W, WORKSPACE_HMAC_SECRET as d, emitPayload as g, installedWorkspaceHost as h, installWorkspaceHost as i, resolveProgramFile as j, kernelWorkspaceHost as k, workspaceOwnerSegment as l, workspacesRoot as m, resolveKernelDir as r, uninstallWorkspaceHost as u, workspaceBucketFromEnv as w };
135
- export type { ProgramRun as P, KernelProgramOptions as a, KernelWorkspaceBucket as b, KernelWorkspaceHostOptions as c, WorkspaceHost as e, WorkspacePort as f };
129
+ export { KernelProgram as K, emitPayload as e, installedWorkspaceHost as f, workspaceOwnerSegment as g, workspacesRoot as h, installWorkspaceHost as i, kernelWorkspaceHost as k, resolveProgramFile as r, uninstallWorkspaceHost as u, workspaceBucketFromEnv as w };
130
+ export type { ProgramRun as P, WorkspaceHost as W, KernelProgramOptions as a, KernelWorkspaceBucket as b, KernelWorkspaceHostOptions as c, WorkspacePort as d };
@@ -1,3 +1,3 @@
1
- export { G as GCS_ENDPOINT, b as KernelWorkspaceBucket, c as KernelWorkspaceHostOptions, W as WORKSPACE_HMAC_KEY_ID, d as WORKSPACE_HMAC_SECRET, k as kernelWorkspaceHost, w as workspaceBucketFromEnv, m as workspacesRoot } from './kernel-workspace-host-CU56iOlt.js';
1
+ export { b as KernelWorkspaceBucket, c as KernelWorkspaceHostOptions, k as kernelWorkspaceHost, w as workspaceBucketFromEnv, h as workspacesRoot } from './kernel-workspace-host-cT9JGJur.js';
2
2
  import '@almadar/shell-runtime';
3
3
  import '@almadar/core';
@@ -1,4 +1,4 @@
1
- export { GCS_ENDPOINT, WORKSPACE_HMAC_KEY_ID, WORKSPACE_HMAC_SECRET, kernelWorkspaceHost, workspaceBucketFromEnv, workspacesRoot } from './chunk-BJA6GYC5.js';
2
- import './chunk-23YAOI6P.js';
3
- import './chunk-UBZT5LDW.js';
1
+ export { kernelWorkspaceHost, workspaceBucketFromEnv, workspacesRoot } from './chunk-HXA6OB35.js';
2
+ import './chunk-VQVAHUAX.js';
3
+ import './chunk-EEYGL7AB.js';
4
4
  import './chunk-BWMLDDCL.js';
@@ -0,0 +1,2 @@
1
+ export { behaviorCatalog, behaviorCatalogSync, behaviorDependencies, behaviorDescribe, behaviorResolve, behaviorSource, programCompose, programEval, programOsGrants, programPrint, programProve, programRead, programResolve, programResolveSchema, programStep, programValidate, runProgramEffect, workspaceAccessError } from './chunk-7QE32QQR.js';
2
+ export { installWorkspaceHost, installedWorkspaceHost, uninstallWorkspaceHost, workspaceOwnerSegment } from './chunk-BWMLDDCL.js';
package/package.json CHANGED
@@ -1,6 +1,9 @@
1
1
  {
2
2
  "name": "@almadar/shell-node",
3
- "version": "0.1.0",
3
+ "version": "1.1.0",
4
+ "orbRelease": {
5
+ "severity": "normal"
6
+ },
4
7
  "description": "Almadar TS shell node runtime pack: the Node os/* and program/* host of the kernel (os families, KernelProgram, workspace, program host).",
5
8
  "license": "BUSL-1.1",
6
9
  "type": "module",
@@ -34,13 +37,12 @@
34
37
  "access": "public"
35
38
  },
36
39
  "dependencies": {
37
- "@almadar/core": "^10.129.0",
38
- "@almadar/kernel": "^18.0.0",
39
- "@almadar/logger": "^1.18.0",
40
- "undici": "^6.29.1",
40
+ "@almadar/core": "^11.3.0",
41
+ "@almadar/kernel": "^19.0.1",
42
+ "@almadar/logger": "^2.3.0",
41
43
  "zod": "^4.6.7",
42
- "@almadar/std": "^16.255.0",
43
- "@almadar/shell-runtime": "^0.1.0"
44
+ "@almadar/std": "^17.1.0",
45
+ "@almadar/shell-runtime": "^1.1.0"
44
46
  },
45
47
  "devDependencies": {
46
48
  "@types/node": "^20.0.0",
@@ -1,42 +0,0 @@
1
- import { Agent, fetch } from 'undici';
2
- import { AsyncLocalStorage } from 'async_hooks';
3
- import { isIP } from 'net';
4
- import { lookup } from 'dns/promises';
5
- import { installNetPort, installCredentialScopeStorage } from '@almadar/shell-runtime';
6
-
7
- // src/pinned-fetch.ts
8
- var pinnedFetchNode = async (url, init, address) => {
9
- const dispatcher = new Agent({
10
- ...init.signal !== void 0 ? { headersTimeout: 0, bodyTimeout: 0 } : {},
11
- connect: {
12
- lookup: (_host, options, callback) => {
13
- const family = address.includes(":") ? 6 : 4;
14
- if (options.all === true) callback(null, [{ address, family }]);
15
- else callback(null, address, family);
16
- }
17
- }
18
- });
19
- try {
20
- return await fetch(url, { ...init, dispatcher });
21
- } finally {
22
- void dispatcher.close();
23
- }
24
- };
25
- async function resolveHostNode(host) {
26
- if (isIP(host) !== 0) return { literal: true, addresses: [host] };
27
- const found = await lookup(host, { all: true });
28
- return { literal: false, addresses: found.map((entry) => entry.address) };
29
- }
30
- var nodeNetPort = { resolve: resolveHostNode, fetch: pinnedFetchNode };
31
- function nodeCredentialScope() {
32
- return new AsyncLocalStorage();
33
- }
34
- var installed = false;
35
- function installNodeHostPorts() {
36
- if (installed) return;
37
- installed = true;
38
- installNetPort(nodeNetPort);
39
- installCredentialScopeStorage(nodeCredentialScope());
40
- }
41
-
42
- export { installNodeHostPorts, nodeCredentialScope, nodeNetPort, pinnedFetchNode, resolveHostNode };