@ai-ecoverse/slicc-kernel 1.125.12 → 1.126.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +14 -3
- package/dist/index.js.map +2 -2
- package/dist/kernel-worker.js +242 -38
- package/dist/kernel-worker.js.map +4 -4
- package/dist/meta.js.map +2 -2
- package/dist/node-process-worker.js +90 -25
- package/dist/node-process-worker.js.map +3 -3
- package/dist/node.js +242 -38
- package/dist/node.js.map +4 -4
- package/dist/process-worker.js +90 -25
- package/dist/process-worker.js.map +3 -3
- package/dist/types/fs/meta.d.ts +6 -0
- package/dist/types/fs/opfs.d.ts +8 -0
- package/dist/types/index.d.ts +1 -1
- package/dist/types/kernel/net/tls-client.d.ts +4 -0
- package/dist/types/kernel/net/tls-uplink.d.ts +2 -1
- package/dist/types/kernel/sealed-session.d.ts +44 -0
- package/dist/types/kernel/sealed.d.ts +3 -0
- package/dist/types/process/js/js-context.d.ts +15 -3
- package/dist/types/process/js/js-io.d.ts +3 -0
- package/dist/types/process/js/js-net.d.ts +1 -0
- package/dist/types/process/js/js-sync.d.ts +5 -3
- package/dist/types/process/js/js-tty.d.ts +11 -1
- package/package.json +2 -2
package/dist/node.js
CHANGED
|
@@ -4361,6 +4361,10 @@ var STALE = /* @__PURE__ */ new Set(["NotFoundError", "TypeMismatchError"]);
|
|
|
4361
4361
|
var REPLACED_ATTEMPTS = 4;
|
|
4362
4362
|
var RECONCILE_LISTINGS = 8;
|
|
4363
4363
|
var EXECUTABLE = /\/node_modules\/(?:@[^/]+\/)?[^/]+\/bin\//;
|
|
4364
|
+
var RENAMES = "/.slicc-renames";
|
|
4365
|
+
function movable(handle) {
|
|
4366
|
+
return typeof handle.move === "function";
|
|
4367
|
+
}
|
|
4364
4368
|
var ERRNO_BY_DOM_ERROR = {
|
|
4365
4369
|
NotFoundError: "ENOENT",
|
|
4366
4370
|
TypeMismatchError: "ENOTDIR",
|
|
@@ -5530,9 +5534,9 @@ var OpfsFs = class {
|
|
|
5530
5534
|
}
|
|
5531
5535
|
const now = Date.now();
|
|
5532
5536
|
const moving = await this.movedOwner(source);
|
|
5533
|
-
const carry = (
|
|
5537
|
+
const carry = (entry2) => ({
|
|
5534
5538
|
ino: inodeOf(source.path),
|
|
5535
|
-
...occupied(
|
|
5539
|
+
...occupied(entry2),
|
|
5536
5540
|
...moving,
|
|
5537
5541
|
path: destination,
|
|
5538
5542
|
ctimeMs: now
|
|
@@ -5548,29 +5552,127 @@ var OpfsFs = class {
|
|
|
5548
5552
|
const name2 = baseOf(destination);
|
|
5549
5553
|
const swap = targetStat?.isDirectory === true;
|
|
5550
5554
|
const staging = swap ? `.${name2}.${crypto.randomUUID()}` : name2;
|
|
5551
|
-
|
|
5552
|
-
const
|
|
5553
|
-
const
|
|
5554
|
-
|
|
5555
|
-
|
|
5555
|
+
const copying = sourceStat.isDirectory && !movable(source.handle);
|
|
5556
|
+
const staged = resolvePath(parent.path, staging);
|
|
5557
|
+
const place = async () => {
|
|
5558
|
+
this.forget(destination);
|
|
5559
|
+
const timed2 = await this.explicitTimes(source.path);
|
|
5560
|
+
const first = copying ? await this.intend({ from: source.path, to: staged }) : void 0;
|
|
5561
|
+
const second = copying && swap ? await this.intend({ from: staged, to: destination, replace: true }) : void 0;
|
|
5562
|
+
const moved2 = await this.replacingTarget(
|
|
5563
|
+
targetStat !== null,
|
|
5564
|
+
() => this.place(source.handle, dir, staging)
|
|
5565
|
+
).catch(async (err) => {
|
|
5566
|
+
if (first) await this.rollBack(staged, source.path, [first, second]);
|
|
5567
|
+
throw err;
|
|
5568
|
+
});
|
|
5569
|
+
if (swap) await this.rm(destination, { recursive: true });
|
|
5570
|
+
if (second) await this.intend({ from: staged, to: destination }, second);
|
|
5571
|
+
await this.meta.move(source.path, destination, carry, left);
|
|
5572
|
+
this.movePending(source.path, destination);
|
|
5573
|
+
if (!moved2) {
|
|
5574
|
+
await this.rm(source.path, { recursive: true });
|
|
5575
|
+
await this.meta.update(source.path, () => left);
|
|
5576
|
+
}
|
|
5577
|
+
if (first) await this.meta.update(first, () => void 0);
|
|
5578
|
+
let copied = !moved2;
|
|
5579
|
+
if (swap) {
|
|
5580
|
+
const hidden = await dir.getDirectoryHandle(staging);
|
|
5581
|
+
const placed = await this.place(hidden, dir, name2);
|
|
5582
|
+
if (!placed) await dir.removeEntry(staging, { recursive: true });
|
|
5583
|
+
copied ||= !placed;
|
|
5584
|
+
}
|
|
5585
|
+
if (second) await this.meta.update(second, () => void 0);
|
|
5586
|
+
if (copied) await this.restamp(destination, timed2);
|
|
5587
|
+
this.changed(source.path, destination);
|
|
5588
|
+
this.touch(Date.now(), parentOf4(source.path), parent.path);
|
|
5589
|
+
};
|
|
5590
|
+
if (!copying) return place();
|
|
5591
|
+
const { promise, resolve: resolve2 } = Promise.withResolvers();
|
|
5592
|
+
const entry = { from: source.path, to: destination, done: promise };
|
|
5593
|
+
this.renamingDirs.add(entry);
|
|
5594
|
+
try {
|
|
5595
|
+
await place();
|
|
5596
|
+
} finally {
|
|
5597
|
+
this.renamingDirs.delete(entry);
|
|
5598
|
+
resolve2();
|
|
5599
|
+
}
|
|
5600
|
+
}
|
|
5601
|
+
renamingDirs = /* @__PURE__ */ new Set();
|
|
5602
|
+
intents = 0;
|
|
5603
|
+
async intend(rename, at = `${RENAMES}/${crypto.randomUUID()}`) {
|
|
5604
|
+
const record = { ...rename, at: Date.now() * 1e3 + this.intents++ % 1e3 };
|
|
5605
|
+
await this.meta.update(at, () => ({ path: at, rename: record }));
|
|
5606
|
+
return at;
|
|
5607
|
+
}
|
|
5608
|
+
async rollBack(from, to, intents) {
|
|
5609
|
+
try {
|
|
5610
|
+
if (await this.real(from)) {
|
|
5611
|
+
const moved2 = await this.locate(from, false);
|
|
5612
|
+
const back = await this.locate(parentOf4(to), true);
|
|
5613
|
+
await this.copy(
|
|
5614
|
+
moved2.handle,
|
|
5615
|
+
back.handle,
|
|
5616
|
+
baseOf(to)
|
|
5617
|
+
);
|
|
5618
|
+
const [dir, name2] = await this.parent(from);
|
|
5619
|
+
await this.inDir(dir, (parent) => parent.removeEntry(name2, { recursive: true }));
|
|
5620
|
+
}
|
|
5621
|
+
this.forget(from);
|
|
5622
|
+
this.forget(to);
|
|
5623
|
+
for (const intent of intents) if (intent) await this.meta.update(intent, () => void 0);
|
|
5624
|
+
} catch {
|
|
5625
|
+
}
|
|
5626
|
+
}
|
|
5627
|
+
async finishRenames() {
|
|
5628
|
+
const intents = (await this.meta.under(RENAMES)).filter((entry) => entry.rename !== void 0).sort(
|
|
5629
|
+
(a, b) => a.rename.at - b.rename.at
|
|
5556
5630
|
);
|
|
5557
|
-
|
|
5558
|
-
|
|
5559
|
-
|
|
5560
|
-
|
|
5561
|
-
|
|
5562
|
-
|
|
5563
|
-
|
|
5564
|
-
|
|
5565
|
-
|
|
5566
|
-
|
|
5567
|
-
|
|
5568
|
-
|
|
5569
|
-
|
|
5570
|
-
|
|
5571
|
-
|
|
5572
|
-
|
|
5573
|
-
|
|
5631
|
+
for (const entry of intents) {
|
|
5632
|
+
const { from, to, replace } = entry.rename;
|
|
5633
|
+
const left = await this.real(from);
|
|
5634
|
+
if (left && replace && await this.real(to)) await this.rm(to, { recursive: true });
|
|
5635
|
+
if (left) {
|
|
5636
|
+
const source = await this.locate(from, false);
|
|
5637
|
+
const target = await this.locate(parentOf4(to), true);
|
|
5638
|
+
await this.copy(
|
|
5639
|
+
source.handle,
|
|
5640
|
+
target.handle,
|
|
5641
|
+
baseOf(to)
|
|
5642
|
+
);
|
|
5643
|
+
const [dir, name2] = await this.parent(from);
|
|
5644
|
+
await this.inDir(dir, (parent) => parent.removeEntry(name2, { recursive: true }));
|
|
5645
|
+
this.forget(from);
|
|
5646
|
+
this.forget(to);
|
|
5647
|
+
}
|
|
5648
|
+
if ((await this.meta.under(from)).length > 0) {
|
|
5649
|
+
await this.meta.move(from, to, (moved2) => ({ ...occupied(moved2), path: to }));
|
|
5650
|
+
}
|
|
5651
|
+
await this.meta.update(entry.path, () => void 0);
|
|
5652
|
+
}
|
|
5653
|
+
return intents.length;
|
|
5654
|
+
}
|
|
5655
|
+
async settledRename(path) {
|
|
5656
|
+
if (this.renamingDirs.size === 0 || typeof path !== "string") return;
|
|
5657
|
+
const at = normalizePath(path);
|
|
5658
|
+
for (let real; ; ) {
|
|
5659
|
+
const busy = this.renameAt(at) ?? (real === void 0 ? void 0 : this.renameAt(real));
|
|
5660
|
+
if (busy) {
|
|
5661
|
+
await busy.done;
|
|
5662
|
+
continue;
|
|
5663
|
+
}
|
|
5664
|
+
if (real !== void 0 || at === "/") return;
|
|
5665
|
+
const parent = await this.realpath(parentOf4(at), true).catch(() => parentOf4(at));
|
|
5666
|
+
real = resolvePath(parent, baseOf(at));
|
|
5667
|
+
if (real === at) return;
|
|
5668
|
+
}
|
|
5669
|
+
}
|
|
5670
|
+
renameAt(at) {
|
|
5671
|
+
for (const m of this.renamingDirs) {
|
|
5672
|
+
if (within3(at, m.from) || within3(at, m.to) || at === parentOf4(m.from) || at === parentOf4(m.to))
|
|
5673
|
+
return m;
|
|
5674
|
+
}
|
|
5675
|
+
return void 0;
|
|
5574
5676
|
}
|
|
5575
5677
|
async replacingTarget(replaces, op) {
|
|
5576
5678
|
if (!replaces) return op();
|
|
@@ -5612,15 +5714,29 @@ var OpfsFs = class {
|
|
|
5612
5714
|
() => false
|
|
5613
5715
|
);
|
|
5614
5716
|
if (moved2) return true;
|
|
5717
|
+
const before = this.fileMoves;
|
|
5615
5718
|
try {
|
|
5616
5719
|
await this.copy(handle, dir, name2);
|
|
5617
5720
|
} catch (err) {
|
|
5618
|
-
if (handle.kind === "directory"
|
|
5721
|
+
if (handle.kind === "directory" && this.fileMoves === before) {
|
|
5722
|
+
await dir.removeEntry(name2, { recursive: true });
|
|
5723
|
+
}
|
|
5619
5724
|
throw translate(err, name2);
|
|
5620
5725
|
}
|
|
5621
5726
|
return false;
|
|
5622
5727
|
}
|
|
5728
|
+
fileMoves = 0;
|
|
5623
5729
|
async copy(handle, dir, name2) {
|
|
5730
|
+
if (handle.kind === "file" && movable(handle)) {
|
|
5731
|
+
const moved2 = await handle.move?.(dir, name2).then(
|
|
5732
|
+
() => true,
|
|
5733
|
+
() => false
|
|
5734
|
+
);
|
|
5735
|
+
if (moved2) {
|
|
5736
|
+
this.fileMoves++;
|
|
5737
|
+
return;
|
|
5738
|
+
}
|
|
5739
|
+
}
|
|
5624
5740
|
if (handle.kind === "file") {
|
|
5625
5741
|
const writable2 = await (await dir.getFileHandle(name2, { create: true })).createWritable();
|
|
5626
5742
|
await writable2.write(await handle.getFile());
|
|
@@ -5757,6 +5873,7 @@ var OpfsFs = class {
|
|
|
5757
5873
|
}
|
|
5758
5874
|
async reconcile() {
|
|
5759
5875
|
if (this.remote && await this.remote.peered()) return 0;
|
|
5876
|
+
await this.finishRenames();
|
|
5760
5877
|
let removed = 0;
|
|
5761
5878
|
const entries = await this.meta.all();
|
|
5762
5879
|
const carried = new Set(entries.filter((e) => !e.vacated).map((e) => e.ino));
|
|
@@ -5787,7 +5904,9 @@ var READS = [
|
|
|
5787
5904
|
"readdir",
|
|
5788
5905
|
"readdirStat",
|
|
5789
5906
|
"readlink",
|
|
5790
|
-
"realpath"
|
|
5907
|
+
"realpath",
|
|
5908
|
+
"version",
|
|
5909
|
+
"readVersioned"
|
|
5791
5910
|
];
|
|
5792
5911
|
var WRITES = [
|
|
5793
5912
|
"writeFile",
|
|
@@ -5813,6 +5932,7 @@ for (const [names2, op] of [
|
|
|
5813
5932
|
const inner = proto[name2];
|
|
5814
5933
|
proto[name2] = async function(...args) {
|
|
5815
5934
|
try {
|
|
5935
|
+
if (op === "read") await this.settledRename(args[0]);
|
|
5816
5936
|
return await inner.apply(this, args);
|
|
5817
5937
|
} catch (err) {
|
|
5818
5938
|
throw translate(err, String(args[0]), op, false);
|
|
@@ -7153,7 +7273,7 @@ function satisfies(version, range2) {
|
|
|
7153
7273
|
}
|
|
7154
7274
|
|
|
7155
7275
|
// src/version.ts
|
|
7156
|
-
var KERNEL_VERSION = true ? "1.
|
|
7276
|
+
var KERNEL_VERSION = true ? "1.126.1" : "0.0.0-dev";
|
|
7157
7277
|
var OS_RELEASE = "6.0.0-slicc";
|
|
7158
7278
|
function procVersion() {
|
|
7159
7279
|
return `Linux version ${OS_RELEASE} (slicc-kernel ${KERNEL_VERSION}) #1 SMP PREEMPT_DYNAMIC
|
|
@@ -8426,10 +8546,10 @@ function tunnelRequestUrl(req, origin) {
|
|
|
8426
8546
|
throw new HttpError(400, "malformed request target");
|
|
8427
8547
|
}
|
|
8428
8548
|
const hosts = fieldValues(req.headers, "host");
|
|
8429
|
-
const
|
|
8549
|
+
const hostOk2 = hosts.every(
|
|
8430
8550
|
(h) => URL.canParse(`https://${h}`) && new URL(`https://${h}`).host === base.host
|
|
8431
8551
|
);
|
|
8432
|
-
if (url.origin !== base.origin || !
|
|
8552
|
+
if (url.origin !== base.origin || !hostOk2) {
|
|
8433
8553
|
throw new HttpError(421, `this tunnel is for ${base.host}`);
|
|
8434
8554
|
}
|
|
8435
8555
|
return url.href;
|
|
@@ -17599,6 +17719,10 @@ function controlsOf(o, session, protocol, chain2, shape) {
|
|
|
17599
17719
|
...o.insecure ? insecureOf(session, chain2, shape) : { hostnameMatches: checked || !session.nameMismatch }
|
|
17600
17720
|
};
|
|
17601
17721
|
}
|
|
17722
|
+
function verdictOf(o, session) {
|
|
17723
|
+
if (o.bundled !== true || isIP(o.servername) || session.verifyResult !== 0) return false;
|
|
17724
|
+
return o.checkHostname !== false || !session.nameMismatch;
|
|
17725
|
+
}
|
|
17602
17726
|
async function infoOf(o, session) {
|
|
17603
17727
|
const flags2 = session.verifyResult;
|
|
17604
17728
|
const code = verifyCode(flags2);
|
|
@@ -17611,7 +17735,9 @@ async function infoOf(o, session) {
|
|
|
17611
17735
|
authorized: code === void 0,
|
|
17612
17736
|
...code ? { authorizationError: code, authorizationText: o.engine.verifyInfo(flags2).trim() } : {},
|
|
17613
17737
|
peerCertificates: chain2,
|
|
17614
|
-
...controlsOf(o, session, protocol, chain2, shape)
|
|
17738
|
+
...controlsOf(o, session, protocol, chain2, shape),
|
|
17739
|
+
verified: verdictOf(o, session),
|
|
17740
|
+
handshakeAt: Date.now()
|
|
17615
17741
|
};
|
|
17616
17742
|
}
|
|
17617
17743
|
var FATAL_ALERT = -30592;
|
|
@@ -17729,6 +17855,7 @@ function sessionOf(info, servername) {
|
|
|
17729
17855
|
return {
|
|
17730
17856
|
path: "kernel",
|
|
17731
17857
|
substitutes: false,
|
|
17858
|
+
verified: info.verified,
|
|
17732
17859
|
protocol: info.protocol,
|
|
17733
17860
|
alpnProtocol: info.alpnProtocol,
|
|
17734
17861
|
authorized: info.authorized,
|
|
@@ -17842,7 +17969,8 @@ async function prepareWith(support, req, servername, cert) {
|
|
|
17842
17969
|
insecure: req.insecure === true,
|
|
17843
17970
|
...req.sni === false ? { sni: false } : {},
|
|
17844
17971
|
...req.checkHostname === false ? { checkHostname: false } : {},
|
|
17845
|
-
clientCertificate: cert !== void 0
|
|
17972
|
+
clientCertificate: cert !== void 0,
|
|
17973
|
+
bundled: own === void 0
|
|
17846
17974
|
};
|
|
17847
17975
|
let session;
|
|
17848
17976
|
try {
|
|
@@ -22582,6 +22710,79 @@ function scrubStdio(fds, scrubber) {
|
|
|
22582
22710
|
}
|
|
22583
22711
|
}
|
|
22584
22712
|
|
|
22713
|
+
// src/kernel/sealed-session.ts
|
|
22714
|
+
var SESSION_WINDOW_MS = 6e4;
|
|
22715
|
+
var SESSION_PLACEHOLDERS = 16;
|
|
22716
|
+
var SESSION_PLACEHOLDER = /^fnox_proxy_[0-9a-f]{24}$/;
|
|
22717
|
+
var SESSION_ID = /^[A-Za-z0-9_-]{16,128}$/;
|
|
22718
|
+
var TOKEN5 = "[!#$%&'*+.^_`|~0-9a-z-]+";
|
|
22719
|
+
var HEADER = new RegExp(`^header:${TOKEN5}$`);
|
|
22720
|
+
var METHOD = /^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;
|
|
22721
|
+
var TARGET = /^[\x21-\x7e]+$/;
|
|
22722
|
+
var EXIT = /^(page|proxy|tailscale|device:[\x21-\x7e]+)$/;
|
|
22723
|
+
var HOST = /^[a-z0-9.:-]+$/;
|
|
22724
|
+
var UNSAFE = /[\r\n\0]/;
|
|
22725
|
+
var POSITIONS = {
|
|
22726
|
+
http1: (position) => HEADER.test(position),
|
|
22727
|
+
smtp: (position) => position === "auth-plain" || position === "auth-login",
|
|
22728
|
+
pg: (position) => position === "password-cleartext"
|
|
22729
|
+
};
|
|
22730
|
+
function boundHost(servername) {
|
|
22731
|
+
const lower = servername.toLowerCase();
|
|
22732
|
+
return lower.endsWith(".") ? lower.slice(0, -1) : lower;
|
|
22733
|
+
}
|
|
22734
|
+
function headOk(f) {
|
|
22735
|
+
if (f.protocol !== "http1") return f.head === void 0;
|
|
22736
|
+
const head = f.head;
|
|
22737
|
+
return head !== void 0 && typeof head.method === "string" && METHOD.test(head.method) && typeof head.path === "string" && TARGET.test(head.path);
|
|
22738
|
+
}
|
|
22739
|
+
function placeholdersOk(list) {
|
|
22740
|
+
if (!Array.isArray(list) || list.length === 0 || list.length > SESSION_PLACEHOLDERS) return false;
|
|
22741
|
+
return new Set(list).size === list.length && list.every((p) => typeof p === "string" && SESSION_PLACEHOLDER.test(p));
|
|
22742
|
+
}
|
|
22743
|
+
function hostOk(host) {
|
|
22744
|
+
return typeof host === "string" && HOST.test(host) && boundHost(host) === host;
|
|
22745
|
+
}
|
|
22746
|
+
function sessionAskable(f, now) {
|
|
22747
|
+
if (!Object.hasOwn(POSITIONS, f.protocol) || typeof f.position !== "string") return false;
|
|
22748
|
+
if (!POSITIONS[f.protocol](f.position)) return false;
|
|
22749
|
+
if (typeof f.session !== "string" || !SESSION_ID.test(f.session)) return false;
|
|
22750
|
+
if (f.verified !== true || !hostOk(f.host) || typeof f.handshakeAt !== "number") return false;
|
|
22751
|
+
if (!Number.isInteger(f.port) || f.port < 1 || f.port > 65535) return false;
|
|
22752
|
+
const age = now - f.handshakeAt;
|
|
22753
|
+
if (!Number.isFinite(age) || age < 0 || age > SESSION_WINDOW_MS) return false;
|
|
22754
|
+
return typeof f.exit === "string" && EXIT.test(f.exit) && placeholdersOk(f.placeholders) && headOk(f);
|
|
22755
|
+
}
|
|
22756
|
+
function sessionRequest(f) {
|
|
22757
|
+
return {
|
|
22758
|
+
v: 1,
|
|
22759
|
+
op: "sessionMaterialize",
|
|
22760
|
+
caller: f.stamp,
|
|
22761
|
+
stamp: f.stamp,
|
|
22762
|
+
session: f.session,
|
|
22763
|
+
host: f.host,
|
|
22764
|
+
port: f.port,
|
|
22765
|
+
protocol: f.protocol,
|
|
22766
|
+
position: f.position,
|
|
22767
|
+
verified: true,
|
|
22768
|
+
handshakeAt: f.handshakeAt,
|
|
22769
|
+
exit: f.exit,
|
|
22770
|
+
placeholders: [...f.placeholders],
|
|
22771
|
+
...f.head ? { head: { method: f.head.method, path: f.head.path } } : {}
|
|
22772
|
+
};
|
|
22773
|
+
}
|
|
22774
|
+
function sessionValues(reply, asked) {
|
|
22775
|
+
if (typeof reply !== "object" || reply === null || Array.isArray(reply)) return void 0;
|
|
22776
|
+
const { error, values } = reply;
|
|
22777
|
+
if (error !== void 0 || typeof values !== "object" || values === null) return void 0;
|
|
22778
|
+
const out = {};
|
|
22779
|
+
for (const ph of asked) {
|
|
22780
|
+
const value2 = values[ph];
|
|
22781
|
+
if (typeof value2 === "string" && value2.length > 0 && !UNSAFE.test(value2)) out[ph] = value2;
|
|
22782
|
+
}
|
|
22783
|
+
return Object.keys(out).length > 0 ? out : void 0;
|
|
22784
|
+
}
|
|
22785
|
+
|
|
22585
22786
|
// src/kernel/sealed.ts
|
|
22586
22787
|
var SEALED_MAX_BYTES = 64 * 1024;
|
|
22587
22788
|
var SEALED_TIMEOUT_MS = 1e4;
|
|
@@ -22776,6 +22977,15 @@ var SealedBroker = class {
|
|
|
22776
22977
|
};
|
|
22777
22978
|
}
|
|
22778
22979
|
async consume(fields) {
|
|
22980
|
+
const req = { ...fields, v: 1, op: "materializeConsume", caller: fields.stamp };
|
|
22981
|
+
return this.ask(req, swapOf);
|
|
22982
|
+
}
|
|
22983
|
+
async sessionMaterialize(fields, now = Date.now()) {
|
|
22984
|
+
if (!sessionAskable(fields, now)) return void 0;
|
|
22985
|
+
const req = sessionRequest(fields);
|
|
22986
|
+
return this.ask(req, (reply) => sessionValues(reply, req.placeholders));
|
|
22987
|
+
}
|
|
22988
|
+
async ask(req, parse) {
|
|
22779
22989
|
const { hook } = this;
|
|
22780
22990
|
if (!hook) return void 0;
|
|
22781
22991
|
const control = new AbortController();
|
|
@@ -22783,14 +22993,8 @@ var SealedBroker = class {
|
|
|
22783
22993
|
const stopped = new Promise((resolve2) => {
|
|
22784
22994
|
control.signal.addEventListener("abort", () => resolve2(void 0), { once: true });
|
|
22785
22995
|
});
|
|
22786
|
-
const req = {
|
|
22787
|
-
...fields,
|
|
22788
|
-
v: 1,
|
|
22789
|
-
op: "materializeConsume",
|
|
22790
|
-
caller: fields.stamp
|
|
22791
|
-
};
|
|
22792
22996
|
try {
|
|
22793
|
-
const asked = Promise.resolve().then(() => hook(req, { signal: control.signal })).then(
|
|
22997
|
+
const asked = Promise.resolve().then(() => hook(req, { signal: control.signal })).then(parse, () => void 0);
|
|
22794
22998
|
return await Promise.race([asked, stopped]);
|
|
22795
22999
|
} finally {
|
|
22796
23000
|
clearTimeout(timer);
|