@almadar/shell-node 0.1.0 → 1.0.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/OrbitalServerRuntime.d.ts +46 -267
- package/dist/OrbitalServerRuntime.js +3 -3
- package/dist/chunk-3PNZYEZQ.js +844 -0
- package/dist/{chunk-QYAPNUBH.js → chunk-7QE32QQR.js} +107 -182
- package/dist/{chunk-WZFQ7T7V.js → chunk-7QG7JGKQ.js} +2 -2
- package/dist/{chunk-UBZT5LDW.js → chunk-EEYGL7AB.js} +3 -13
- package/dist/chunk-VQVAHUAX.js +183 -0
- package/dist/{chunk-BJA6GYC5.js → chunk-YLFK5OJN.js} +61 -55
- package/dist/createProgramHandlers.js +5 -5
- package/dist/index.d.ts +97 -61
- package/dist/index.js +7 -7
- package/dist/kernel-loader-3JR6LJV5.js +1 -0
- package/dist/{kernel-workspace-host-CU56iOlt.d.ts → kernel-workspace-host-cT9JGJur.d.ts} +7 -12
- package/dist/kernelWorkspace.d.ts +1 -1
- package/dist/kernelWorkspace.js +3 -3
- package/dist/program-6DB6LK5B.js +2 -0
- package/package.json +9 -7
- package/dist/chunk-23YAOI6P.js +0 -42
- package/dist/chunk-A2TIXOLJ.js +0 -1326
- package/dist/kernel-loader-24KWM5C7.js +0 -1
- package/dist/program-35OTIG6Y.js +0 -2
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { installNodeHostPorts } from './chunk-
|
|
2
|
-
import { loadNativeKernelModule, resolveNativeAddon, loadKernelModule
|
|
1
|
+
import { installNodeHostPorts, createNodeTokenPost } from './chunk-VQVAHUAX.js';
|
|
2
|
+
import { loadNativeKernelModule, resolveNativeAddon, loadKernelModule } from './chunk-EEYGL7AB.js';
|
|
3
3
|
import { workspaceOwnerSegment } from './chunk-BWMLDDCL.js';
|
|
4
4
|
import { mkdirSync, realpathSync, mkdtempSync, writeFileSync, rmSync, constants as constants$1 } from 'fs';
|
|
5
5
|
import { constants, homedir, tmpdir, loadavg, uptime, machine, version, release, hostname, type, userInfo } from 'os';
|
|
6
|
-
import { dirname,
|
|
6
|
+
import { dirname, resolve, join } from 'path';
|
|
7
7
|
import { spawn } from 'child_process';
|
|
8
8
|
import { createRequire } from 'module';
|
|
9
|
-
import {
|
|
9
|
+
import { createSecretPorts, NativeMemoryPersistenceAdapter, kernelOsGrants, InFlightCalls, KernelEngine, dispatchInbound, anchoredGrants, expandAnchor } from '@almadar/shell-runtime';
|
|
10
10
|
import { resolveOrbBinary } from '@almadar/core/behavior-package';
|
|
11
11
|
import { tickEventKey } from '@almadar/core';
|
|
12
12
|
import { lstat, chmod, stat, readlink, symlink, link, unlink, rename, copyFile, open, mkdir, readdir, rm, rmdir, access, chown } from 'fs/promises';
|
|
@@ -1140,6 +1140,7 @@ var SOCKET_HIGH_WATER = 1024 * 1024;
|
|
|
1140
1140
|
var NET_OPS = /* @__PURE__ */ new Set([
|
|
1141
1141
|
"os/tcp-connect",
|
|
1142
1142
|
"os/tcp-listen",
|
|
1143
|
+
"os/tls-upgrade",
|
|
1143
1144
|
"os/send",
|
|
1144
1145
|
"os/recv",
|
|
1145
1146
|
"os/udp-bind",
|
|
@@ -1147,7 +1148,8 @@ var NET_OPS = /* @__PURE__ */ new Set([
|
|
|
1147
1148
|
"os/recvfrom",
|
|
1148
1149
|
"os/dns-resolve",
|
|
1149
1150
|
"os/shutdown",
|
|
1150
|
-
"os/watch-port"
|
|
1151
|
+
"os/watch-port",
|
|
1152
|
+
"os/fetch"
|
|
1151
1153
|
]);
|
|
1152
1154
|
function isNetOp(op) {
|
|
1153
1155
|
return NET_OPS.has(op);
|
|
@@ -1231,6 +1233,8 @@ var NetOps = class {
|
|
|
1231
1233
|
throw invalid(op, "a stream needs a key and a call site");
|
|
1232
1234
|
case "os/tcp-connect":
|
|
1233
1235
|
return this.tcpConnect(op, args);
|
|
1236
|
+
case "os/tls-upgrade":
|
|
1237
|
+
throw osFailure("unsupported", op, "a kernel op: the kernel owns TLS and a host implements none");
|
|
1234
1238
|
case "os/send":
|
|
1235
1239
|
return this.send(op, args);
|
|
1236
1240
|
case "os/recv":
|
|
@@ -1245,6 +1249,8 @@ var NetOps = class {
|
|
|
1245
1249
|
return this.dnsResolve(op, args);
|
|
1246
1250
|
case "os/shutdown":
|
|
1247
1251
|
return this.shutdown(op, args);
|
|
1252
|
+
case "os/fetch":
|
|
1253
|
+
throw osFailure("unsupported", op, "a browser host performs a fetch; this host speaks the protocol over os/tcp-connect and os/tls-upgrade");
|
|
1248
1254
|
default:
|
|
1249
1255
|
throw osFailure("unsupported", op, "streaming host not implemented");
|
|
1250
1256
|
}
|
|
@@ -1569,7 +1575,8 @@ var ProcessOps = class {
|
|
|
1569
1575
|
case "os/getenv": {
|
|
1570
1576
|
const name = argStr(args, 0, op);
|
|
1571
1577
|
this.envGranted(op, name);
|
|
1572
|
-
|
|
1578
|
+
const value = this.lookupEnv(name);
|
|
1579
|
+
return value === null ? {} : { value };
|
|
1573
1580
|
}
|
|
1574
1581
|
case "os/setenv":
|
|
1575
1582
|
case "os/unsetenv":
|
|
@@ -1722,9 +1729,8 @@ var ProcessOps = class {
|
|
|
1722
1729
|
const op = "os/kill";
|
|
1723
1730
|
let found;
|
|
1724
1731
|
if (typeof value === "string") found = SIGNAL_SET.find(([name]) => name === value)?.[1];
|
|
1725
|
-
else if (typeof value === "number" && Number.isInteger(value)) found = SIGNAL_SET.find(([, number]) => number === value)?.[1];
|
|
1726
1732
|
if (found === void 0) {
|
|
1727
|
-
throw invalid(op, "signal must be one of TERM, KILL, INT, HUP, QUIT, USR1, USR2, STOP, CONT
|
|
1733
|
+
throw invalid(op, "signal must be one of TERM, KILL, INT, HUP, QUIT, USR1, USR2, STOP, CONT");
|
|
1728
1734
|
}
|
|
1729
1735
|
return found;
|
|
1730
1736
|
}
|
|
@@ -1882,22 +1888,23 @@ var NodeOsHost = class {
|
|
|
1882
1888
|
this.given = given;
|
|
1883
1889
|
this.anchors = anchors;
|
|
1884
1890
|
this.state = new OsState(anchors);
|
|
1885
|
-
const grants = anchoredGrants(given, anchors);
|
|
1886
|
-
this.fs = new FsOps(this.state, grants);
|
|
1887
|
-
this.process = new ProcessOps(this.state, grants);
|
|
1888
|
-
this.net = new NetOps(this.state, grants);
|
|
1889
|
-
this.sys = new SysOps(grants);
|
|
1890
1891
|
}
|
|
1891
1892
|
given;
|
|
1892
1893
|
anchors;
|
|
1893
1894
|
state;
|
|
1894
|
-
|
|
1895
|
-
process;
|
|
1896
|
-
net;
|
|
1897
|
-
sys;
|
|
1895
|
+
ops = /* @__PURE__ */ new Map();
|
|
1898
1896
|
placed = false;
|
|
1899
1897
|
/** The listener handle of each open stream, by its key. */
|
|
1900
1898
|
streams = /* @__PURE__ */ new Map();
|
|
1899
|
+
/** The ops that check `orbital`'s grants (the app level alone with none): every grant decision is the kernel's, asked with the orbital. */
|
|
1900
|
+
opsFor(orbital) {
|
|
1901
|
+
const held = this.ops.get(orbital);
|
|
1902
|
+
if (held !== void 0) return held;
|
|
1903
|
+
const grants = anchoredGrants({ ...this.given, allows: (need) => this.given.allows(need, orbital) }, this.anchors);
|
|
1904
|
+
const made = { fs: new FsOps(this.state, grants), process: new ProcessOps(this.state, grants), net: new NetOps(this.state, grants), sys: new SysOps(grants) };
|
|
1905
|
+
this.ops.set(orbital, made);
|
|
1906
|
+
return made;
|
|
1907
|
+
}
|
|
1901
1908
|
/** The call's arguments with every anchored part resolved by the kernel, the program's anchors placed on the first call. */
|
|
1902
1909
|
resolved(op, args) {
|
|
1903
1910
|
if (!this.placed) {
|
|
@@ -1908,47 +1915,49 @@ var NodeOsHost = class {
|
|
|
1908
1915
|
if ("error" in resolved) throw new OsFailure(resolved.error);
|
|
1909
1916
|
return resolved.ok;
|
|
1910
1917
|
}
|
|
1911
|
-
async dispatch(op, given) {
|
|
1918
|
+
async dispatch(op, given, orbital) {
|
|
1912
1919
|
const args = this.resolved(op, given);
|
|
1920
|
+
const { fs, process: process2, net, sys } = this.opsFor(orbital);
|
|
1913
1921
|
if (op === "os/close") {
|
|
1914
|
-
if (
|
|
1922
|
+
if (fs.closeOwned(args) || net.closeOwned(args)) return {};
|
|
1915
1923
|
throw osFailure("closed", op, "not an open handle");
|
|
1916
1924
|
}
|
|
1917
|
-
if (isFsOp(op)) return
|
|
1918
|
-
if (isProcessOp(op)) return
|
|
1919
|
-
if (isNetOp(op)) return
|
|
1920
|
-
if (isSysOp(op)) return
|
|
1925
|
+
if (isFsOp(op)) return fs.run(op, args);
|
|
1926
|
+
if (isProcessOp(op)) return process2.run(op, args);
|
|
1927
|
+
if (isNetOp(op)) return net.run(op, args);
|
|
1928
|
+
if (isSysOp(op)) return sys.run(op);
|
|
1921
1929
|
if (DEVICE_OPS.has(op)) throw osFailure("unsupported", op, "this host has no devices");
|
|
1922
1930
|
throw osFailure("unsupported", op, "this host does not implement the operation yet");
|
|
1923
1931
|
}
|
|
1924
|
-
async answer(op, args) {
|
|
1932
|
+
async answer(op, args, orbital) {
|
|
1925
1933
|
try {
|
|
1926
|
-
return { ok: await this.dispatch(op, args) };
|
|
1934
|
+
return { ok: await this.dispatch(op, args, orbital) };
|
|
1927
1935
|
} catch (raised) {
|
|
1928
1936
|
return { error: failureOf(op, raised) };
|
|
1929
1937
|
}
|
|
1930
1938
|
}
|
|
1931
|
-
deferral(op, args) {
|
|
1939
|
+
deferral(op, args, orbital) {
|
|
1940
|
+
const { fs, process: process2, net } = this.opsFor(orbital);
|
|
1932
1941
|
switch (op) {
|
|
1933
1942
|
case "os/wait":
|
|
1934
|
-
return
|
|
1943
|
+
return process2.waitLater(args);
|
|
1935
1944
|
case "os/read":
|
|
1936
|
-
return
|
|
1945
|
+
return fs.readLater(op, args);
|
|
1937
1946
|
case "os/send":
|
|
1938
|
-
return
|
|
1947
|
+
return net.sendLater(op, args);
|
|
1939
1948
|
case "os/recv":
|
|
1940
|
-
return
|
|
1949
|
+
return net.recvLater(op, args);
|
|
1941
1950
|
case "os/recvfrom":
|
|
1942
|
-
return
|
|
1951
|
+
return net.recvfromLater(op, args);
|
|
1943
1952
|
default:
|
|
1944
1953
|
throw osFailure("unsupported", op, "this operation does not defer its completion");
|
|
1945
1954
|
}
|
|
1946
1955
|
}
|
|
1947
1956
|
/** `Completions::run_later`: the checks fail in place, the wait runs in the background and its outcome goes to `deliver` unless the key is cancelled first. */
|
|
1948
|
-
defer(op, args, key, deliver) {
|
|
1957
|
+
defer(op, args, key, deliver, orbital) {
|
|
1949
1958
|
let blocking;
|
|
1950
1959
|
try {
|
|
1951
|
-
blocking = this.deferral(op, this.resolved(op, args));
|
|
1960
|
+
blocking = this.deferral(op, this.resolved(op, args), orbital);
|
|
1952
1961
|
} catch (raised) {
|
|
1953
1962
|
return { error: failureOf(op, raised) };
|
|
1954
1963
|
}
|
|
@@ -1967,11 +1976,11 @@ var NodeOsHost = class {
|
|
|
1967
1976
|
return { ok: null };
|
|
1968
1977
|
}
|
|
1969
1978
|
/** A keyed stream (EXEC-QUEUE-12): `os/tcp-listen` binds and answers in place, then each connection reaches `message`. */
|
|
1970
|
-
async stream(op, args, key, message, fail2) {
|
|
1979
|
+
async stream(op, args, key, message, fail2, orbital) {
|
|
1971
1980
|
try {
|
|
1972
1981
|
if (op !== "os/tcp-listen") throw osFailure("unsupported", op, "this host streams only os/tcp-listen");
|
|
1973
1982
|
if (this.streams.has(key)) throw invalid(op, `key ${key} already has a stream open`);
|
|
1974
|
-
const answer = await this.net.listen(op, this.resolved(op, args), message, (error) => {
|
|
1983
|
+
const answer = await this.opsFor(orbital).net.listen(op, this.resolved(op, args), message, (error) => {
|
|
1975
1984
|
this.streams.delete(key);
|
|
1976
1985
|
fail2(error);
|
|
1977
1986
|
});
|
|
@@ -1985,7 +1994,7 @@ var NodeOsHost = class {
|
|
|
1985
1994
|
const listener = this.streams.get(key);
|
|
1986
1995
|
if (listener !== void 0) {
|
|
1987
1996
|
this.streams.delete(key);
|
|
1988
|
-
this.net.stopListening(listener);
|
|
1997
|
+
this.opsFor(void 0).net.stopListening(listener);
|
|
1989
1998
|
return true;
|
|
1990
1999
|
}
|
|
1991
2000
|
return this.state.completions.cancel(key);
|
|
@@ -1997,7 +2006,7 @@ var NodeOsHost = class {
|
|
|
1997
2006
|
function processAnchors() {
|
|
1998
2007
|
const env = {};
|
|
1999
2008
|
for (const [name, value] of Object.entries(process.env)) if (value !== void 0) env[name] = value;
|
|
2000
|
-
return { home: homedir(), start: process.cwd(), exeDir: dirname(process.execPath), env };
|
|
2009
|
+
return { home: homedir(), start: process.cwd(), exeDir: dirname(process.execPath), exe: process.execPath, env };
|
|
2001
2010
|
}
|
|
2002
2011
|
function createNodeOsHost(grants, options = {}) {
|
|
2003
2012
|
return new NodeOsHost(grants, options.anchors ?? processAnchors());
|
|
@@ -2034,17 +2043,17 @@ async function resolveProgramFile(path, cwd = dirname(resolve(path)), orb = reso
|
|
|
2034
2043
|
});
|
|
2035
2044
|
}
|
|
2036
2045
|
var KernelProgram = class _KernelProgram {
|
|
2037
|
-
constructor(engine, os, schema,
|
|
2046
|
+
constructor(engine, os, schema, secretPorts, persistence) {
|
|
2038
2047
|
this.engine = engine;
|
|
2039
2048
|
this.os = os;
|
|
2040
2049
|
this.schema = schema;
|
|
2041
|
-
this.
|
|
2050
|
+
this.secretPorts = secretPorts;
|
|
2042
2051
|
this.persistence = persistence;
|
|
2043
2052
|
}
|
|
2044
2053
|
engine;
|
|
2045
2054
|
os;
|
|
2046
2055
|
schema;
|
|
2047
|
-
|
|
2056
|
+
secretPorts;
|
|
2048
2057
|
persistence;
|
|
2049
2058
|
static async open(schema, options) {
|
|
2050
2059
|
const languageFrom = { languageFrom: options.languageFrom };
|
|
@@ -2053,20 +2062,17 @@ var KernelProgram = class _KernelProgram {
|
|
|
2053
2062
|
const kernelDir = addon === void 0 ? options.kernelDir ?? resolveKernelDir() : "";
|
|
2054
2063
|
const kernel = addon ?? await loadKernelModule(kernelDir, languageFrom);
|
|
2055
2064
|
installNodeHostPorts();
|
|
2056
|
-
const http = createHttpPorts({
|
|
2057
|
-
kernel: addon !== void 0 ? async () => addon : () => loadHttpKernel(kernelDir, languageFrom),
|
|
2058
|
-
...options.http,
|
|
2059
|
-
egress: schema.egress ?? []
|
|
2060
|
-
});
|
|
2061
|
-
const persistence = new NativeMemoryPersistenceAdapter(new kernel.MemoryStore());
|
|
2062
|
-
for (const [entityType, rows] of Object.entries(options.seed ?? {})) {
|
|
2063
|
-
for (const row of rows) await persistence.writeWhere({ kind: "upsert", entityType, data: row });
|
|
2064
|
-
}
|
|
2065
2065
|
let engine;
|
|
2066
2066
|
const requireEngine = () => {
|
|
2067
2067
|
if (engine === void 0) throw new Error("KernelProgram: an os ask arrived before the program opened");
|
|
2068
2068
|
return engine;
|
|
2069
2069
|
};
|
|
2070
|
+
const tokenPost = createNodeTokenPost({ egressAllows: (url) => requireEngine().egressAllows(url), isPublicAddress: (ip) => kernel.isPublicAddress(ip) });
|
|
2071
|
+
const secretPorts = createSecretPorts({ tokenPost, ...options.secretPorts });
|
|
2072
|
+
const persistence = new NativeMemoryPersistenceAdapter(new kernel.MemoryStore());
|
|
2073
|
+
for (const [entityType, rows] of Object.entries(options.seed ?? {})) {
|
|
2074
|
+
for (const row of rows) await persistence.writeWhere({ kind: "upsert", entityType, data: row });
|
|
2075
|
+
}
|
|
2070
2076
|
const os = options.os === true ? createNodeOsHost(kernelOsGrants(kernel, requireEngine)) : void 0;
|
|
2071
2077
|
const ports = {
|
|
2072
2078
|
persistence,
|
|
@@ -2078,18 +2084,18 @@ var KernelProgram = class _KernelProgram {
|
|
|
2078
2084
|
}, read: async () => [] }),
|
|
2079
2085
|
deliverLive: () => void 0,
|
|
2080
2086
|
deferCallOutcome: () => void 0,
|
|
2081
|
-
|
|
2087
|
+
secretPorts,
|
|
2082
2088
|
...os !== void 0 ? { os } : {}
|
|
2083
2089
|
};
|
|
2084
2090
|
engine = KernelEngine.open(kernel, schema, ports);
|
|
2085
|
-
return new _KernelProgram(engine, os, schema,
|
|
2091
|
+
return new _KernelProgram(engine, os, schema, secretPorts, persistence);
|
|
2086
2092
|
}
|
|
2087
|
-
/** Fire `event` at the orbital as `user` (the program's `@user`), wait for its whole cascade (every
|
|
2093
|
+
/** 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. */
|
|
2088
2094
|
async dispatch(orbital, event, payload = {}, targetTrait, user) {
|
|
2089
2095
|
const response = await this.engine.evaluate(
|
|
2090
2096
|
orbital,
|
|
2091
2097
|
{ event, payload, ...targetTrait !== void 0 ? { targetTrait } : {}, ...user !== void 0 ? { user } : {} },
|
|
2092
|
-
{ orbital
|
|
2098
|
+
{ orbital }
|
|
2093
2099
|
);
|
|
2094
2100
|
return {
|
|
2095
2101
|
success: response.success,
|
|
@@ -2110,7 +2116,7 @@ var KernelProgram = class _KernelProgram {
|
|
|
2110
2116
|
}
|
|
2111
2117
|
/** Deliver an `/api/hooks/<name>` request to the program and return the answer it gave (EXEC-INBOUND-1). */
|
|
2112
2118
|
async deliverInbound(name, delivery) {
|
|
2113
|
-
return dispatchInbound(this.
|
|
2119
|
+
return dispatchInbound(this.engine, name, delivery, (orbital, request) => this.engine.evaluate(orbital, request, { orbital }), (credential) => this.secretPorts.secrets.get(credential, void 0));
|
|
2114
2120
|
}
|
|
2115
2121
|
/** The rows the host's in-memory store holds for `entity` (empty when the native kernel keeps its own `store`). */
|
|
2116
2122
|
async rows(entity) {
|
|
@@ -2216,4 +2222,4 @@ function kernelWorkspaceHost(options) {
|
|
|
2216
2222
|
};
|
|
2217
2223
|
}
|
|
2218
2224
|
|
|
2219
|
-
export {
|
|
2225
|
+
export { KernelProgram, createNodeOsHost, emitPayload, kernelWorkspaceHost, processAnchors, resolveProgramFile, workspaceBucketFromEnv, workspacesRoot };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export { createProgramHandlers } from './chunk-
|
|
2
|
-
import './chunk-
|
|
3
|
-
import './chunk-
|
|
4
|
-
import './chunk-
|
|
5
|
-
import './chunk-
|
|
1
|
+
export { createProgramHandlers } from './chunk-7QG7JGKQ.js';
|
|
2
|
+
import './chunk-YLFK5OJN.js';
|
|
3
|
+
import './chunk-VQVAHUAX.js';
|
|
4
|
+
import './chunk-EEYGL7AB.js';
|
|
5
|
+
import './chunk-7QE32QQR.js';
|
|
6
6
|
import './chunk-BWMLDDCL.js';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,19 +1,44 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { JsonValue, KernelMemoryStoreExports, OrbitalSchema, EvaluatedProgram, ProgramValidationIssue, CatalogScope, CatalogEntry, DependencyGraph, TraitValue, TraitDescription, DescribeTarget, BehaviorDescription
|
|
3
|
-
export { ClientEffectTuple, ClientNavigateBackTuple, ClientNavigateTuple, ClientRenderUITuple,
|
|
4
|
-
import
|
|
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 {
|
|
7
|
-
export { HostDispatchItem, LiveBroadcastItem, LoaderConfig,
|
|
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
|
-
|
|
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,
|
|
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
|
-
*
|
|
123
|
-
*
|
|
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
|
|
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; `
|
|
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
|
|
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
|
-
|
|
162
|
-
declare function behaviorDescribe(value:
|
|
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
|
|
222
|
-
*
|
|
223
|
-
*
|
|
224
|
-
*
|
|
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,
|
|
265
|
-
export type { KvBackend, KvBatchOp, KvErrorKind, KvHost, KvNamespace, KvResult,
|
|
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
|
|
2
|
-
export { createProgramHandlers } from './chunk-
|
|
3
|
-
export {
|
|
4
|
-
export {
|
|
5
|
-
export {
|
|
6
|
-
export { behaviorCatalog, behaviorCatalogSync, behaviorDependencies, behaviorDescribe, behaviorResolve, behaviorSource,
|
|
1
|
+
export { OrbitalServerRuntime, UnresolvedProgramError } from './chunk-3PNZYEZQ.js';
|
|
2
|
+
export { createProgramHandlers } from './chunk-7QG7JGKQ.js';
|
|
3
|
+
export { KernelProgram, createNodeOsHost, emitPayload, kernelWorkspaceHost, processAnchors, resolveProgramFile, workspaceBucketFromEnv, workspacesRoot } from './chunk-YLFK5OJN.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
|
|
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,
|
|
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
|
-
/**
|
|
56
|
-
|
|
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
|
|
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
|
|
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 {
|
|
135
|
-
export type { ProgramRun as P, KernelProgramOptions as a, KernelWorkspaceBucket as b, KernelWorkspaceHostOptions as c,
|
|
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 {
|
|
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';
|