@northtalk/ts 0.7.0 → 0.9.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.
Files changed (54) hide show
  1. package/{binary-value-M8v567iA.d.ts → binary-value-B93hEK7l.d.ts} +1 -1
  2. package/{checker-Coml0Tf9.js → checker-D74oYIhs.js} +21 -16
  3. package/{core-D4qYURer.d.ts → core-BBPI6EhG.d.ts} +1 -1
  4. package/{debug-C_Ob5rkl.d.ts → debug-s6QIovKS.d.ts} +18 -3
  5. package/debug.d.ts +1 -1
  6. package/debug.js +1 -1
  7. package/{driver-CLi_OmyQ.d.ts → driver-D5yrK3Nu.d.ts} +1 -1
  8. package/driver.d.ts +1 -1
  9. package/driver.js +1 -1
  10. package/{encoding-BL2ECJmg.js → encoding-DzVFpg7k.js} +2 -2
  11. package/{engine-DhBk0lTt.js → engine-Bx8B63iQ.js} +6 -6
  12. package/{engine-BBNHy4-F.d.ts → engine-Dy-BCoiw.d.ts} +2 -2
  13. package/{errors-P3ga1I-9.js → errors-CNc-xY_9.js} +35 -4
  14. package/{group-BqccKTWz.js → group-CY4FKhzT.js} +122 -54
  15. package/{http-fetch-DA-NbFIM.js → http-fetch-DnpfiOWK.js} +2 -2
  16. package/http.d.ts +1 -1
  17. package/http.js +4 -4
  18. package/index.d.ts +5 -5
  19. package/index.js +15 -15
  20. package/{lean-CFLJ9VrX.d.ts → lean-Bg_UTRj0.d.ts} +20 -5
  21. package/{lean-BJmLobmd.js → lean-DTCTJUmR.js} +10 -10
  22. package/lean.d.ts +5 -5
  23. package/lean.js +15 -15
  24. package/{manifest-37x-HSxH.js → manifest-DVS1SEmN.js} +3 -3
  25. package/message-layer.d.ts +2 -2
  26. package/message-layer.js +2 -2
  27. package/notify.d.ts +1 -1
  28. package/notify.js +1 -1
  29. package/{objects-DE6kRk0r.js → objects-OKVLH190.js} +1 -1
  30. package/{objects-DVlpWsi0.d.ts → objects-q0lnCK-4.d.ts} +2 -1
  31. package/{operations-CGjDlkGU.js → operations-B3XaG7Ve.js} +174 -54
  32. package/package.json +1 -1
  33. package/{peer-capability-elnbQy-J.js → peer-capability-3etyPHs3.js} +7 -5
  34. package/peer.d.ts +8 -1
  35. package/peer.js +29 -12
  36. package/{readers-ChQ0e92c.d.ts → readers-AeB1bJ--.d.ts} +1 -1
  37. package/{readers-yMS1eAOp.js → readers-G1lHqrPl.js} +1 -1
  38. package/{request-pump-binary-BS1J8DF2.js → request-pump-binary-VOPVqRZD.js} +9 -4
  39. package/{router-Bm7A2kjt.js → router-Bdm4KiMG.js} +4 -4
  40. package/{router-D0rf5SkW.d.ts → router-DXoJ_2Z4.d.ts} +2 -2
  41. package/session.d.ts +2 -2
  42. package/session.js +15 -15
  43. package/setup.d.ts +2 -2
  44. package/setup.js +6 -5
  45. package/sqlite.d.ts +2 -2
  46. package/sqlite.js +5 -5
  47. package/{store-D80OlpyG.js → store-BTcyKBLg.js} +2 -2
  48. package/{store-capability-DBLlWaNO.js → store-capability-CBJ6mUoH.js} +3 -3
  49. package/store.d.ts +2 -2
  50. package/store.js +2 -2
  51. package/{user-capability-D6hGa3eF.js → user-capability-DNY2dyjq.js} +3 -3
  52. package/wasm.d.ts +5 -5
  53. package/wasm.js +15 -13
  54. package/{inline-grants-BT2nnfLA.js → zone-rules-DsCJtmlC.js} +88 -5
@@ -1,13 +1,13 @@
1
1
 
2
- import { A as listValues, C as functionsBelongTo, Ct as integerOf, E as instantOf$1, F as mapOfLayout, H as quantity, K as requireArgs, L as nothing, N as map, P as mapLayout, R as num, Rt as civilFromFields, S as functionValue, U as quantityOf, Ut as formatInstant, W as range, Wt as isInstant, Y as smallCoefficient, Z as smallExponent, a as hostDetail, b as displayText, cn as builtins, ct as parseUnit, d as bytes, dn as libraryExports, et as text, f as bytesOf, h as civilOf, i as ScriptError, l as Value, ln as diagnosticCodes, n as LoadError, p as canonicalNumber, q as requireValue, r as MailboxFull, s as sendFailed, t as HostError, u as bool, un as grammar, v as dec, wt as isInteger, y as decimalParts } from "./errors-P3ga1I-9.js";
3
- import { a as rebindObject, i as propertyChecks, n as makeObject, o as stateOf$1, r as objectKind } from "./objects-DE6kRk0r.js";
4
- import { $ as arityOf, A as musicalCount, B as splice, C as isKind, Ct as mismatch, D as matchCaptures, Dt as validComputedMessageName, E as makeRange, Et as shapeDiagnostics, F as randomBound, G as cacheBuild, H as textForm, I as search, J as keysContents, K as charge, L as setKey, M as outOfRange, Mt as runTask, N as prepareConversion, O as matchesOf, Ot as validMessageSelector, P as property, Q as sizeOf, R as smallArithmetic, S as isEmpty, T as makePatternValue, U as waitUs, V as subjectText, W as wrongKind, X as rateOf, Y as partSize, Z as resetMeasured, _ as deleteKey, _t as acceptsArgumentCount, a as builtin, at as numberText, b as hasKey, c as canConvert, ct as splicesOf, d as chunkSet, dt as costModel, f as chunkThere, ft as errorMessages, g as decodeUtf8, h as convert, ht as reservedErrorKeys, i as arithmetic, it as capturesOf, j as negated, k as member, l as chunkDelete, lt as textDisplay, m as concat, mt as limitDefaults, n as ScriptError$1, nt as instructionSpec, o as builtinDefaults, ot as patternSource, p as comparison, pt as languageVersion, q as fixedRates, r as appendTo, rt as opcodes, s as byteOf, st as quantityText, t as NotImplementedError, tt as functionHead, u as chunkGet, ut as compareText, v as equals, vt as decodeShape, w as keyText, x as integerValue, xt as diagnosticRecord, y as getKey, z as smallCoefficientOf } from "./operations-CGjDlkGU.js";
5
- import { _ as viewSource, d as operationUses, g as checkDecisionCalls, n as checkSourceForLoad, t as checkSource, u as checkEffectCall } from "./checker-Coml0Tf9.js";
6
- import { a as operationsOf, c as CallMeter, r as grantData, s as invoke, t as canonicalJSON } from "./manifest-37x-HSxH.js";
2
+ import { $ as smallCoefficient, Dt as integerOf, H as num, Ht as civilFromFields, J as range, Jt as isInstant, K as quantity, L as map, O as instantOf$1, Ot as isInteger, P as listValues, R as mapLayout, S as displayText, T as functionsBelongTo, V as nothing, X as requireArgs, Z as requireValue, _ as civilOf, a as hostDetail, b as dec, d as bytes, f as bytesOf, ft as parseUnit, gn as libraryExports, h as canonicalNumber, hn as grammar, i as ScriptError, it as text, l as Value, mn as diagnosticCodes, n as LoadError, pn as builtins, q as quantityOf, qt as formatInstant, r as MailboxFull, s as sendFailed, t as HostError, tt as smallExponent, u as bool, w as functionValue, x as decimalParts, z as mapOfLayout } from "./errors-CNc-xY_9.js";
3
+ import { a as rebindObject, i as propertyChecks, n as makeObject, o as stateOf$1, r as objectKind } from "./objects-OKVLH190.js";
4
+ import { $ as arityOf, A as musicalCount, At as validMessageSelector, B as splice, C as isKind, D as matchCaptures, E as makeRange, F as randomBound, G as cacheBuild, H as textForm, I as search, J as keysContents, K as charge, L as setKey, M as outOfRange, N as prepareConversion, O as matchesOf, Ot as shapeDiagnostics, P as property, Pt as runTask, Q as sizeOf, R as smallArithmetic, S as isEmpty, St as diagnosticRecord, T as makePatternValue, Tt as mismatch, U as waitUs, V as subjectText, W as wrongKind, X as rateOf, Y as partSize, Z as resetMeasured, _ as deleteKey, _t as acceptsArgumentCount, a as builtin, at as numberText, b as hasKey, c as canConvert, ct as splicesOf, d as chunkSet, dt as costModel, f as chunkThere, ft as errorMessages, g as decodeUtf8, h as convert, ht as reservedErrorKeys, i as arithmetic, it as capturesOf, j as negated, k as member, kt as validComputedMessageName, l as chunkDelete, lt as textDisplay, m as concat, mt as limitDefaults, n as ScriptError$1, nt as instructionSpec, o as builtinDefaults, ot as patternSource, p as comparison, pt as languageVersion, q as fixedRates, r as appendTo, rt as opcodes, s as byteOf, st as quantityText, t as NotImplementedError, tt as functionHead, u as chunkGet, ut as compareText, v as equals, w as keyText, x as integerValue, y as getKey, yt as decodeShape, z as smallCoefficientOf } from "./operations-B3XaG7Ve.js";
5
+ import { _ as viewSource, d as operationUses, g as checkDecisionCalls, n as checkSourceForLoad, t as checkSource, u as checkEffectCall } from "./checker-D74oYIhs.js";
6
+ import { a as operationsOf, c as CallMeter, r as grantData, s as invoke, t as canonicalJSON } from "./manifest-DVS1SEmN.js";
7
7
  import { n as trackOperation } from "./operation-promises-ClA1BTaS.js";
8
- import { c as readDisplay } from "./readers-yMS1eAOp.js";
9
- import { l as isMusicalClock, p as standardChecks, r as MUSICAL_CLOCK } from "./encoding-BL2ECJmg.js";
10
- import { r as PEER_POST, t as PEER_CALL } from "./peer-capability-elnbQy-J.js";
8
+ import { c as readDisplay } from "./readers-G1lHqrPl.js";
9
+ import { l as isMusicalClock, p as standardChecks, r as MUSICAL_CLOCK } from "./encoding-DzVFpg7k.js";
10
+ import { r as PEER_POST, t as PEER_CALL } from "./peer-capability-3etyPHs3.js";
11
11
  import { n as sha256, r as sha256Bytes, t as Sha256 } from "./sha256-9CGf5BS_.js";
12
12
  //#region src/stdlib-registry.ts
13
13
  /** The seven stdlib Library names, which a Host may not register. */
@@ -2129,24 +2129,45 @@ const eventReads = (event, guard) => {
2129
2129
  }
2130
2130
  return out.sort((a, b) => a.start - b.start).map((entry) => entry.name);
2131
2131
  };
2132
- /** A checked Library's exports, for the Scripts and Libraries that import it. */
2132
+ const isTokenText = (element, text) => element?.kind === "token" && element.text === text;
2133
+ const declaredName = (element) => {
2134
+ while (element?.kind === "node") element = element.children[0];
2135
+ return element.text;
2136
+ };
2137
+ /**
2138
+ * A checked Library's exports, for the Scripts and Libraries that import it.
2139
+ * It reads only declaration headers, so it never converts a body.
2140
+ */
2133
2141
  const exportsOf = (tree) => {
2134
2142
  const out = {};
2135
- for (const decl of viewSource(tree.root)) {
2136
- if (decl.k !== "function" && decl.k !== "handler" && decl.k !== "constant" || decl.private || decl.k === "handler" && decl.fallback) continue;
2137
- if (decl.k === "function") out[decl.name] = {
2138
- kind: "function",
2139
- contract: {
2140
- required: decl.params.filter((param) => !param.default).length,
2141
- total: decl.params.length
2142
- }
2143
- };
2144
- else out[decl.k === "handler" ? decl.name : decl.name.text] = decl.k === "handler" ? {
2145
- kind: decl.k,
2146
- maySuspend: tree.maySuspend?.includes(decl.name) ?? false
2147
- } : {
2148
- kind: decl.k,
2149
- ...decl.shape ? { shape: true } : {}
2143
+ for (const child of tree.root.children) {
2144
+ if (child.kind !== "node" || isTokenText(child.children[0], "private")) continue;
2145
+ const first = child.children[0];
2146
+ const decl = child.rule === "Declaration" && first?.kind === "node" ? first : child;
2147
+ if (decl.rule === "Function") {
2148
+ let required = 0;
2149
+ let total = 0;
2150
+ for (const part of decl.children.slice(2)) if (part.kind === "node" && part.rule === "Parameter") {
2151
+ total++;
2152
+ required += part.children[2] ? 0 : 1;
2153
+ } else if (part.kind === "node" && part.rule === "Block" || isTokenText(part, "end")) break;
2154
+ out[declaredName(decl.children[1])] = {
2155
+ kind: "function",
2156
+ contract: {
2157
+ required,
2158
+ total
2159
+ }
2160
+ };
2161
+ } else if (decl.rule === "Handler") {
2162
+ if (isTokenText(decl.children[1], "any")) continue;
2163
+ const name = declaredName(decl.children[1]);
2164
+ out[name] = {
2165
+ kind: "handler",
2166
+ maySuspend: tree.maySuspend?.includes(name) ?? false
2167
+ };
2168
+ } else if (decl.rule === "Declaration" && (isTokenText(first, "constant") || isTokenText(first, "shape"))) out[declaredName(decl.children[1])] = {
2169
+ kind: "constant",
2170
+ ...isTokenText(first, "shape") ? { shape: true } : {}
2150
2171
  };
2151
2172
  }
2152
2173
  return out;
@@ -7421,11 +7442,13 @@ const saveSections = {
7421
7442
  inputs: 11,
7422
7443
  decisions: 12,
7423
7444
  accounting: 13,
7424
- sources: 14
7445
+ sources: 14,
7446
+ suspension: 15
7425
7447
  };
7426
7448
  const lastRequired = saveSections.accounting;
7427
- const isKnown = (tag) => tag >= 1 && tag <= saveSections.sources;
7428
- const isOptionalKnown = (tag) => tag === saveSections.sources;
7449
+ const isKnown = (tag) => tag >= 1 && tag <= saveSections.suspension;
7450
+ /** Whether a section is one of the known optional ones. */
7451
+ const isOptionalKnown = (tag) => tag === saveSections.sources || tag === saveSections.suspension;
7429
7452
  const invalidSave = () => {
7430
7453
  throw new HostError("invalid save");
7431
7454
  };
@@ -8362,6 +8385,9 @@ var RecordWriter = class {
8362
8385
  sources(ss) {
8363
8386
  this.w.list(ss, (w, s) => w.text(s.source).list(s.extensions, (w, e) => w.text(e)));
8364
8387
  }
8388
+ suspension(forbidden) {
8389
+ this.w.list(forbidden, (w, n) => w.uint(n));
8390
+ }
8365
8391
  };
8366
8392
  var RecordReader = class {
8367
8393
  r;
@@ -9101,6 +9127,9 @@ var RecordReader = class {
9101
9127
  extensions: r.list((r) => r.text())
9102
9128
  }));
9103
9129
  }
9130
+ suspension() {
9131
+ return this.r.list((r) => r.uint());
9132
+ }
9104
9133
  };
9105
9134
  //#endregion
9106
9135
  //#region src/save-state.ts
@@ -9640,6 +9669,8 @@ const openSave = (bytes) => {
9640
9669
  const skipped = valueRecords(section, tables);
9641
9670
  check(skipped);
9642
9671
  if (sources && sources.length !== skipped.scripts.length) invalidSave();
9672
+ const suspension = save.body(saveSections.suspension) ? section(saveSections.suspension, (r) => r.suspension()) : void 0;
9673
+ if (suspension && (suspension.length === 0 || suspension.some((n, i) => n >= skipped.scripts.length || i > 0 && n <= suspension[i - 1]))) invalidSave();
9643
9674
  return {
9644
9675
  language: save.language,
9645
9676
  costModel: save.costModel,
@@ -9651,6 +9682,7 @@ const openSave = (bytes) => {
9651
9682
  functions,
9652
9683
  scripts: skipped.scripts,
9653
9684
  sources,
9685
+ suspension,
9654
9686
  texts: textList,
9655
9687
  values: (io) => {
9656
9688
  const t = {
@@ -9687,7 +9719,7 @@ const writeSections = (header, io, bodies, texts = new TextTable()) => {
9687
9719
  if (body) sections.push({
9688
9720
  tag,
9689
9721
  body,
9690
- optional: tag === saveSections.sources
9722
+ optional: isOptionalKnown(tag)
9691
9723
  });
9692
9724
  }
9693
9725
  return writeSave(header, sections);
@@ -10840,7 +10872,8 @@ const encodeGroup = (g) => {
10840
10872
  ...g.sources === "embedded" ? { sources: (w) => w.sources(g.scripts.map((s) => ({
10841
10873
  source: s.units[0].source,
10842
10874
  extensions: s.units.slice(1).map((u) => u.source)
10843
- }))) } : {}
10875
+ }))) } : {},
10876
+ ...g.scripts.some((s) => s.forbidSuspension) ? { suspension: (w) => w.suspension(g.scripts.flatMap((s, i) => s.forbidSuspension ? [i] : [])) } : {}
10844
10877
  });
10845
10878
  };
10846
10879
  const compareBytes = (a, b) => a < b ? -1 : a > b ? 1 : 0;
@@ -11252,6 +11285,8 @@ var TsGroup = class TsGroup {
11252
11285
  accounting = emptyAccounting();
11253
11286
  discardReason = "stop";
11254
11287
  inputs = [];
11288
+ urgentInputs = 0;
11289
+ chargeInputs = 0;
11255
11290
  deliveries = 0;
11256
11291
  broadcasts = 0;
11257
11292
  /**
@@ -11430,7 +11465,7 @@ var TsGroup = class TsGroup {
11430
11465
  debugEvaluate(body, frameIndex) {
11431
11466
  const pause = this.debugController.current;
11432
11467
  const s = this.scripts.find((x) => x.name === pause.script);
11433
- const frames = this.runsOf(s).find((r) => r.id === pause.run).run.debugFrames();
11468
+ const frames = this.findRun(s, (r) => r.id === pause.run).run.debugFrames();
11434
11469
  const view = frames[frameIndex ?? frames.length - 1];
11435
11470
  if (!view) return { error: `There is no frame ${frameIndex}` };
11436
11471
  const valueOf = (name) => {
@@ -11533,14 +11568,15 @@ var TsGroup = class TsGroup {
11533
11568
  reply: (id, reply) => this.settleReply(id, reply)
11534
11569
  });
11535
11570
  }
11536
- /** Worker. A Fingerprint covers code, declarations and limits, never state. */
11571
+ /** Worker. A Fingerprint covers code, declarations, limits and `forbidSuspension`, never state. */
11537
11572
  fingerprint() {
11538
11573
  this.worker();
11539
11574
  const scripts = [...this.scripts].sort(byName).map((s) => ({
11540
11575
  name: s.name,
11541
11576
  identity: s.identity,
11542
11577
  grants: Object.fromEntries([...s.grants].sort(([a], [b]) => compareNames(a, b)).map(([name, grant]) => [name, grantData(grant)])),
11543
- limits: Object.fromEntries(Object.keys(defaultLimits).map((name) => [name, s.limits[name]]))
11578
+ limits: Object.fromEntries(Object.keys(defaultLimits).map((name) => [name, s.limits[name]])),
11579
+ ...s.forbidSuspension ? { forbidSuspension: true } : {}
11544
11580
  }));
11545
11581
  return hexBytes(sha256(canonicalJSON({
11546
11582
  language: languageVersion,
@@ -11572,7 +11608,7 @@ var TsGroup = class TsGroup {
11572
11608
  return stateFingerprint(this.snapshot());
11573
11609
  }
11574
11610
  effectsPending() {
11575
- return this.effectStateUnknown || this.charges.length > 0 || this.waits.awaitedCalls(() => this.holders(), compareCallIds).some(([id]) => this.issuedEligibility(id) === true) || this.scripts.some((s) => this.runsOf(s).some((r) => r.run.hasOpenScopes || r.run.hasParticipant));
11611
+ return this.effectStateUnknown || this.charges.length > 0 || this.waits.awaitedCalls(() => this.holders(), compareCallIds).some(([id]) => this.issuedEligibility(id) === true) || this.scripts.some((s) => !!this.findRun(s, (r) => r.run.hasOpenScopes || r.run.hasParticipant));
11576
11612
  }
11577
11613
  snapshot() {
11578
11614
  return {
@@ -11679,6 +11715,7 @@ var TsGroup = class TsGroup {
11679
11715
  group.load({
11680
11716
  name: script.name,
11681
11717
  source: sources[0],
11718
+ forbidSuspension: save.suspension?.includes(i) === true,
11682
11719
  limits: limitsOf(script.limits),
11683
11720
  grants,
11684
11721
  owner: script.owner === void 0 ? void 0 : objects[script.owner].handle,
@@ -12172,7 +12209,7 @@ var TsGroup = class TsGroup {
12172
12209
  for (const s of this.scripts) s.incoming = 0;
12173
12210
  } else {
12174
12211
  this.importWaits(state, restored);
12175
- this.inputs = inputs;
12212
+ this.setInputs(inputs);
12176
12213
  for (const x of restored) {
12177
12214
  if (partial && changed.has(x.s.name)) continue;
12178
12215
  x.running.run.validateSnapshot(this.knownCode());
@@ -12575,9 +12612,9 @@ var TsGroup = class TsGroup {
12575
12612
  const code = eligible === void 0 ? "unknown call" : !valid || !eligible || this.charges.some((q) => q.call === call) ? "invalid value" : null;
12576
12613
  if (code) {
12577
12614
  const line = recordLine("charge-request", [call], [["fuel", valid ? String(fuel) : "\"invalid\""]], true);
12578
- if (this.inputs.some((i) => !i.urgent && i.action.k === "charge")) {
12615
+ if (this.chargeInputs > 0) {
12579
12616
  this.combinedAdmission = false;
12580
- this.inputs.push({
12617
+ this.pushInput({
12581
12618
  line,
12582
12619
  action: {
12583
12620
  k: "refusal",
@@ -12802,13 +12839,13 @@ var TsGroup = class TsGroup {
12802
12839
  break;
12803
12840
  case "cancel-run": {
12804
12841
  const s = this.scripts.find((s) => s.name === action.name);
12805
- const running = this.runsOf(s).find((r) => r.id === action.id);
12842
+ const running = this.findRun(s, (r) => r.id === action.id);
12806
12843
  if (running) this.cancelRunning(s, running);
12807
12844
  break;
12808
12845
  }
12809
12846
  case "rewind-run": {
12810
12847
  const s = this.scripts.find((s) => s.name === action.name);
12811
- const running = this.runsOf(s).find((r) => r.id === action.id);
12848
+ const running = this.findRun(s, (r) => r.id === action.id);
12812
12849
  if (running?.run.rewindable && !s.stopped) this.rewindRunning(s, running);
12813
12850
  else this.trace?.(recordLine("note", [action.id], [["kind", "not-rewindable"]]));
12814
12851
  break;
@@ -12872,11 +12909,19 @@ var TsGroup = class TsGroup {
12872
12909
  }
12873
12910
  }
12874
12911
  runsOf(s) {
12875
- return [
12876
- ...s.queue.filter((item) => "run" in item),
12877
- ...s.suspended,
12878
- ...s.parked
12879
- ].sort((a, b) => Number(a.id.split("/r")[1]) - Number(b.id.split("/r")[1]));
12912
+ const runs = [];
12913
+ for (const item of s.queue) if ("run" in item) runs.push(item);
12914
+ runs.push(...s.suspended, ...s.parked);
12915
+ if (runs.length < 2) return runs;
12916
+ return runs.map((r) => ({
12917
+ n: Number(r.id.split("/r")[1]),
12918
+ r
12919
+ })).sort((a, b) => a.n - b.n).map((x) => x.r);
12920
+ }
12921
+ findRun(s, match) {
12922
+ for (const item of s.queue) if ("run" in item && match(item)) return item;
12923
+ for (const r of s.suspended) if (match(r)) return r;
12924
+ return s.parked.find(match);
12880
12925
  }
12881
12926
  forgetWait(s, running) {
12882
12927
  s.suspended.delete(running);
@@ -13066,7 +13111,7 @@ var TsGroup = class TsGroup {
13066
13111
  }
13067
13112
  recordRefusal(line, code) {
13068
13113
  this.combinedAdmission = false;
13069
- if (this.pumping) this.inputs.push({
13114
+ if (this.pumping) this.pushInput({
13070
13115
  line,
13071
13116
  urgent: true,
13072
13117
  action: {
@@ -13079,10 +13124,22 @@ var TsGroup = class TsGroup {
13079
13124
  this.trace?.(recordLine("refused", [], [["code", JSON.stringify(code)]]));
13080
13125
  }
13081
13126
  }
13127
+ pushInput(input) {
13128
+ this.inputs.push(input);
13129
+ if (input.urgent) this.urgentInputs++;
13130
+ else if (input.action.k === "charge") this.chargeInputs++;
13131
+ }
13132
+ setInputs(inputs) {
13133
+ this.inputs = [];
13134
+ this.urgentInputs = 0;
13135
+ this.chargeInputs = 0;
13136
+ for (const input of inputs) this.pushInput(input);
13137
+ }
13082
13138
  landUrgentInputs() {
13083
- while (this.inputs.some((i) => i.urgent)) {
13139
+ while (this.urgentInputs > 0) {
13084
13140
  const urgent = this.inputs.filter((i) => i.urgent);
13085
13141
  this.inputs = this.inputs.filter((i) => !i.urgent);
13142
+ this.urgentInputs = 0;
13086
13143
  for (const input of urgent) {
13087
13144
  if (this.trace) this.trace(typeof input.line === "string" ? input.line : input.line());
13088
13145
  this.applyInput(input.action);
@@ -13116,7 +13173,7 @@ var TsGroup = class TsGroup {
13116
13173
  queueInput(input, notify = true) {
13117
13174
  const landing = this.debugController?.current;
13118
13175
  if (landing && (input.action.k === "stop" || input.action.k === "cancel-run" || input.action.k === "rewind-run") && typeof input.line === "string") input.line += ` pc=${landing.pc}`;
13119
- this.inputs.push(input);
13176
+ this.pushInput(input);
13120
13177
  if (!notify) return;
13121
13178
  if (this.onReady) {
13122
13179
  if (this.pumping || this.cleaning) queueMicrotask(() => this.onReady?.());
@@ -13184,7 +13241,10 @@ var TsGroup = class TsGroup {
13184
13241
  const grants = new Map(Object.entries(o.grants ?? {}));
13185
13242
  if (grants.has("musical-clock")) throw new HostError("invalid value", `${MUSICAL_CLOCK} is the Group's own Grant name`);
13186
13243
  if ([...grants.values()].filter((g) => g.capability.name === "peer").length > 1) throw new HostError("invalid value", `Script ${o.name} has more than one peer Grant`);
13187
- const p = prepare("script", o.name, o.source, this.libraries, objects, declarationsOf(grants), void 0, propertyChecks(o.objects ?? {}, o.owner));
13244
+ const p = prepare("script", o.name, o.source, this.libraries, objects, declarationsOf(grants), void 0, {
13245
+ ...propertyChecks(o.objects ?? {}, o.owner),
13246
+ forbidSuspension: o.forbidSuspension === true
13247
+ });
13188
13248
  this.trace?.(recordLine("load", [o.name], [["identity", p.identity]], true));
13189
13249
  const limits = {
13190
13250
  ...defaultLimits,
@@ -13208,6 +13268,7 @@ var TsGroup = class TsGroup {
13208
13268
  grants: kept,
13209
13269
  revoked: /* @__PURE__ */ new Set(),
13210
13270
  disabled: /* @__PURE__ */ new Set(),
13271
+ forbidSuspension: o.forbidSuspension === true,
13211
13272
  handle,
13212
13273
  loaded,
13213
13274
  identity: p.identity,
@@ -13254,7 +13315,10 @@ var TsGroup = class TsGroup {
13254
13315
  }
13255
13316
  replacement(s, source, carry, libraries = this.libraries, extensions = [], keepMailbox = false) {
13256
13317
  const grants = availableGrants(s);
13257
- const p = prepare("script", s.name, source, libraries, Object.keys(s.objects), declarationsOf(grants), void 0, propertyChecks(s.objects, s.owner?.handle));
13318
+ const p = prepare("script", s.name, source, libraries, Object.keys(s.objects), declarationsOf(grants), void 0, {
13319
+ ...propertyChecks(s.objects, s.owner?.handle),
13320
+ forbidSuspension: s.forbidSuspension
13321
+ });
13258
13322
  const loaded = this.loadPrepared(s.name, p, s.limits);
13259
13323
  const staged = {
13260
13324
  ...s,
@@ -13341,7 +13405,10 @@ var TsGroup = class TsGroup {
13341
13405
  }
13342
13406
  }
13343
13407
  }
13344
- const p = prepare("script", name, source, libraries, Object.keys(s.objects), declarationsOf(availableGrants(s)), existing, propertyChecks(s.objects, s.owner?.handle));
13408
+ const p = prepare("script", name, source, libraries, Object.keys(s.objects), declarationsOf(availableGrants(s)), existing, {
13409
+ ...propertyChecks(s.objects, s.owner?.handle),
13410
+ forbidSuspension: s.forbidSuspension
13411
+ });
13345
13412
  const identity = codeIdentity("extension", s.name, source, p.imports.map(identityOf));
13346
13413
  const diagnostics = [...p.diagnostics ?? []];
13347
13414
  if (p.checked.tree) {
@@ -13545,7 +13612,7 @@ var TsGroup = class TsGroup {
13545
13612
  group,
13546
13613
  disableGrant: (name) => {
13547
13614
  s.disabled.add(name);
13548
- const running = this.runsOf(s).find((r) => r.run === run);
13615
+ const running = this.findRun(s, (r) => r.run === run);
13549
13616
  if (running) this.writeRecords(running, 0);
13550
13617
  },
13551
13618
  isDisabled: (name) => s.disabled.has(name),
@@ -14185,7 +14252,7 @@ var TsGroup = class TsGroup {
14185
14252
  this.objects.set(key, state);
14186
14253
  if (up && this.trace) {
14187
14254
  const line = recordLine("object", [], [["object", traceValue(state.handle.value)], ["parent", traceValue(up.handle.value)]]);
14188
- if (this.pumping) this.inputs.push({
14255
+ if (this.pumping) this.pushInput({
14189
14256
  line,
14190
14257
  urgent: true,
14191
14258
  action: { k: "record" }
@@ -14333,7 +14400,7 @@ var TsGroup = class TsGroup {
14333
14400
  const slice = o.fuelSlice ?? 0;
14334
14401
  const cap = o.fuelCap ?? 0;
14335
14402
  const drained = this.inputs;
14336
- this.inputs = [];
14403
+ this.setInputs([]);
14337
14404
  const reports = [];
14338
14405
  this.drainReports = reports;
14339
14406
  const inputLines = [];
@@ -14990,7 +15057,7 @@ var TsGroup = class TsGroup {
14990
15057
  }
14991
15058
  releaseParked(s, ended) {
14992
15059
  const same = (r) => !r.delivery.fn && !ended.delivery.fn && sameClause(r, ended);
14993
- if (this.runsOf(s).some((r) => !r.parked && same(r))) return;
15060
+ if (this.findRun(s, (r) => !r.parked && same(r))) return;
14994
15061
  const next = s.parked.find(same);
14995
15062
  if (!next) return;
14996
15063
  s.parked = s.parked.filter((r) => r !== next);
@@ -15045,7 +15112,7 @@ var TsGroup = class TsGroup {
15045
15112
  return { scripts: this.inspection().scripts.map((s, i) => ({
15046
15113
  ...s,
15047
15114
  runs: s.runs.map((view) => {
15048
- const run = this.runsOf(this.scripts[i]).find((r) => r.id === view.id).run;
15115
+ const run = this.findRun(this.scripts[i], (r) => r.id === view.id).run;
15049
15116
  return {
15050
15117
  ...view,
15051
15118
  fuel: run.fuel,
@@ -15081,6 +15148,7 @@ var TsGroup = class TsGroup {
15081
15148
  return {
15082
15149
  name: s.name,
15083
15150
  ...s.disabled.size ? { disabledGrants: [...s.disabled].sort(compareText) } : {},
15151
+ ...s.forbidSuspension ? { forbidSuspension: true } : {},
15084
15152
  vars,
15085
15153
  runs: this.runsOf(s).map((item) => ({
15086
15154
  id: item.id,
@@ -1,6 +1,6 @@
1
1
 
2
- import { A as listValues, L as nothing, N as map, Qt as characterBoundaries, R as num, et as text, i as ScriptError, o as invalidValue, q as requireValue, rn as normalizeNFC, u as bool, v as dec } from "./errors-P3ga1I-9.js";
3
- import { ft as errorMessages, n as ScriptError$1 } from "./operations-CGjDlkGU.js";
2
+ import { H as num, L as map, P as listValues, V as nothing, Z as requireValue, b as dec, i as ScriptError, it as text, nn as characterBoundaries, o as invalidValue, sn as normalizeNFC, u as bool } from "./errors-CNc-xY_9.js";
3
+ import { ft as errorMessages, n as ScriptError$1 } from "./operations-B3XaG7Ve.js";
4
4
  //#region src/json.ts
5
5
  var JsonReader = class {
6
6
  source;
package/http.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  /// <reference lib="esnext.disposable" />
2
- import { $t as Group, J as Value, gt as ObjectKindDef, ht as ObjectKind, on as HttpClientImpl, sn as HttpImpl, x as PumpResult } from "./debug-C_Ob5rkl.js";
2
+ import { J as Value, cn as HttpClientImpl, gt as ObjectKindDef, ht as ObjectKind, ln as HttpImpl, tn as Group, x as PumpResult } from "./debug-s6QIovKS.js";
3
3
  import { Buffer } from "node:buffer";
4
4
  //#region src/http/fetch.d.ts
5
5
  /** The largest response body `fetch` reads by default: 8 MiB. */
package/http.js CHANGED
@@ -1,8 +1,8 @@
1
1
 
2
- import { A as listValues, N as map, R as num, d as bytes, et as text, i as ScriptError, t as HostError, u as bool } from "./errors-P3ga1I-9.js";
3
- import { t as defineObjectKind } from "./objects-DE6kRk0r.js";
4
- import { Tt as shape } from "./operations-CGjDlkGU.js";
5
- import { a as parseFetchUrl, i as fetchOrigin } from "./http-fetch-DA-NbFIM.js";
2
+ import { H as num, L as map, P as listValues, d as bytes, i as ScriptError, it as text, t as HostError, u as bool } from "./errors-CNc-xY_9.js";
3
+ import { t as defineObjectKind } from "./objects-OKVLH190.js";
4
+ import { Dt as shape } from "./operations-B3XaG7Ve.js";
5
+ import { a as parseFetchUrl, i as fetchOrigin } from "./http-fetch-DnpfiOWK.js";
6
6
  import { Buffer } from "node:buffer";
7
7
  import { createServer, request } from "node:http";
8
8
  import { request as request$1 } from "node:https";
package/index.d.ts CHANGED
@@ -1,8 +1,8 @@
1
1
  /// <reference lib="esnext.disposable" />
2
- import { $ as instant, $n as waitUs, $t as Group, A as ScriptSources, An as consoleCapability, Ar as Mode, At as FireOp, B as restore, Bn as LimitName, Bt as ReleaseHook, C as Report, Cn as CalendarImpl, Cr as SemanticName, Ct as ChargeRequest, Dn as TimerImpl, Dr as SemanticTree, Dt as EffectResult, E as RestoreResult, En as MusicalClockImpl, Er as SemanticToken, Et as Cost, Fn as LibrarySource, Fr as SyntaxNode, Ft as Metering, G as RunStarted, Gn as Script, Gt as SegmentGrant, H as RunAccounting, Hn as Outcome, Ht as ScopeDecl, In as OperationRef, Ir as SyntaxRule, It as Operation, J as Value, Jn as defaultLimits, Jt as SuspendingOp, K as Decimal, Kn as UnitLoadError, Kt as SegmentLifecycle, L as TsScript, Ln as codeIdentity, Lr as Trivia, Lt as Operations, Mn as timerCapability, Mr as Token, Mt as GrantContext, N as Settlement, Nn as Library, Nr as SyntaxElement, Nt as ImmediateOp, O as SaveOptions, On as calendarCapability, Or as SourceSpan, Ot as ErrorDecl, P as TsGroup, Pn as LibraryOptions, Pr as SyntaxErrorCode, Pt as LimitReached, Q as dec, Qn as canConvert, Qt as Core, R as Verdict, Rn as compileLibrary, Rr as syntaxSelector, Rt as PlainArg, S as PumpedRequest, Sn as localeCapability, Sr as SemanticElement, St as CapabilityDefiner, T as RestoreOptions, Tn as Costs, Tr as SemanticScope, Tt as CoordinatedLifecycle, U as RunAncestry, Un as Run, Ut as SegmentContext, V as CausalWork, Vn as Limits, Vt as ReleaseReason, W as RunDiscarded, Wn as RunRecord, Wt as SegmentCoordinator, X as bytes, Xn as loadScript, Xt as operationDeclarations, Y as bool, Yn as deliver, Yt as defineCapability, Z as civilDate, Zn as NotImplementedError, Zt as shape, _ as LoadOptions, _n as SqlValue, _r as BindingKind, _t as PropDef, an as peerKind, ar as ScriptError, at as quantity, b as PumpOptions, bn as sqliteCapability, br as LibraryExport, bt as Call, cn as HttpServerImpl, cr as BodyKind, d as Counters, dn as userCapability, dr as EventEntry, dt as nowMicros, en as Script$1, er as HostError, f as Decided, fn as StoreImpl, fr as Instruction, ft as parseInstant, g as Inspection, gn as SqlRows, gr as Binding, gt as ObjectKindDef, h as GroupOptions, hn as SqlParams, hr as disassemble, ht as ObjectKind, in as peerCapability, ir as MailboxFull, it as num, jn as musicalClockCapability, jr as TokType, jt as Grant, k as ScriptCodeRequest, kn as clockCapability, kr as Lexer, kt as FieldShape, l as CancellationOptions, ln as httpCapability, lr as CodeUnit, lt as text, m as EffectFailure, mn as storeCapability, mr as UnwindEntry, mt as ObjectElements, nn as coreVersions, nr as LoadDiagnostic, nt as map, on as HttpClientImpl, or as SendFailedReason, ot as range, p as Deciding, pn as add, pr as Operand, pt as HostObject, q as Kind, qn as callFunction, qt as Shape, rn as PeerImpl, rr as LoadError, rt as nothing, sn as HttpImpl, sr as Body, st as record, tn as Versions, tr as HostErrorCode, tt as list, u as CarryOver, un as UserImpl, ur as EventBranch, ut as formatInstant, v as Message, vn as SqliteBinding, vr as ExportKind, vt as defineObjectKind, w as Requested, wn as ConsoleImpl, wr as SemanticNode, wt as ChargeResult, x as PumpResult, xn as LocaleImpl, xr as NameRole, xt as CapabilityDef, y as PendingCall, yn as SqliteImpl, yr as FunctionContract, yt as GrantDecls, z as newGroup, zr as syntaxText, zt as PlainResult } from "./debug-C_Ob5rkl.js";
2
+ import { $ as instant, $n as NotImplementedError, $t as shape, A as ScriptSources, An as calendarCapability, Ar as SourceSpan, At as FireOp, B as restore, Bn as compileLibrary, Br as syntaxSelector, Bt as ReleaseHook, C as Report, Cn as LocaleImpl, Cr as NameRole, Ct as ChargeRequest, Dn as Costs, Dr as SemanticScope, Dt as EffectResult, E as RestoreResult, En as ConsoleImpl, Er as SemanticNode, Et as Cost, Fn as Library, Fr as SyntaxElement, Ft as Metering, G as RunStarted, Gn as Run, Gt as SegmentGrant, H as RunAccounting, Hn as LimitName, Ht as ScopeDecl, In as LibraryOptions, Ir as SyntaxErrorCode, It as Operation, J as Value, Jn as UnitLoadError, Jt as SuspendingOp, K as Decimal, Kn as RunRecord, Kt as SegmentLifecycle, L as TsScript, Ln as LibrarySource, Lr as SyntaxNode, Lt as Operations, Mn as consoleCapability, Mr as Mode, Mt as GrantContext, N as Settlement, Nn as musicalClockCapability, Nr as TokType, Nt as ImmediateOp, O as SaveOptions, On as MusicalClockImpl, Or as SemanticToken, Ot as ErrorDecl, P as TsGroup, Pn as timerCapability, Pr as Token, Pt as LimitReached, Q as dec, Qn as loadScript, Qt as operationDeclarations, R as Verdict, Rn as OperationRef, Rr as SyntaxRule, Rt as PlainArg, S as PumpedRequest, Sn as sqliteCapability, Sr as LibraryExport, St as CapabilityDefiner, T as RestoreOptions, Tn as CalendarImpl, Tr as SemanticName, Tt as CoordinatedLifecycle, U as RunAncestry, Un as Limits, Ut as SegmentContext, V as CausalWork, Vr as syntaxText, Vt as ReleaseReason, W as RunDiscarded, Wn as Outcome, Wt as SegmentCoordinator, X as bytes, Xn as defaultLimits, Xt as defineCapability, Y as bool, Yn as callFunction, Yt as conforms, Z as civilDate, Zn as deliver, Zt as explain, _ as LoadOptions, _n as SqlParams, _r as disassemble, _t as PropDef, an as PeerImpl, ar as LoadError, at as quantity, b as PumpOptions, bn as SqliteBinding, br as ExportKind, bt as Call, cn as HttpClientImpl, cr as SendFailedReason, d as Counters, dn as httpCapability, dr as CodeUnit, dt as nowMicros, en as Core, er as canConvert, f as Decided, fn as UserImpl, fr as EventBranch, ft as parseInstant, g as Inspection, gn as storeCapability, gr as UnwindEntry, gt as ObjectKindDef, h as GroupOptions, hn as add, hr as Operand, ht as ObjectKind, in as coreVersions, ir as LoadDiagnostic, it as num, jn as clockCapability, jr as Lexer, jt as Grant, k as ScriptCodeRequest, kn as TimerImpl, kr as SemanticTree, kt as FieldShape, l as CancellationOptions, ln as HttpImpl, lr as Body, lt as text, m as EffectFailure, mn as StoreImpl, mr as Instruction, mt as ObjectElements, nn as Script$1, nr as HostError, nt as map, on as peerCapability, or as MailboxFull, ot as range, p as Deciding, pn as userCapability, pr as EventEntry, pt as HostObject, q as Kind, qn as Script, qt as Shape, rn as Versions, rr as HostErrorCode, rt as nothing, sn as peerKind, sr as ScriptError, st as record, tn as Group, tr as waitUs, tt as list, u as CarryOver, un as HttpServerImpl, ur as BodyKind, ut as formatInstant, v as Message, vn as SqlRows, vr as Binding, vt as defineObjectKind, w as Requested, wn as localeCapability, wr as SemanticElement, wt as ChargeResult, x as PumpResult, xn as SqliteImpl, xr as FunctionContract, xt as CapabilityDef, y as PendingCall, yn as SqlValue, yr as BindingKind, yt as GrantDecls, z as newGroup, zn as codeIdentity, zr as Trivia, zt as PlainResult } from "./debug-s6QIovKS.js";
3
3
  import { n as registerStdlib, r as stdlibNames, t as StdlibLibrary } from "./stdlib-registry-BwitI3Ox.js";
4
- import { $ as units, A as PlainValue, B as checkSource, C as decodeJson, D as kindNames, E as shapeData, F as CheckOptions, G as ParseResult, H as EntryKind, I as CheckResult, J as parseEntry, K as RecoveringParseResult, L as Diagnostic, M as fromValue, N as toValue, O as encodeValue, P as talk, Q as grammar, R as DiagnosticCode, S as handlersOf, T as ShapeData, U as EntryResult, V as checkSyntax, W as ParseError, X as parseSourceRecovering, Y as parseSource, Z as builtins, a as LoweringError, b as Handlers, c as lowerTree, d as exportManifest, f as InlineFunction, g as createGroup, h as CreateGroupOptions, i as CompileResult, j as ToValueOptions, k as FromValueOptions, l as ManifestSpec, m as inlineGrants, n as declarationStart, o as compileSource, p as InlineOperation, q as RecoveryDiagnostic, r as CompileOptions, s as exportsOf, t as validMessageSelector, u as MessageDecl, v as DrivenGroup, w as encodeJson, x as ScriptWithHandlers, z as SemanticResult } from "./lean-CFLJ9VrX.js";
5
- import { n as createCore, t as TsCore } from "./core-D4qYURer.js";
6
- import { a as decodeValue, o as readDisplay, t as FunctionResolver } from "./readers-ChQ0e92c.js";
4
+ import { $ as grammar, A as FromValueOptions, B as SemanticResult, C as handlersOf, D as shapeData, E as ShapeData, F as talk, G as ParseError, H as checkSyntax, I as CheckOptions, J as RecoveryDiagnostic, K as ParseResult, L as CheckResult, M as ToValueOptions, N as fromValue, O as kindNames, P as toValue, Q as builtins, R as Diagnostic, S as ScriptWithHandlers, T as encodeJson, U as EntryKind, V as checkSource, W as EntryResult, X as parseSource, Y as parseEntry, Z as parseSourceRecovering, _ as createGroup, a as LoweringError, c as lowerTree, d as exportManifest, et as units, f as zoneRules, g as CreateGroupOptions, h as inlineGrants, i as CompileResult, j as PlainValue, k as encodeValue, l as ManifestSpec, m as InlineOperation, n as declarationStart, o as compileSource, p as InlineFunction, q as RecoveringParseResult, r as CompileOptions, s as exportsOf, t as validMessageSelector, u as MessageDecl, w as decodeJson, x as Handlers, y as DrivenGroup, z as DiagnosticCode } from "./lean-Bg_UTRj0.js";
5
+ import { n as createCore, t as TsCore } from "./core-BBPI6EhG.js";
6
+ import { a as decodeValue, o as readDisplay, t as FunctionResolver } from "./readers-AeB1bJ--.js";
7
7
  import { n as stdlibSources, t as allStdlib } from "./index-CBuczWK0.js";
8
- export { type Binding, type BindingKind, type Body, type BodyKind, type CalendarImpl, type Call, type CancellationOptions, type CapabilityDef, type CapabilityDefiner, type CarryOver, type CausalWork, type ChargeRequest, type ChargeResult, type CheckOptions, type CheckResult, type CodeUnit, type CompileOptions, type CompileResult, Script as CompiledScript, type ConsoleImpl, type CoordinatedLifecycle, type Core, type Cost, type Costs, type Counters, type CreateGroupOptions, type Decided, type Deciding, Decimal, type Diagnostic, type DiagnosticCode, type DrivenGroup, type EffectFailure, type EffectResult, type EntryKind, type EntryResult, type ErrorDecl, type EventBranch, type EventEntry, type ExportKind, type FieldShape, type FireOp, type FromValueOptions, type FunctionContract, type FunctionResolver, type Grant, type GrantContext, type GrantDecls, type Group, type GroupOptions, type Handlers, HostError, type HostErrorCode, type HostObject, type HttpClientImpl, type HttpImpl, type HttpServerImpl, type ImmediateOp, type InlineFunction, type InlineOperation, type Inspection, type Instruction, type Kind, Lexer, type Library, type LibraryExport, type LibraryOptions, type LibrarySource, type LimitName, LimitReached, type Limits, type LoadDiagnostic, LoadError, type LoadOptions, type LocaleImpl, LoweringError, MailboxFull, type ManifestSpec, type Message, type MessageDecl, type Metering, type Mode, type MusicalClockImpl, type NameRole, NotImplementedError, type ObjectElements, type ObjectKind, type ObjectKindDef, type Operand, type Operation, type OperationRef, type Operations, type Outcome, ParseError, type ParseResult, type PeerImpl, type PendingCall, type PlainArg, type PlainResult, type PlainValue, type PropDef, type PumpOptions, type PumpResult, type PumpedRequest, type RecoveringParseResult, type RecoveryDiagnostic, type ReleaseHook, type ReleaseReason, type Report, type Requested, type RestoreOptions, type RestoreResult, Run, type RunAccounting, type RunAncestry, type RunDiscarded, type RunRecord, type RunStarted, type SaveOptions, type ScopeDecl, type Script$1 as Script, type ScriptCodeRequest, ScriptError, type ScriptSources, type ScriptWithHandlers, type SegmentContext, type SegmentCoordinator, type SegmentGrant, type SegmentLifecycle, type SemanticElement, type SemanticName, type SemanticNode, type SemanticResult, type SemanticScope, type SemanticToken, type SemanticTree, type SendFailedReason, type Settlement, type Shape, type ShapeData, type SourceSpan, type SqlParams, type SqlRows, type SqlValue, type SqliteBinding, type SqliteImpl, type StdlibLibrary, type StoreImpl, type SuspendingOp, type SyntaxElement, type SyntaxErrorCode, type SyntaxNode, type SyntaxRule, type TimerImpl, type ToValueOptions, type TokType, type Token, type Trivia, type TsCore, TsGroup, TsScript, UnitLoadError, type UnwindEntry, type UserImpl, Value, type Verdict, type Versions, add, allStdlib, bool, builtins, bytes, calendarCapability, callFunction, canConvert, checkSource, checkSyntax, civilDate, clockCapability, codeIdentity, compileLibrary, compileSource, consoleCapability, coreVersions, createCore, createGroup, dec, declarationStart, decodeJson, decodeValue, defaultLimits, defineCapability, defineObjectKind, deliver, disassemble, encodeJson, encodeValue, exportManifest, exportsOf, formatInstant, fromValue, grammar, handlersOf, httpCapability, inlineGrants, instant, kindNames, list, loadScript, localeCapability, lowerTree, map, musicalClockCapability, newGroup, nothing, nowMicros, num, operationDeclarations, parseEntry, parseInstant, parseSource, parseSourceRecovering, peerCapability, peerKind, quantity, range, readDisplay, record, registerStdlib, restore, shape, shapeData, sqliteCapability, stdlibNames, stdlibSources, storeCapability, syntaxSelector, syntaxText, talk, text, timerCapability, toValue, units, userCapability, validMessageSelector, waitUs };
8
+ export { type Binding, type BindingKind, type Body, type BodyKind, type CalendarImpl, type Call, type CancellationOptions, type CapabilityDef, type CapabilityDefiner, type CarryOver, type CausalWork, type ChargeRequest, type ChargeResult, type CheckOptions, type CheckResult, type CodeUnit, type CompileOptions, type CompileResult, Script as CompiledScript, type ConsoleImpl, type CoordinatedLifecycle, type Core, type Cost, type Costs, type Counters, type CreateGroupOptions, type Decided, type Deciding, Decimal, type Diagnostic, type DiagnosticCode, type DrivenGroup, type EffectFailure, type EffectResult, type EntryKind, type EntryResult, type ErrorDecl, type EventBranch, type EventEntry, type ExportKind, type FieldShape, type FireOp, type FromValueOptions, type FunctionContract, type FunctionResolver, type Grant, type GrantContext, type GrantDecls, type Group, type GroupOptions, type Handlers, HostError, type HostErrorCode, type HostObject, type HttpClientImpl, type HttpImpl, type HttpServerImpl, type ImmediateOp, type InlineFunction, type InlineOperation, type Inspection, type Instruction, type Kind, Lexer, type Library, type LibraryExport, type LibraryOptions, type LibrarySource, type LimitName, LimitReached, type Limits, type LoadDiagnostic, LoadError, type LoadOptions, type LocaleImpl, LoweringError, MailboxFull, type ManifestSpec, type Message, type MessageDecl, type Metering, type Mode, type MusicalClockImpl, type NameRole, NotImplementedError, type ObjectElements, type ObjectKind, type ObjectKindDef, type Operand, type Operation, type OperationRef, type Operations, type Outcome, ParseError, type ParseResult, type PeerImpl, type PendingCall, type PlainArg, type PlainResult, type PlainValue, type PropDef, type PumpOptions, type PumpResult, type PumpedRequest, type RecoveringParseResult, type RecoveryDiagnostic, type ReleaseHook, type ReleaseReason, type Report, type Requested, type RestoreOptions, type RestoreResult, Run, type RunAccounting, type RunAncestry, type RunDiscarded, type RunRecord, type RunStarted, type SaveOptions, type ScopeDecl, type Script$1 as Script, type ScriptCodeRequest, ScriptError, type ScriptSources, type ScriptWithHandlers, type SegmentContext, type SegmentCoordinator, type SegmentGrant, type SegmentLifecycle, type SemanticElement, type SemanticName, type SemanticNode, type SemanticResult, type SemanticScope, type SemanticToken, type SemanticTree, type SendFailedReason, type Settlement, type Shape, type ShapeData, type SourceSpan, type SqlParams, type SqlRows, type SqlValue, type SqliteBinding, type SqliteImpl, type StdlibLibrary, type StoreImpl, type SuspendingOp, type SyntaxElement, type SyntaxErrorCode, type SyntaxNode, type SyntaxRule, type TimerImpl, type ToValueOptions, type TokType, type Token, type Trivia, type TsCore, TsGroup, TsScript, UnitLoadError, type UnwindEntry, type UserImpl, Value, type Verdict, type Versions, add, allStdlib, bool, builtins, bytes, calendarCapability, callFunction, canConvert, checkSource, checkSyntax, civilDate, clockCapability, codeIdentity, compileLibrary, compileSource, conforms, consoleCapability, coreVersions, createCore, createGroup, dec, declarationStart, decodeJson, decodeValue, defaultLimits, defineCapability, defineObjectKind, deliver, disassemble, encodeJson, encodeValue, explain, exportManifest, exportsOf, formatInstant, fromValue, grammar, handlersOf, httpCapability, inlineGrants, instant, kindNames, list, loadScript, localeCapability, lowerTree, map, musicalClockCapability, newGroup, nothing, nowMicros, num, operationDeclarations, parseEntry, parseInstant, parseSource, parseSourceRecovering, peerCapability, peerKind, quantity, range, readDisplay, record, registerStdlib, restore, shape, shapeData, sqliteCapability, stdlibNames, stdlibSources, storeCapability, syntaxSelector, syntaxText, talk, text, timerCapability, toValue, units, userCapability, validMessageSelector, waitUs, zoneRules };
package/index.js CHANGED
@@ -6,20 +6,20 @@ import { json } from "./stdlib/json.js";
6
6
  import { list as list$1 } from "./stdlib/list.js";
7
7
  import { map as map$1 } from "./stdlib/map.js";
8
8
  import { units as units$1 } from "./stdlib/units.js";
9
- import { G as record, H as quantity, Jt as parseInstant, Kt as nowMicros, L as nothing, N as map, R as num, T as instant, Ut as formatInstant, W as range, c as Decimal, cn as builtins, d as bytes, et as text, i as ScriptError, k as list, l as Value, m as civilDate, n as LoadError, pn as units, r as MailboxFull, t as HostError, u as bool, un as grammar, v as dec } from "./errors-P3ga1I-9.js";
10
- import { S as registerStdlib, _ as loadScript, b as exportsOf, c as codeIdentity, d as Run, f as Script, g as deliver, h as defaultLimits, i as restore, l as compileLibrary, m as callFunction, n as TsScript, p as UnitLoadError, r as newGroup, t as TsGroup, v as LoweringError, w as stdlibNames, x as lowerTree, y as compileSource } from "./group-BqccKTWz.js";
11
- import { t as defineObjectKind } from "./objects-DE6kRk0r.js";
12
- import { At as Lexer, Ot as validMessageSelector, Tt as shape, U as waitUs, c as canConvert, et as disassemble, gt as LimitReached, t as NotImplementedError, wt as operationDeclarations, yt as defineCapability } from "./operations-CGjDlkGU.js";
13
- import { a as syntaxText, c as parseSource, i as syntaxSelector, l as parseSourceRecovering, o as ParseError, p as declarationStart, r as checkSyntax, s as parseEntry, t as checkSource, v as shapeData, y as kindNames } from "./checker-Coml0Tf9.js";
14
- import { n as exportManifest } from "./manifest-37x-HSxH.js";
15
- import { c as readDisplay, r as decodeValue } from "./readers-yMS1eAOp.js";
16
- import { a as clockCapability, d as timerCapability, i as calendarCapability, o as consoleCapability, t as encodeValue, u as musicalClockCapability } from "./encoding-BL2ECJmg.js";
17
- import { a as peerKind, i as peerCapability } from "./peer-capability-elnbQy-J.js";
18
- import { a as sqliteCapability, c as talk, i as httpCapability, o as fromValue, r as handlersOf, s as toValue, t as inlineGrants } from "./inline-grants-BT2nnfLA.js";
19
- import { o as decodeJson, s as encodeJson } from "./http-fetch-DA-NbFIM.js";
20
- import { n as createCore, r as coreVersions, t as createGroup } from "./lean-BJmLobmd.js";
21
- import { n as localeCapability, t as userCapability } from "./user-capability-D6hGa3eF.js";
22
- import { r as storeCapability, t as add } from "./store-capability-DBLlWaNO.js";
9
+ import { D as instant, H as num, J as range, K as quantity, L as map, N as list, Qt as parseInstant, V as nothing, Xt as nowMicros, Y as record, b as dec, c as Decimal, d as bytes, g as civilDate, hn as grammar, i as ScriptError, it as text, l as Value, n as LoadError, pn as builtins, qt as formatInstant, r as MailboxFull, t as HostError, u as bool, vn as units } from "./errors-CNc-xY_9.js";
10
+ import { S as registerStdlib, _ as loadScript, b as exportsOf, c as codeIdentity, d as Run, f as Script, g as deliver, h as defaultLimits, i as restore, l as compileLibrary, m as callFunction, n as TsScript, p as UnitLoadError, r as newGroup, t as TsGroup, v as LoweringError, w as stdlibNames, x as lowerTree, y as compileSource } from "./group-CY4FKhzT.js";
11
+ import { t as defineObjectKind } from "./objects-OKVLH190.js";
12
+ import { At as validMessageSelector, Dt as shape, Et as operationDeclarations, Mt as Lexer, U as waitUs, bt as defineCapability, c as canConvert, et as disassemble, gt as LimitReached, t as NotImplementedError, vt as conforms, wt as explain } from "./operations-B3XaG7Ve.js";
13
+ import { a as syntaxText, c as parseSource, i as syntaxSelector, l as parseSourceRecovering, o as ParseError, p as declarationStart, r as checkSyntax, s as parseEntry, t as checkSource, v as shapeData, y as kindNames } from "./checker-D74oYIhs.js";
14
+ import { n as exportManifest } from "./manifest-DVS1SEmN.js";
15
+ import { c as readDisplay, r as decodeValue } from "./readers-G1lHqrPl.js";
16
+ import { a as clockCapability, d as timerCapability, i as calendarCapability, o as consoleCapability, t as encodeValue, u as musicalClockCapability } from "./encoding-DzVFpg7k.js";
17
+ import { a as peerKind, i as peerCapability } from "./peer-capability-3etyPHs3.js";
18
+ import { a as httpCapability, c as toValue, i as handlersOf, l as talk, n as inlineGrants, o as sqliteCapability, s as fromValue, t as zoneRules } from "./zone-rules-DsCJtmlC.js";
19
+ import { o as decodeJson, s as encodeJson } from "./http-fetch-DnpfiOWK.js";
20
+ import { n as createCore, r as coreVersions, t as createGroup } from "./lean-DTCTJUmR.js";
21
+ import { n as localeCapability, t as userCapability } from "./user-capability-DNY2dyjq.js";
22
+ import { r as storeCapability, t as add } from "./store-capability-CBJ6mUoH.js";
23
23
  //#region src/generated/stdlib.ts
24
24
  /** Every stdlib Library. */
25
25
  const allStdlib = [
@@ -37,4 +37,4 @@ const stdlibSources = Object.fromEntries(allStdlib.map((l) => [l.name, l.source]
37
37
  //#region src/index.ts
38
38
  registerStdlib(...allStdlib);
39
39
  //#endregion
40
- export { Script as CompiledScript, Decimal, HostError, Lexer, LimitReached, LoadError, LoweringError, MailboxFull, NotImplementedError, ParseError, Run, ScriptError, TsGroup, TsScript, UnitLoadError, Value, add, allStdlib, bool, builtins, bytes, calendarCapability, callFunction, canConvert, checkSource, checkSyntax, civilDate, clockCapability, codeIdentity, compileLibrary, compileSource, consoleCapability, coreVersions, createCore, createGroup, dec, declarationStart, decodeJson, decodeValue, defaultLimits, defineCapability, defineObjectKind, deliver, disassemble, encodeJson, encodeValue, exportManifest, exportsOf, formatInstant, fromValue, grammar, handlersOf, httpCapability, inlineGrants, instant, kindNames, list, loadScript, localeCapability, lowerTree, map, musicalClockCapability, newGroup, nothing, nowMicros, num, operationDeclarations, parseEntry, parseInstant, parseSource, parseSourceRecovering, peerCapability, peerKind, quantity, range, readDisplay, record, registerStdlib, restore, shape, shapeData, sqliteCapability, stdlibNames, stdlibSources, storeCapability, syntaxSelector, syntaxText, talk, text, timerCapability, toValue, units, userCapability, validMessageSelector, waitUs };
40
+ export { Script as CompiledScript, Decimal, HostError, Lexer, LimitReached, LoadError, LoweringError, MailboxFull, NotImplementedError, ParseError, Run, ScriptError, TsGroup, TsScript, UnitLoadError, Value, add, allStdlib, bool, builtins, bytes, calendarCapability, callFunction, canConvert, checkSource, checkSyntax, civilDate, clockCapability, codeIdentity, compileLibrary, compileSource, conforms, consoleCapability, coreVersions, createCore, createGroup, dec, declarationStart, decodeJson, decodeValue, defaultLimits, defineCapability, defineObjectKind, deliver, disassemble, encodeJson, encodeValue, explain, exportManifest, exportsOf, formatInstant, fromValue, grammar, handlersOf, httpCapability, inlineGrants, instant, kindNames, list, loadScript, localeCapability, lowerTree, map, musicalClockCapability, newGroup, nothing, nowMicros, num, operationDeclarations, parseEntry, parseInstant, parseSource, parseSourceRecovering, peerCapability, peerKind, quantity, range, readDisplay, record, registerStdlib, restore, shape, shapeData, sqliteCapability, stdlibNames, stdlibSources, storeCapability, syntaxSelector, syntaxText, talk, text, timerCapability, toValue, units, userCapability, validMessageSelector, waitUs, zoneRules };
@@ -1,6 +1,6 @@
1
1
  /// <reference lib="esnext.disposable" />
2
- import { $t as Group, Dr as SemanticTree, Fr as SyntaxNode, J as Value, K as Decimal, Mr as Token, Nn as Library, Or as SourceSpan, Pr as SyntaxErrorCode, Qt as Core, _ as LoadOptions, br as LibraryExport, en as Script, gr as Binding, ht as ObjectKind, jt as Grant, lr as CodeUnit, qt as Shape, wr as SemanticNode, yt as GrantDecls } from "./debug-C_Ob5rkl.js";
3
- import { n as Drive, r as DrivenGroupOptions } from "./driver-CLi_OmyQ.js";
2
+ import { Ar as SourceSpan, Er as SemanticNode, Fn as Library, Ir as SyntaxErrorCode, J as Value, K as Decimal, Lr as SyntaxNode, Pr as Token, Sr as LibraryExport, _ as LoadOptions, dr as CodeUnit, en as Core, ht as ObjectKind, jt as Grant, kr as SemanticTree, nn as Script, qt as Shape, tn as Group, vr as Binding, yt as GrantDecls } from "./debug-s6QIovKS.js";
3
+ import { n as Drive, r as DrivenGroupOptions } from "./driver-D5yrK3Nu.js";
4
4
  //#region src/generated/syntax.d.ts
5
5
  declare const grammar: {
6
6
  reserved: string[];
@@ -559,7 +559,7 @@ declare const builtins: readonly [{
559
559
  readonly kind: "function";
560
560
  readonly contract: {
561
561
  readonly required: 2;
562
- readonly total: 2;
562
+ readonly total: 3;
563
563
  readonly variadic: false;
564
564
  };
565
565
  }, {
@@ -647,6 +647,8 @@ type ExistingName = Pick<Binding, 'kind' | 'contract' | 'importedFrom' | 'shape'
647
647
  type CheckOptions = {
648
648
  /** Names in older code units when checking a Script extension. */
649
649
  existing?: Readonly<Record<string, ExistingName>>;
650
+ /** Refuse every possible Suspension Point, for a Script loaded with `forbidSuspension` (ADR 0178). */
651
+ forbidSuspension?: boolean;
650
652
  /** A Script's Grants, to check its Capability calls against; none checks none. */
651
653
  grants?: GrantDecls;
652
654
  /** Exports supplied by the Library loader; kind-only entries defer call-count checks. */
@@ -819,6 +821,16 @@ type InlineOperation = InlineFunction | {
819
821
  */
820
822
  declare const inlineGrants: (capabilities: Readonly<Record<string, Readonly<Record<string, InlineOperation>>>>) => Record<string, Grant<void>>;
821
823
  //#endregion
824
+ //#region src/zone-rules.d.ts
825
+ /**
826
+ * Zone Rules for the IANA zone `zone` from `from` up to `until`, exclusive,
827
+ * as an ordinary map (chapter 7): the offset in effect at `from`, then each
828
+ * Instant in the window where the offset changes. An unknown zone, an empty
829
+ * window, or an offset that isn't a whole number of minutes, as in local mean
830
+ * time before a zone adopted standard time, throws invalid value.
831
+ */
832
+ declare const zoneRules: (zone: string, from: Date, until: Date) => Value;
833
+ //#endregion
822
834
  //#region src/manifest.d.ts
823
835
  type MessageDecl = {
824
836
  args?: readonly Shape[];
@@ -864,7 +876,10 @@ type CompileResult = {
864
876
  error: ParseError | null;
865
877
  unit: null;
866
878
  };
867
- /** A checked Library's exports, for the Scripts and Libraries that import it. */
879
+ /**
880
+ * A checked Library's exports, for the Scripts and Libraries that import it.
881
+ * It reads only declaration headers, so it never converts a body.
882
+ */
868
883
  declare const exportsOf: (tree: SemanticTree) => Record<string, Exclude<LibraryExport, string>>;
869
884
  /** Lower a checked semantic tree into its code unit. */
870
885
  declare const lowerTree: (tree: SemanticTree, options: Pick<CompileOptions, "name" | "unit"> & {
@@ -887,4 +902,4 @@ declare const declarationStart: (root: SyntaxNode, declaration: SyntaxNode) => n
887
902
  //#region src/selectors.d.ts
888
903
  declare const validMessageSelector: (message: string, arity: number) => boolean;
889
904
  //#endregion
890
- export { units as $, PlainValue as A, checkSource as B, decodeJson as C, kindNames as D, shapeData as E, CheckOptions as F, ParseResult as G, EntryKind as H, CheckResult as I, parseEntry as J, RecoveringParseResult as K, Diagnostic as L, fromValue as M, toValue as N, encodeValue as O, talk as P, grammar as Q, DiagnosticCode as R, handlersOf as S, ShapeData as T, EntryResult as U, checkSyntax as V, ParseError as W, parseSourceRecovering as X, parseSource as Y, builtins as Z, CreateGroupOptions$1 as _, LoweringError as a, Handlers as b, lowerTree as c, exportManifest as d, InlineFunction as f, createGroup as g, CreateGroupOptions as h, CompileResult as i, ToValueOptions as j, FromValueOptions as k, ManifestSpec as l, inlineGrants as m, declarationStart as n, compileSource as o, InlineOperation as p, RecoveryDiagnostic as q, CompileOptions as r, exportsOf as s, validMessageSelector as t, MessageDecl as u, DrivenGroup as v, encodeJson as w, ScriptWithHandlers as x, createGroup$1 as y, SemanticResult as z };
905
+ export { grammar as $, FromValueOptions as A, SemanticResult as B, handlersOf as C, shapeData as D, ShapeData as E, talk as F, ParseError as G, checkSyntax as H, CheckOptions as I, RecoveryDiagnostic as J, ParseResult as K, CheckResult as L, ToValueOptions as M, fromValue as N, kindNames as O, toValue as P, builtins as Q, Diagnostic as R, ScriptWithHandlers as S, encodeJson as T, EntryKind as U, checkSource as V, EntryResult as W, parseSource as X, parseEntry as Y, parseSourceRecovering as Z, createGroup as _, LoweringError as a, createGroup$1 as b, lowerTree as c, exportManifest as d, units as et, zoneRules as f, CreateGroupOptions as g, inlineGrants as h, CompileResult as i, PlainValue as j, encodeValue as k, ManifestSpec as l, InlineOperation as m, declarationStart as n, compileSource as o, InlineFunction as p, RecoveringParseResult as q, CompileOptions as r, exportsOf as s, validMessageSelector as t, MessageDecl as u, CreateGroupOptions$1 as v, decodeJson as w, Handlers as x, DrivenGroup as y, DiagnosticCode as z };