gdp-wired 0.43.0 → 0.44.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 (44) hide show
  1. package/README.md +8 -3
  2. package/dist/core/cli.d.ts +6 -0
  3. package/dist/core/cli.js +48 -6
  4. package/dist/core/data.js +2 -2
  5. package/dist/core/effect-prims.d.ts +60 -0
  6. package/dist/core/effect-prims.js +625 -0
  7. package/dist/core/effect.d.ts +17 -1
  8. package/dist/core/effect.js +108 -4
  9. package/dist/core/ex/harness.exs +2 -0
  10. package/dist/core/extract-c.d.ts +2 -0
  11. package/dist/core/extract-c.js +5 -3
  12. package/dist/core/extract-check.d.ts +1 -0
  13. package/dist/core/extract-check.js +8 -1
  14. package/dist/core/extract-ex.js +2 -2
  15. package/dist/core/extract-go-check.js +4 -6
  16. package/dist/core/extract-go.d.ts +3 -0
  17. package/dist/core/extract-go.js +4 -4
  18. package/dist/core/extract-jvm.js +6 -3
  19. package/dist/core/extract-py.js +2 -2
  20. package/dist/core/extract-rb.js +2 -2
  21. package/dist/core/extract-rs.js +12 -7
  22. package/dist/core/extract-sol.js +4 -4
  23. package/dist/core/extract-step.d.ts +9 -0
  24. package/dist/core/extract-step.js +48 -9
  25. package/dist/core/extract-swift.js +3 -3
  26. package/dist/core/infer.js +3 -3
  27. package/dist/core/jvm/Harness.java +8 -1
  28. package/dist/core/jvm/Jvm.java +1 -1
  29. package/dist/core/jvm/KtReader.java +3 -0
  30. package/dist/core/machine.d.ts +3 -0
  31. package/dist/core/machine.js +15 -1
  32. package/dist/core/py/harness.py +51 -13
  33. package/dist/core/sol/Replay.sol +52 -0
  34. package/dist/core/sol/harness.py +508 -0
  35. package/dist/core/system.js +12 -3
  36. package/dist/interchange/check.d.ts +18 -1
  37. package/dist/interchange/check.js +9 -2
  38. package/dist/interchange/cli.d.ts +2 -0
  39. package/dist/interchange/cli.js +45 -0
  40. package/dist/interchange/format.d.ts +1 -1
  41. package/dist/interchange/format.js +15 -7
  42. package/dist/kernel/cdcl.js +32 -12
  43. package/dist/kernel/reader.js +3 -2
  44. package/package.json +12 -3
@@ -1,16 +1,20 @@
1
1
  import type { Kind, Rule } from './dsl.js';
2
- import { type Rand } from './machine.js';
2
+ import { type Law, type Rand } from './machine.js';
3
3
  import { type Source } from './extract-read.js';
4
4
  import { type ExtractOptions, type Extraction } from './extract.js';
5
5
  import { type ScheduleRule } from './effect-schedule.js';
6
+ import { type Prim } from './effect-prims.js';
6
7
  export { proveRule, proveSteps } from './dsl.js';
7
8
  export { jitterRun, replaySchedule, scheduleConforms, stepper } from './effect-schedule.js';
9
+ export { primitiveConforms, primitiveLaws, primitiveRule } from './effect-prims.js';
8
10
  type Mod = Record<string, any>;
9
11
  export type EffectOptions = Omit<ExtractOptions, 'entry'> & {
10
12
  entry?: string;
11
13
  effect?: Mod;
12
14
  modules?: Record<string, unknown>;
13
15
  fibers?: boolean;
16
+ perFiber?: string[];
17
+ capacityParam?: boolean;
14
18
  };
15
19
  export type MethodSchedule = {
16
20
  at: string;
@@ -32,6 +36,18 @@ export type Runner = {
32
36
  };
33
37
  export declare function runner(E: Mod): Runner;
34
38
  export declare function extractEffect(at: Source, opts?: EffectOptions): Extraction;
39
+ export type Primitive = Prim & {
40
+ invariants: Law[];
41
+ laws: Law[];
42
+ lemmas?: Law[];
43
+ };
44
+ export declare function withLemmas(x: Extraction, opts?: {
45
+ ms?: number;
46
+ }): {
47
+ x: Extraction;
48
+ proven: string[];
49
+ unproven: string[];
50
+ };
35
51
  export declare function fiberRun(x: Extraction, run: {
36
52
  params: Record<string, number>;
37
53
  trace: Record<string, unknown>[];
@@ -16,7 +16,7 @@
16
16
  // a Schema's kind.
17
17
  import ts from 'typescript';
18
18
  import * as dsl from "./dsl.js";
19
- import { interpret, seeded } from "./machine.js";
19
+ import { interpret, lcg, seeded } from "./machine.js";
20
20
  import { allowed } from "./watch.js";
21
21
  import * as I from "./extract-ir.js";
22
22
  import { Refusal, bare as strip, beside, impure, memberName, normalize, placed, refuse, shapeOf, sourceOf, text, where } from "./extract-read.js";
@@ -25,9 +25,14 @@ import { fromModel, namesOf } from "./extract.js";
25
25
  import { check, sandbox } from "./extract-check.js";
26
26
  import { Parts, readSchedule, replaySchedule, scheduleConforms, scheduleRule } from "./effect-schedule.js";
27
27
  import { asRule, lift } from "./system.js";
28
+ import { rewritePrims } from "./effect-prims.js";
28
29
  export { proveRule, proveSteps } from "./dsl.js";
29
30
  export { jitterRun, replaySchedule, scheduleConforms, stepper } from "./effect-schedule.js";
31
+ export { primitiveConforms, primitiveLaws, primitiveRule } from "./effect-prims.js";
30
32
  const REFS = new Set(['Ref', 'SynchronizedRef', 'SubscriptionRef', 'TxRef', 'TRef']), MAKES = ['make', 'makeUnsafe', 'unsafeMake'];
33
+ // (Effect's RateLimiter: 3.x's gives its permits back on a fiber of its own, forked into the make effect's scope, on
34
+ // timers; 4.x's (effect/persistence) keeps its counters in a store every user of it shares)
35
+ const RATE = 'a RateLimiter (not modelled: 3.x\'s gives its permits back on timers of a fiber forked into the scope, 4.x\'s keeps its counters in a store shared by its every user): write the window in Refs read with Clock.currentTimeMillis, or a rule by hand beside it (conforms)';
31
36
  const STM = (api) => `${api} (of STM: gen, commit, succeed, sync, void, fail, die, check and retry are read)`, MATCH = (x) => `${x}: a matcher (write the dispatch as a switch on _tag, or ifs)`;
32
37
  // The Effect line the file is read for (4.x unless the project's effect is 3.x), and the policies its methods retry or
33
38
  // repeat with, each read into its schedule's rule.
@@ -171,6 +176,8 @@ function factoryOf(s, entry) {
171
176
  }
172
177
  if (m === 'STM')
173
178
  return refuse(d, STM(api));
179
+ if (m === 'RateLimiter' || /\bRateLimiter\b/.test(call.getText()))
180
+ return refuse(d, RATE);
174
181
  if (m === 'Semaphore' || /^Effect\.(unsafeM|m)akeSemaphore$/.test(api)) {
175
182
  const n = call.arguments[0];
176
183
  if (!n || !ts.isNumericLiteral(n) || n.text !== '1')
@@ -266,6 +273,8 @@ function hook(s, refs, locks, effects) {
266
273
  return [eff(q => (q.heap.has(SLEPT) ? refuse(e, 'the clock read after a repeat that waits (the time has moved on by its delays)') : ex.now(e, q))), p];
267
274
  if (api?.startsWith('Clock.'))
268
275
  return refuse(e, `${api} (Clock.currentTimeMillis is read, as an input)`);
276
+ if (!api && ['_tag', 'value'].includes(memberName(e.name)) && /^Option<|^(Some|None)</.test(s.checker.typeToString(s.checker.getTypeAtLocation(e.expression))))
277
+ return refuse(e, `${text(e)}: an Option's ${memberName(e.name)} (Option.isSome, isNone, getOrElse and getOrUndefined are read)`);
269
278
  if (api && /^(Random|DateTime|Crypto|Console|Config|FileSystem)\./.test(api) && ts.isYieldExpression(e.parent))
270
279
  return refuse(e, `${api}: an answer from outside the Refs read (Clock.currentTimeMillis is the one read, as an input)`);
271
280
  return undefined;
@@ -363,6 +372,12 @@ function hook(s, refs, locks, effects) {
363
372
  }
364
373
  if (m === 'Match')
365
374
  return refuse(e, MATCH(api));
375
+ if (m === 'Option')
376
+ return option(ex, e, op, p);
377
+ if (m === 'RateLimiter')
378
+ return refuse(e, RATE);
379
+ if (m === 'Queue')
380
+ return refuse(e, `${api}: a Queue other than one the service's make effect makes (yield* Queue.bounded(n), dropping, sliding, unbounded or make, read as its model)`);
366
381
  if (m === 'TRef')
367
382
  return refuse(e, `${api} (a TRef the service's make effect makes is read: get, set, update, modify and their variants)`);
368
383
  if (m === 'Semaphore')
@@ -411,7 +426,7 @@ function hook(s, refs, locks, effects) {
411
426
  found.push({ at: where(at), use, source: sched ? sched.getText() : `{times: ${times}}`, rule: sr });
412
427
  // The policy run as Effect drives it, each attempt taking no time: how many times it goes on (for every input it
413
428
  // may be fed, drawn), and how long it waits in all.
414
- const g = sr.rule.compiled(), ps = sr.rule.encodeParams({}), rand = (() => { let x = 7; return (n) => (x = (x * 1103515245 + 12345) % 2147483648) % Math.max(1, n); })();
429
+ const g = sr.rule.compiled(), ps = sr.rule.encodeParams({}), rand = (() => { let x = 7; return (n) => (x = lcg(x)) % Math.max(1, n); })();
415
430
  const runOnce = (draw) => {
416
431
  let st = g.init(ps), n = 0, waited = 0;
417
432
  for (; n < 1000; n++) {
@@ -474,6 +489,31 @@ function hook(s, refs, locks, effects) {
474
489
  delete ex.now;
475
490
  }
476
491
  }
492
+ // Option's constructors and reads, over a value that may be missing (Queue.poll's answer): some, none, isSome, isNone,
493
+ // getOrElse (of a default written here) and getOrUndefined.
494
+ function option(ex, e, op, p) {
495
+ const [a, b] = e.arguments, has = (v) => (v.t === 'opt' ? v.has : v.t === 'undef' ? I.F : I.T), n = e.arguments.length;
496
+ if (op === 'none' && !n)
497
+ return [{ t: 'undef' }, p];
498
+ if (op === 'some' && n === 1) {
499
+ const [v, q] = ex.ev(a, p);
500
+ return [{ t: 'opt', has: I.T, v }, q];
501
+ }
502
+ if ((op === 'isSome' || op === 'isNone') && n === 1) {
503
+ const [v, q] = ex.ev(a, p);
504
+ return [{ t: 'bool', e: op === 'isSome' ? has(v) : I.not(has(v)) }, q];
505
+ }
506
+ if (op === 'getOrUndefined' && n === 1)
507
+ return ex.ev(a, p);
508
+ if (op === 'getOrElse' && n === 2) {
509
+ const f = fnOf(s, b);
510
+ if (!f || f.parameters.length || ts.isBlock(f.body) || impure(f.body))
511
+ return refuse(b, 'Option.getOrElse of other than () => a value written here');
512
+ const [v, q] = ex.ev(a, p), [d, q2] = ex.ev(f.body, q);
513
+ return [v.t === 'opt' ? ex.phiV(v.has, v.v, d, e) : v.t === 'undef' ? d : v, q2];
514
+ }
515
+ return refuse(e, `Option.${op} (some, none, isSome, isNone, getOrElse and getOrUndefined are read)`);
516
+ }
477
517
  // Ref.op(ref, ...): the ref a Ref the service made (by its name), its value the state's field.
478
518
  function refOp(ex, e, m, op, p) {
479
519
  const r = e.arguments[0] && strip(e.arguments[0]), base = op.replace(/Effect$/, ''), answer = ANSWERS[base], f = e.arguments[1];
@@ -574,6 +614,9 @@ export function extractEffect(at, opts = {}) {
574
614
  if (sch)
575
615
  return fromScheduleEntry(code, file, sch, E, opts);
576
616
  const entry = opts.entry ?? serviceOf(code, file, opts);
617
+ const pr = modelled(code, file, entry, E, opts);
618
+ if (pr)
619
+ return pr;
577
620
  if (opts.fibers !== false) {
578
621
  const f = fibered(code, file, entry, E, opts);
579
622
  if (f)
@@ -594,6 +637,64 @@ export function extractEffect(at, opts = {}) {
594
637
  const schedules = found;
595
638
  return { ...fromModel(model, file, opts.domains, [], (rule, sorts) => check(code, file, model, rule, sorts, { ...opts.check, modules, ...(opts.files ? { files: opts.files } : {}), ...(opts.domains ? { given: opts.domains } : {}) })), names: namesOf(model), ...(schedules.length ? { schedules } : {}) };
596
639
  }
640
+ function modelled(code, file, entry, E, opts) {
641
+ if (!/\b(Queue|Semaphore|makeSemaphore|unsafeMakeSemaphore)\b/.test(code))
642
+ return undefined;
643
+ const s = setupOf(code, placed(file), {}, opts.files), w = rewritePrims(s, factoryOf(s, entry), x => apiOf(s, x), V4, { params: !!opts.capacityParam });
644
+ if (!w)
645
+ return undefined;
646
+ const x = extractEffect(w.code, { ...opts, capacityParam: false, file: normalize(placed(file)), entry, effect: E, perFiber: w.prims.flatMap(p => (p.kind === 'semaphore' ? [`${p.name}_held`] : [])) });
647
+ if (!x.ok || !x.rule)
648
+ return { ...x, notes: [...w.notes, ...x.notes] };
649
+ const r = x.rule;
650
+ // (a field's value: under fibers an integer is the machine's two naturals, x and x$neg)
651
+ const maps = new Set(Object.keys(x.rule.machine.maps ?? {}));
652
+ const val = (st, n) => (st[n] instanceof dsl.Int ? st[n] : `${n}$neg` in st ? new dsl.Int(st[n], st[`${n}$neg`]) : dsl.Int.of(st[n]));
653
+ const prims = w.prims.map(p => {
654
+ const f = (n) => `${p.name}_${n}`;
655
+ if (p.kind === 'queue')
656
+ return { ...p, laws: [], invariants: [r.law(p.capacity === undefined ? `${p.name} never gives more than it was given` : `${p.name} holds at most ${p.capacity} items`, st => {
657
+ const h = val(st, f('head')), t = val(st, f('tail'));
658
+ return p.capacity === undefined ? h.atMost(t) : h.atMost(t).and(t.atMost(h.plus(typeof p.capacity === 'number' ? p.capacity : val(st, p.capacity))));
659
+ })] };
660
+ const total = (st) => (typeof p.permits === 'number' ? p.permits : val(st, p.permits));
661
+ // (what the fibers hold sums to what is taken: one fiber's own, or under many fibers the sum of each's)
662
+ const held = (st) => (maps.has(f('held')) ? new dsl.Int(st[f('held')].sum(), maps.has(`${f('held')}$neg`) ? st[`${f('held')}$neg`].sum() : dsl.lit(0)) : val(st, f('held')));
663
+ // (under many fibers, the lemmas the use law rests on where each fiber gives back only what it took, withPermits':
664
+ // no fiber's own below nothing, and so not their sum)
665
+ const neg = `${f('held')}$neg`, lemmas = maps.has(neg) ? [r.law(`${p.name}: no fiber gives back more permits than it took`, st => dsl.forall(k => st[neg].at(k).eq(0))),
666
+ r.law(`${p.name}: what its fibers hold is never below nothing`, st => st[neg].sum().eq(0))] : [];
667
+ return { ...p, invariants: [r.law(`${p.name} never has more permits taken than ${typeof p.permits === 'number' ? `its ${p.permits}` : p.permits}`, st => val(st, f('taken')).atMost(total(st))), r.law(`${p.name}'s permits taken are those its fibers hold`, st => val(st, f('taken')).eq(held(st)))],
668
+ laws: [r.law(`${p.name} is never released past what was taken`, st => val(st, f('taken')).atLeast(0))], lemmas };
669
+ });
670
+ const lemmas = prims.flatMap(p => p.lemmas ?? []);
671
+ return { ...x, invariants: [...x.invariants ?? [], ...prims.flatMap(p => p.invariants)], notes: [...w.notes, ...x.notes], primitives: prims, ...(lemmas.length ? { lemmas } : {}) };
672
+ }
673
+ // The extraction with its lemmas (laws that hold where the code uses its primitives as they are meant to be, a
674
+ // semaphore's permits given back by the fiber that took them) proven first, each with the invariants and those proven
675
+ // before it: the proven ones, with what their search found, join the invariants every law is proven beside; the others
676
+ // are left out (a lemma is no claim: the laws stated are).
677
+ export function withLemmas(x, opts = {}) {
678
+ const lemmas = x.lemmas ?? [], inv = [...x.invariants ?? []], proven = [], unproven = [];
679
+ if (!x.rule)
680
+ return { x, proven, unproven };
681
+ for (const l of lemmas) {
682
+ let v;
683
+ try {
684
+ v = dsl.proveRule(x.rule, [...inv, l], { search: { ms: opts.ms ?? 30_000 } });
685
+ }
686
+ catch {
687
+ v = undefined;
688
+ }
689
+ if (v?.proven && v.checked) {
690
+ inv.push(l, ...(v.found?.laws ?? []).map(f => f.law));
691
+ proven.push(l.name);
692
+ }
693
+ else
694
+ unproven.push(l.name);
695
+ }
696
+ return { x: { ...x, invariants: inv }, proven, unproven };
697
+ }
597
698
  // --- many fibers: a method that is several steps ---------------------------------------------------------------------
598
699
  // A method's atomic units: the statements of its body that run an effect on the service's state (a transaction, a Ref
599
700
  // operation, a helper's), each a step another fiber's may come between. A failure, a log, a sleep or a wait runs no
@@ -788,7 +889,7 @@ function fibered(code, file, entry, E, opts) {
788
889
  return { ...one, notes: [`read as one fiber's steps (${split.map(mt => `${mt.name}: ${mt.units.length}`).join(', ')}), the service written again:`, out, ...one.notes] };
789
890
  const m0 = one.rule.machine, model = one.model;
790
891
  // (an integer is two naturals, x and x$neg)
791
- const local = (n0) => { const n = n0.replace(/\$neg$/, ''); return made.has(n) || model.outputs.some(o => n === o || n.startsWith(`${o}_`)) || n === 'failed'; };
892
+ const local = (n0) => { const n = n0.replace(/\$neg$/, ''); return made.has(n) || !!opts.perFiber?.includes(n) || model.outputs.some(o => n === o || n.startsWith(`${o}_`)) || n === 'failed'; };
792
893
  const shared = Object.keys(m0.state).filter(n => !local(n));
793
894
  if (m0.inputs.includes('fiber'))
794
895
  return { ok: false, refusals: [{ where: file, what: 'a method takes an argument named fiber (the name the fibers are told apart by)' }], notes: [] };
@@ -796,7 +897,10 @@ function fibered(code, file, entry, E, opts) {
796
897
  const parts = one.rule.parts;
797
898
  // (the kinds of the requests' choices kept; an integer is its two naturals, x and x$neg, as the machine has it)
798
899
  const named = new Set([...lifted.params, ...lifted.inputs]), whole = ([n]) => named.has(n) && !named.has(`${n}$neg`);
799
- const rule = asRule({ ...lifted, name: `${m0.name}, every fiber` }, Object.fromEntries([...parts.params, ...parts.inputs].filter(whole)));
900
+ // (and the shared integers' kinds: a law reads an integer of the service's as it does where the rule is one fiber's)
901
+ const one2 = one.rule;
902
+ const ints = [...one2.kindsOfState().filter(([n]) => shared.includes(n) && shared.includes(`${n}$neg`)), ...one2.kindsOfCells().filter(([n, k]) => k.vars(n).every(p => !local(p)))];
903
+ const rule = asRule({ ...lifted, name: `${m0.name}, every fiber` }, Object.fromEntries([...parts.params, ...parts.inputs].filter(whole).concat(ints)));
800
904
  const names = (one.names ?? []).filter(n => !(n.role === 'state' && local(n.rule)) && n.role !== 'result' && !made.has(n.code));
801
905
  const inv = (one.invariants ?? []).filter(l => ![...JSON.stringify(l.holds).matchAll(/"name":"([^"]*)"/g)].some(m => local(m[1])));
802
906
  const steps = split.map((mt, mi) => ({ name: mt.name, steps: mt.units.length, base: (mi + 1) * 100 }));
@@ -60,6 +60,8 @@ defmodule GdpHarness do
60
60
  end
61
61
  end
62
62
  def arg(%{"none" => true}), do: nil
63
+ # (a value the rule never reads: any value, nil)
64
+ def arg(%{"inert" => true}), do: nil
63
65
  def state_of(st) do
64
66
  for l <- s("leaves"), l["kind"] not in ["frame", "map"], into: %{} do
65
67
  v = Map.get(st, String.to_atom(hd(l["path"])))
@@ -17,6 +17,8 @@ export type COptions = {
17
17
  clang?: string;
18
18
  root?: string;
19
19
  fails?: Record<string, string>;
20
+ answers?: Record<string, string>;
21
+ skip?: string[];
20
22
  onError?: 'refuse' | 'discard';
21
23
  domains?: Record<string, 'nat' | 'int'>;
22
24
  check?: GoCheckOptions;
@@ -85,7 +85,7 @@ export function extractC(at, given = {}, cpp = false) {
85
85
  ;
86
86
  ({ c, flags } = readCFile(file, opts, cpp));
87
87
  c.pkg.dir = node('node:path').resolve(file).replace(/\/[^/]*$/, '');
88
- read = readGo(c.pkg, { entry: c.entry, methods: opts.functions?.map(f => f.split('/')[0]) ?? c.methods, ...(opts.onError ? { onError: opts.onError } : {}), ...(opts.fails ? { fails: opts.fails } : {}), ...(opts.strict ? { strict: true } : {}) });
88
+ read = readGo(c.pkg, { entry: c.entry, methods: opts.functions?.map(f => f.split('/')[0]) ?? c.methods, ...(opts.onError ? { onError: opts.onError } : {}), ...(opts.fails ? { fails: opts.fails } : {}), ...(opts.strict ? { strict: true } : {}), ...(opts.answers ? { answers: opts.answers } : {}), ...(opts.skip ? { skip: opts.skip } : {}) });
89
89
  }
90
90
  catch (e) {
91
91
  if (e instanceof Refusal)
@@ -386,7 +386,8 @@ export function checkC(file, flags, c, read, r, sorts, opts, cpp) {
386
386
  }
387
387
  // The same flags; undefined behavior trapped (the rule refuses it, so the code must fail there too); another
388
388
  // file's functions linked as stubs that report themselves (the rule refuses their calls: one reached is the
389
- // code's failure where the rule took the step, a difference).
389
+ // code's failure where the rule took the step, a difference), but those left out (skip, stated or inferred: they
390
+ // change nothing the rule keeps, and nothing reads their value), which do nothing.
390
391
  const clang = opts.clang ?? (cpp ? 'clang++' : 'clang'), stubs = `${work}/gdp_stubs.c`;
391
392
  const link = (more) => cp.execFileSync(clang, [...(cpp ? ['-x', 'c++'] : []), ...flags, '-w', '-O0', '-fsanitize=undefined', '-fsanitize-trap=undefined', '-fno-sanitize=vptr,function', ...strictFlex(clang), h, ...(more.length ? ['-x', 'c', ...more] : []), '-o', `${work}/harness`,], { encoding: 'utf8', stdio: ['ignore', 'pipe', 'pipe'], maxBuffer: 1 << 26 });
392
393
  const why = (x) => String(x.stderr ?? x.message);
@@ -397,7 +398,8 @@ export function checkC(file, flags, c, read, r, sorts, opts, cpp) {
397
398
  const names = [...new Set([...why(x).matchAll(/undefined (?:reference to [`']|symbol: )_?([A-Za-z_]\w*)|"_([A-Za-z_]\w*)", referenced from/g)].map(m => m[1] ?? m[2]))];
398
399
  if (!names.length)
399
400
  return { ...empty, mismatch: `the file doesn't build with the check's harness: ${why(x).split('\n').filter(l => /error/.test(l)).slice(0, 6).join(' | ')}` };
400
- fs.writeFileSync(stubs, `void gdp_extern_called(const char *);\n${names.map(n => `void ${n}(void) { gdp_extern_called(${JSON.stringify(n)}); }`).join('\n')}\n`);
401
+ const out = new Set(read.leftOut ?? []);
402
+ fs.writeFileSync(stubs, `void gdp_extern_called(const char *);\n${names.map(n => (out.has(n) ? `void ${n}(void) {}` : `void ${n}(void) { gdp_extern_called(${JSON.stringify(n)}); }`)).join('\n')}\n`);
401
403
  try {
402
404
  link([stubs]);
403
405
  }
@@ -101,6 +101,7 @@ export type CodeSide = {
101
101
  } | {
102
102
  ok: false;
103
103
  error: string;
104
+ outside?: true;
104
105
  };
105
106
  reduce?: (snap: Snap, e: Ev, args: unknown[], params: Record<string, Raw>) => {
106
107
  refused: string;
@@ -518,6 +518,11 @@ export function drive(m, r, sorts, code, opts = {}) {
518
518
  try {
519
519
  if (isClass) {
520
520
  const self = side.self, c = code.call(self, e, args);
521
+ if (!c.ok && c.outside) {
522
+ next.stop = true;
523
+ ev.outside++;
524
+ return undefined;
525
+ }
521
526
  if (!c.ok)
522
527
  res = { refused: c.error };
523
528
  else
@@ -636,7 +641,9 @@ export function drive(m, r, sorts, code, opts = {}) {
636
641
  // A class's object: made by its constructor, or set to a snapshot.
637
642
  // (a param the precondition fixes from the others, a start's quotient: computed from them)
638
643
  const drawParams = () => {
639
- const ps = Object.fromEntries(m.params.filter(v => !v.derived).map(v => [v.name, v.note?.startsWith('Date.now()') ? rand(10_000) : draw(v.sort, sorts, v.name, rand, consts, bound, strs)]));
644
+ // (a param given as a natural (domains) is drawn as one, as an input is)
645
+ const nat = (v, x) => (opts.given?.[v.name] === 'nat' && typeof x === 'number' ? Math.abs(x) : x);
646
+ const ps = Object.fromEntries(m.params.filter(v => !v.derived).map(v => [v.name, v.note?.startsWith('Date.now()') ? rand(10_000) : nat(v, draw(v.sort, sorts, v.name, rand, consts, bound, strs))]));
640
647
  for (const v of m.params) {
641
648
  const d = v.derived;
642
649
  if (d)
@@ -1,7 +1,7 @@
1
1
  import { Refusal, pathOf } from "./extract-read.js";
2
- import { extractStep, node } from "./extract-step.js";
2
+ import { asset, extractStep, node } from "./extract-step.js";
3
3
  export { proveRule, proveSteps } from "./dsl.js";
4
- const here = (f) => new URL(`./ex/${f}`, import.meta.url).pathname;
4
+ const here = (f) => asset(`ex/${f}`);
5
5
  export function readElixir(file, module, elixir = 'elixir') {
6
6
  const cp = node('node:child_process'), path = node('node:path');
7
7
  let out;
@@ -1,5 +1,5 @@
1
1
  import { Outside, constantsOf, draw, drive, evalTerm } from "./extract-check.js";
2
- import { stubbed } from "./extract-step.js";
2
+ import { openHarness, stubbed } from "./extract-step.js";
3
3
  import { node } from "./extract-go.js";
4
4
  // --- the harness ------------------------------------------------------------------------------------------------------
5
5
  // Go source beside the package: a state set from JSON and read back as JSON, leaf by leaf; each method called with its
@@ -392,13 +392,11 @@ export function checkGo(dir, pkg, read, r, sorts, gopts) {
392
392
  // it, call a method on it), every state compared; `count` reads the coverage after the harness exits.
393
393
  export function speak(work, bin, env, pkg, read, r, sorts, opts, count) {
394
394
  const m = read.model, bound = opts.bound ?? 12;
395
- const fs = node('node:fs'), cp = node('node:child_process');
395
+ const fs = node('node:fs');
396
396
  let child, wi = -1, ro = -1;
397
397
  try {
398
- cp.execFileSync('mkfifo', [`${work}/in`, `${work}/out`], {});
399
- child = node('node:child_process').spawn(bin, [`${work}/in`, `${work}/out`], { stdio: 'ignore', env });
400
- wi = fs.openSync(`${work}/in`, 'w');
401
- ro = fs.openSync(`${work}/out`, 'r');
398
+ ;
399
+ ({ child, wi, ro } = openHarness(work, bin, [], { stdio: 'ignore', env }));
402
400
  const buf = new Uint8Array(1 << 20), dec = new TextDecoder();
403
401
  let pend = '';
404
402
  const line = () => {
@@ -187,11 +187,14 @@ export type GoOptions = {
187
187
  check?: GoCheckOptions;
188
188
  fails?: Record<string, string>;
189
189
  strict?: boolean;
190
+ answers?: Record<string, string>;
191
+ skip?: string[];
190
192
  };
191
193
  export type GoRead = {
192
194
  answers?: (Answer & {
193
195
  range?: [number, number];
194
196
  })[];
197
+ leftOut?: string[];
195
198
  ctor?: {
196
199
  name: string;
197
200
  t: number;
@@ -37,7 +37,7 @@
37
37
  import * as I from "./extract-ir.js";
38
38
  import { Refusal, pathOf } from "./extract-read.js";
39
39
  import { fromModel } from "./extract.js";
40
- import { Stepper, iteTerm, mapWritesOf, phiP, rangeLaws, rangeOf, varTerm } from "./extract-step.js";
40
+ import { asset, Stepper, iteTerm, mapWritesOf, phiP, rangeLaws, rangeOf, varTerm } from "./extract-step.js";
41
41
  import { checkGo } from "./extract-go-check.js";
42
42
  export { proveRule, proveSteps } from "./dsl.js";
43
43
  const refuse = (x, what) => { throw new Refusal(typeof x === 'string' ? x : x.p || '?', what); };
@@ -52,7 +52,7 @@ class Go {
52
52
  this.pkg = pkg;
53
53
  this.opts = opts;
54
54
  const mod = { lang: pkg.lang ?? 'go', file: pkg.files[0]?.name ?? 'go', path: pkg.dir ? `${pkg.dir}/${pkg.files[0]?.name ?? ''}` : '', module: pkg.package, root: pkg.dir ?? '', entries: [], recs: {}, funcs: this.funcs, split: false };
55
- this.g = new Stepper(mod, { entry: opts.entry, ...(opts.onError ? { onError: opts.onError } : {}) }, inf);
55
+ this.g = new Stepper(mod, { entry: opts.entry, ...(opts.onError ? { onError: opts.onError } : {}), ...(opts.answers ? { answers: opts.answers } : {}), ...(opts.skip ? { skip: opts.skip } : {}) }, inf);
56
56
  for (const f of pkg.funcs)
57
57
  this.funcs[`${f.recv?.type ?? ''}.${f.name}`] = this.fn(f);
58
58
  }
@@ -951,7 +951,7 @@ function readGo1(pkg, o, go) {
951
951
  // Unsigned inputs are naturals (the input's kind); a state variable's sort is the printer's to decide (a natural where
952
952
  // every write is proven one: a wrap by cases may not be, though it stays within the type, which its law says).
953
953
  const unsigned = [...g.ints].filter(([n, ty]) => { const [lo, hi] = rangeOf(ty); return lo === 0 && hi > 0 && (g.inputs.some(v => v.name === n) || cparams.some(v => v.name === n)); }).map(([n]) => n);
954
- return { ...(pkg.ctor ? { ctor: ctorArgs } : {}), model, edges: g.edges, unsigned, leaves: go.leaves.filter(l => l.kind === 'frame' || state.some(v => v.name === l.name) || maps.some(d => d.name === l.name) || lists.some(d => d.name === l.name)), spans: [...g.spans.values()], entry: opts.entry, methods, ...(answers.length ? { answers } : {}) };
954
+ return { ...(pkg.ctor ? { ctor: ctorArgs } : {}), ...(g.leftOut.size ? { leftOut: [...g.leftOut] } : {}), model, edges: g.edges, unsigned, leaves: go.leaves.filter(l => l.kind === 'frame' || state.some(v => v.name === l.name) || maps.some(d => d.name === l.name) || lists.some(d => d.name === l.name)), spans: [...g.spans.values()], entry: opts.entry, methods, ...(answers.length ? { answers } : {}) };
955
955
  }
956
956
  function termOf(v, at) {
957
957
  if (v.t === 'num')
@@ -1028,7 +1028,7 @@ export const node = (id) => { const m = proc?.getBuiltinModule?.(id); if (!m)
1028
1028
  // The reader, built once per version of its source (into the system's temporary directory).
1029
1029
  export function readerBinary() {
1030
1030
  const fs = node('node:fs'), cp = node('node:child_process'), os = node('node:os'), crypto = node('node:crypto');
1031
- const dir = new URL('./go/', import.meta.url).pathname;
1031
+ const dir = asset('go/');
1032
1032
  const src = fs.readFileSync(`${dir}reader.go`, 'utf8'), h = crypto.createHash('sha256').update(src).digest('hex').slice(0, 12);
1033
1033
  const bin = `${os.tmpdir()}/gdp-goreader-${h}`;
1034
1034
  if (!fs.existsSync(bin))
@@ -1,7 +1,7 @@
1
1
  import { Refusal, pathOf } from "./extract-read.js";
2
- import { entryNames, extractStep, node } from "./extract-step.js";
2
+ import { asset, entryNames, extractStep, node } from "./extract-step.js";
3
3
  export { proveRule, proveSteps } from "./dsl.js";
4
- const here = (f) => new URL(`./jvm/${f}`, import.meta.url).pathname;
4
+ const here = (f) => asset(`jvm/${f}`);
5
5
  const TOOLS = ['Jvm.java', 'JavaReader.java', 'Harness.java', 'Rt.java'];
6
6
  // (a JVM's stack trace: its exception's line first)
7
7
  const errText = (e) => { const ls = String(e.stderr || e.stdout || e.message).split('\n').filter(l => l.trim() && !/^\s+at /.test(l)); return ls.slice(-3).join(' | ').slice(0, 600); };
@@ -137,13 +137,16 @@ function answerSites(mod, keys) {
137
137
  return out;
138
138
  }
139
139
  const BOXES = { int: 'java.lang.Integer', long: 'java.lang.Long', short: 'java.lang.Short', byte: 'java.lang.Byte', char: 'java.lang.Character', boolean: 'java.lang.Boolean', float: 'java.lang.Float', double: 'java.lang.Double' };
140
+ const STATED = { int: 'int', long: 'long', short: 'short', byte: 'byte', char: 'char', float: 'double', double: 'double', bool: 'boolean', boolean: 'boolean', str: 'java.lang.String', String: 'java.lang.String', i32: 'int', i64: 'long' };
140
141
  const KT = { int: 'Int', long: 'Long', short: 'Short', byte: 'Byte', char: 'Char', boolean: 'Boolean', float: 'Float', double: 'Double', 'java.lang.String': 'String' };
141
142
  // The code compiled for the check: a copy of the file with the clock's and the answered calls' sites rewritten.
142
143
  function compiled(lang, mod, read, o, made) {
143
144
  const fs = node('node:fs'), cp = node('node:child_process'), os = node('node:os'), path = node('node:path');
144
145
  const j = jvmOf(mod), kotlin = lang === 'kotlin';
146
+ // (a call of a generic result, a type variable's: the answer given in the type it is stated in)
147
+ const sortOf = new Map(read.answers.map(a => [a.key, STATED[a.sort.replace(/\s*\|\s*None$|\?$/, '')]]));
145
148
  const sites = [...j.rewrites.map(r => ({ span: r.span, text: 'gdp.Rt.now()' })), ...answerSites(mod, read.answers.filter(a => !a.patch.store).map(a => a.key)).map(s => {
146
- const t = s.jt.replace(/\?$/, '').replace(/<.*$/, ''), box = BOXES[t] ?? t;
149
+ const t0 = s.jt.replace(/\?$/, '').replace(/<.*$/, ''), t = (t0 === 'java.lang.Object' || !(t0 in BOXES || t0.includes('.'))) ? sortOf.get(s.key) ?? t0 : t0, box = BOXES[t] ?? t;
147
150
  return { span: s.span, text: kotlin ? `(gdp.Rt.answer(${JSON.stringify(s.key)}, ${box}::class.java) as ${KT[t] ?? t.split('.').pop()}${s.jt.endsWith('?') ? '?' : ''})` : `((${box}) gdp.Rt.answer(${JSON.stringify(s.key)}, ${box}.class))` };
148
151
  })];
149
152
  if (o.prebuilt)
@@ -1,7 +1,7 @@
1
1
  import { Refusal, pathOf } from "./extract-read.js";
2
- import { entryNames, extractStep, node } from "./extract-step.js";
2
+ import { asset, entryNames, extractStep, node } from "./extract-step.js";
3
3
  export { proveRule, proveSteps } from "./dsl.js";
4
- const here = (f) => new URL(`./py/${f}`, import.meta.url).pathname;
4
+ const here = (f) => asset(`py/${f}`);
5
5
  // The module as the reader lowers it (the names given and the module's functions).
6
6
  export function readPython(file, names, opts = {}) {
7
7
  const cp = node('node:child_process'), path = node('node:path');
@@ -1,7 +1,7 @@
1
1
  import { Refusal, pathOf } from "./extract-read.js";
2
- import { entryNames, extractStep, node } from "./extract-step.js";
2
+ import { asset, entryNames, extractStep, node } from "./extract-step.js";
3
3
  export { proveRule, proveSteps } from "./dsl.js";
4
- const here = (f) => new URL(`./rb/${f}`, import.meta.url).pathname;
4
+ const here = (f) => asset(`rb/${f}`);
5
5
  // The file as the reader lowers it (the class named).
6
6
  export function readRuby(file, names, opts = {}) {
7
7
  const cp = node('node:child_process'), path = node('node:path');
@@ -1,11 +1,11 @@
1
1
  import { Refusal, pathOf } from "./extract-read.js";
2
- import { entryNames, extractStep, node, stubbed } from "./extract-step.js";
2
+ import { asset, entryNames, extractStep, node, stubbed } from "./extract-step.js";
3
3
  export { proveRule, proveSteps } from "./dsl.js";
4
4
  const proc = globalThis.process;
5
5
  // The reader, built once per version of its source (into the system's temporary directory).
6
6
  export function rsReader(cargo = 'cargo') {
7
7
  const fs = node('node:fs'), cp = node('node:child_process'), os = node('node:os'), crypto = node('node:crypto');
8
- const dir = new URL('./rs/', import.meta.url).pathname;
8
+ const dir = asset('rs/');
9
9
  const h = crypto.createHash('sha256').update(fs.readFileSync(`${dir}src/main.rs`, 'utf8') + fs.readFileSync(`${dir}Cargo.toml`, 'utf8')).digest('hex').slice(0, 12);
10
10
  const target = `${os.tmpdir()}/gdp-rsreader-${h}`, bin = `${target}/release/gdp-rsreader`;
11
11
  if (!fs.existsSync(bin))
@@ -177,12 +177,15 @@ pub(crate) mod __gdp_harness {
177
177
  // An answered call's value: the request's input for it (each answered call rewritten to crate::__gdp_answer).
178
178
  static ANS: std::sync::Mutex<Option<Value>> = std::sync::Mutex::new(None);
179
179
  pub(crate) trait GdpAns { fn of(v: &Value) -> Self; }
180
- macro_rules! gdp_int { ($($t:ty),*) => { $(impl GdpAns for $t { fn of(v: &Value) -> Self { int(val(v)).ok().and_then(|n| <$t>::try_from(n).ok()).unwrap_or_default() } })* } }
180
+ // (an answer outside the call's type, a type stated wider than the code's: a request the code can't be given)
181
+ pub(crate) struct GdpOutside(pub(crate) String);
182
+ macro_rules! gdp_int { ($($t:ty),*) => { $(impl GdpAns for $t { fn of(v: &Value) -> Self { match int(val(v)) { Ok(n) => <$t>::try_from(n).unwrap_or_else(|_| std::panic::panic_any(GdpOutside(format!("{} outside {}", n, stringify!($t))))), Err(_) => Default::default() } } })* } }
181
183
  gdp_int!(i8, i16, i32, i64, i128, isize, u8, u16, u32, u64, u128, usize);
182
184
  impl GdpAns for bool { fn of(v: &Value) -> Self { val(v).as_bool().unwrap_or(false) } }
183
185
  impl GdpAns for String { fn of(v: &Value) -> Self { val(v).as_str().unwrap_or("").to_string() } }
184
186
  impl<T: GdpAns> GdpAns for Option<T> { fn of(v: &Value) -> Self { if v.get("none").and_then(|x| x.as_bool()) == Some(true) { None } else { Some(T::of(v)) } } }
185
- pub(crate) fn answer<T: GdpAns>(k: &str) -> T { T::of(ANS.lock().unwrap().as_ref().and_then(|a| a.get(k)).unwrap_or(&Value::Null)) }
187
+ // (the value taken out of the lock first: an answer outside its type panics, which must leave the lock usable)
188
+ pub(crate) fn answer<T: GdpAns>(k: &str) -> T { let v = ANS.lock().unwrap_or_else(|e| e.into_inner()).as_ref().and_then(|a| a.get(k).cloned()).unwrap_or(Value::Null); T::of(&v) }
186
189
  fn base() -> std::time::Instant { *BASE.get_or_init(|| std::time::Instant::now() + std::time::Duration::from_secs(1u64 << 31)) }
187
190
  pub(crate) fn now() -> std::time::Instant { inst(NOW.load(std::sync::atomic::Ordering::SeqCst) as i128) }
188
191
  fn inst(n: i128) -> std::time::Instant { if n >= 0 { base() + std::time::Duration::from_nanos(n as u64) } else { base() - std::time::Duration::from_nanos((-n) as u64) } }
@@ -216,7 +219,7 @@ pub(crate) mod __gdp_harness {
216
219
  "call" => {
217
220
  let i = req["id"].as_u64().unwrap() as usize - 1;
218
221
  NOW.store(int(&req["now"]).unwrap_or(0) as i64, std::sync::atomic::Ordering::SeqCst);
219
- *ANS.lock().unwrap() = Some(req["answers"].clone());
222
+ *ANS.lock().unwrap_or_else(|e| e.into_inner()) = Some(req["answers"].clone());
220
223
  let m = req["m"].as_str().unwrap().to_string();
221
224
  let a = req["a"].clone();
222
225
  let o = &mut objs[i];
@@ -224,6 +227,7 @@ pub(crate) mod __gdp_harness {
224
227
  Ok(Ok(Ok(v))) => json!({"out": v}),
225
228
  Ok(Ok(Err(e))) => json!({"out": null, "err": e}),
226
229
  Ok(Err(bad)) => json!({"out": null, "bad": bad}),
230
+ Err(p) if p.downcast_ref::<GdpOutside>().is_some() => json!({"out": null, "outside": p.downcast_ref::<GdpOutside>().unwrap().0}),
227
231
  Err(p) => json!({"out": null, "err": format!("panic: {}", p.downcast_ref::<String>().cloned().or_else(|| p.downcast_ref::<&str>().map(|s| s.to_string())).unwrap_or_default())}),
228
232
  }
229
233
  }
@@ -257,8 +261,9 @@ function harnessFor(dir, mod, read, opts) {
257
261
  // The clock: Instant::now() read through the harness (the request's time), the code's own calls rewritten first.
258
262
  const lib = fs.existsSync(`${work}/src/lib.rs`) ? 'src/lib.rs' : 'src/main.rs';
259
263
  const walk = (d) => fs.readdirSync(d, { withFileTypes: true }).flatMap((e) => { const x = e; return x.isDirectory() ? walk(`${d}/${x.name}`) : x.name.endsWith('.rs') ? [`${d}/${x.name}`] : []; });
260
- // (each answered call rewritten to the harness's answer, from the crate's own text, before the clock's)
261
- for (const [f, t] of stubbed(read, f => fs.readFileSync(`${dir}/${f}`, 'utf8'), a => `crate::__gdp_answer(${JSON.stringify(a.key)})`))
264
+ // (each answered call rewritten to the harness's answer, from the crate's own text, before the clock's; the call
265
+ // kept in a branch never taken, so the answer is of the type the call is, which a binding needn't write)
266
+ for (const [f, t] of stubbed(read, f => fs.readFileSync(`${dir}/${f}`, 'utf8'), (a, _, call) => `(if false { ${call} } else { crate::__gdp_answer(${JSON.stringify(a.key)}) })`))
262
267
  fs.writeFileSync(`${work}/${f}`, t);
263
268
  for (const f of walk(`${work}/src`)) {
264
269
  const s = fs.readFileSync(f, 'utf8');
@@ -29,7 +29,7 @@ import { allowed, watch } from "./watch.js";
29
29
  import { kindOfVar } from "./extract-check.js";
30
30
  import { Refusal, pathOf } from "./extract-read.js";
31
31
  const refuse = (where, what) => { throw new Refusal(where, what); };
32
- import { checkStep, node, readStep, stepNames } from "./extract-step.js";
32
+ import { asset, checkStep, node, readStep, stepNames } from "./extract-step.js";
33
33
  export { proveRule, proveSteps } from "./dsl.js";
34
34
  export const MOD = 'W256$';
35
35
  // (the width the check runs the rule at: past 2^256's half the code's values are the rule's near W)
@@ -815,7 +815,7 @@ export function extractSolidity(at, opts = {}) {
815
815
  const slots = Object.fromEntries(out.storageLayout.storage.map(s => [s.label, { slot: s.slot, offset: s.offset, bytes: Number(types[s.type]?.numberOfBytes ?? 32), map: types[s.type]?.encoding === 'mapping', nested: meta.nested.includes(s.label), type: s.type }]));
816
816
  const kinds = Object.fromEntries(meta.fields.map(f => [f.name, kindOf(f.t, f.sol)]));
817
817
  const mapKeys = Object.fromEntries(meta.fields.filter(f => f.sol.startsWith('mapping(')).map(f => [f.name, keyKinds(f.sol)]));
818
- return { cmd: opts.python ?? 'python3', args: [new URL('./sol/harness.py', import.meta.url).pathname], env: { ...(opts.anvil ? { GDP_ANVIL: opts.anvil } : {}) },
818
+ return { cmd: opts.python ?? 'python3', args: [asset('sol/harness.py')], env: { ...(opts.anvil ? { GDP_ANVIL: opts.anvil } : {}) },
819
819
  hello: { sol: { creation: out.evm.bytecode.object, abi: out.abi, ids: out.evm.methodIdentifiers, slots, kinds, mapKeys, havoc: meta.nested, havocBy: havocBy(mod), mod: MOD, minW: meta.minW, addrBits: meta.addrBits, entries: meta.entries, ctor: meta.ctor, ether: meta.ether } } };
820
820
  };
821
821
  // (methods: the external functions that may write the state, unless named)
@@ -895,7 +895,7 @@ export function extractSolidity(at, opts = {}) {
895
895
  return { ...rx, read: rread, names: stepNames(rread), quiet: 'pending$', ...(replays ? { replay: (run, law) => replays(run, law) } : {}) };
896
896
  }
897
897
  function compileReplay(o) {
898
- const c = compile(new URL('./sol/Replay.sol', import.meta.url).pathname, { ...o, root: new URL('./sol/', import.meta.url).pathname });
898
+ const c = compile(asset('sol/Replay.sol'), { ...o, root: asset('sol/') });
899
899
  const k = c.contracts[c.paths.get(c.main)];
900
900
  return { agent: k.Agent.evm.deployedBytecode.object, director: k.Director.evm.deployedBytecode.object };
901
901
  }
@@ -1013,7 +1013,7 @@ function replayer(c) {
1013
1013
  let out;
1014
1014
  try {
1015
1015
  fs.writeFileSync(`${dir}/run.json`, JSON.stringify({ sol: c.hello, leaves: c.leaves, ctorSpec: c.ctor, ctor: ctorArgs, agent: c.replay.agent, director: c.replay.director, groups }));
1016
- out = JSON.parse(cp.execFileSync(c.opts.python ?? 'python3', [new URL('./sol/harness.py', import.meta.url).pathname, '--replay', `${dir}/run.json`], { encoding: 'utf8', maxBuffer: 1 << 26, stdio: ['ignore', 'pipe', 'pipe'], env: { ...env(), ...(c.opts.anvil ? { GDP_ANVIL: c.opts.anvil } : {}) } }));
1016
+ out = JSON.parse(cp.execFileSync(c.opts.python ?? 'python3', [asset('sol/harness.py'), '--replay', `${dir}/run.json`], { encoding: 'utf8', maxBuffer: 1 << 26, stdio: ['ignore', 'pipe', 'pipe'], env: { ...env(), ...(c.opts.anvil ? { GDP_ANVIL: c.opts.anvil } : {}) } }));
1017
1017
  }
1018
1018
  catch (e) {
1019
1019
  return no(`the replay didn't run (${String(e.message).slice(0, 300)})`);
@@ -779,6 +779,7 @@ export declare class Stepper {
779
779
  answer(key: string, names: string[], patch: Patch | undefined, at: SX, p: Path, awaited: boolean, type?: string | SType, how?: string): [V, Path];
780
780
  passing(key: string, name: string, patch: Patch | undefined, at: SX, p: Path, awaited: boolean): Path;
781
781
  readonly pend: Map<string, Pend>;
782
+ readonly leftOut: Set<string>;
782
783
  readonly returnedBy: Map<string, {
783
784
  id: string;
784
785
  roots: string[];
@@ -968,6 +969,14 @@ export declare const varTerm: (v: Var) => Term;
968
969
  export declare function iteTerm(c: B, a: Term, b: Term): Term;
969
970
  type Raw = number | boolean | string;
970
971
  export declare const node: <T>(id: string) => T;
972
+ export declare function asset(rel: string): string;
973
+ export declare function openHarness(work: string, cmd: string, args: string[], o: Record<string, unknown>): {
974
+ child: {
975
+ kill: () => void;
976
+ };
977
+ wi: number;
978
+ ro: number;
979
+ };
971
980
  export type Harness = {
972
981
  cmd: string;
973
982
  args: string[];