capdag 1.363.10 → 1.371.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -17,7 +17,7 @@ npm install capdag
17
17
 
18
18
  The package is an ES module and needs Node.js 20 or newer. Dispatch,
19
19
  acceptance, equivalence and specificity are decided by code generated from the
20
- proved model ([formal foundations](https://capdag.com/docs/02-formal-foundations/)),
20
+ proved model ([formal foundations](https://machinefabric.com/capdag/docs/02-formal-foundations/)),
21
21
  which runs as WebAssembly: it is instantiated when the package is first
22
22
  imported, so importing it waits for that (top-level `await`), and a CommonJS
23
23
  `require` cannot load it.
@@ -53,7 +53,7 @@ equivalence, conformance, dispatch, and ranking instead of string surgery.
53
53
  - [`RULES.md`](RULES.md) records package-specific construction rules.
54
54
 
55
55
  The normative semantics and terminology live in the
56
- [CapDAG specification](https://capdag.com/docs/01-overview/). Source comments and
56
+ [CapDAG specification](https://machinefabric.com/capdag/docs/01-overview/). Source comments and
57
57
  exports are the JavaScript API reference.
58
58
 
59
59
  ## Use it in a browser
package/formal/index.d.ts CHANGED
@@ -1,6 +1,163 @@
1
- // Generated by lungo 1.78.3254 from Lean 4.34.1 for program capdagFormal. Do not edit.
1
+ // Generated by lungo 1.82.64 from Lean 4.34.1 for program capdagFormal. Do not edit.
2
2
  import * as L from "lungo-ts";
3
3
 
4
+ /** Lean's CapDAG.Bifaci.Credit.Gate. */
5
+ export interface Gate {
6
+ readonly available: bigint;
7
+ readonly closed: L.Option<string>;
8
+ }
9
+ export function gateType(): L.Type<Gate>;
10
+
11
+ /** Lean's CapDAG.Bifaci.Credit.Acquire. */
12
+ export type Acquire =
13
+ | { readonly kind: "acquired"; readonly gate: Gate }
14
+ | { readonly kind: "wait" }
15
+ | { readonly kind: "closed"; readonly reason: string }
16
+ ;
17
+ export function acquireType(): L.Type<Acquire>;
18
+
19
+ /** Lean's CapDAG.Bifaci.Credit.Window. */
20
+ export interface Window {
21
+ readonly remaining: bigint;
22
+ readonly pending: bigint;
23
+ readonly batch: bigint;
24
+ }
25
+ export function windowType(): L.Type<Window>;
26
+
27
+ /** Lean's CapDAG.Bifaci.Credit.Arrival. */
28
+ export type CreditArrival =
29
+ | { readonly kind: "accepted"; readonly window: Window }
30
+ | { readonly kind: "violation" }
31
+ ;
32
+ export function creditArrivalType(): L.Type<CreditArrival>;
33
+
34
+ /** Lean's CapDAG.Bifaci.Credit.Granted. */
35
+ export interface Granted {
36
+ readonly window: Window;
37
+ readonly grant: bigint;
38
+ }
39
+ export function grantedType(): L.Type<Granted>;
40
+
41
+ /** Lean's CapDAG.Bifaci.Flow.FrameType. */
42
+ export type FrameType =
43
+ | { readonly kind: "hello" }
44
+ | { readonly kind: "req" }
45
+ | { readonly kind: "chunk" }
46
+ | { readonly kind: "fin" }
47
+ | { readonly kind: "log" }
48
+ | { readonly kind: "err" }
49
+ | { readonly kind: "heartbeat" }
50
+ | { readonly kind: "streamStart" }
51
+ | { readonly kind: "streamEnd" }
52
+ | { readonly kind: "relayNotify" }
53
+ | { readonly kind: "relayState" }
54
+ | { readonly kind: "cancel" }
55
+ | { readonly kind: "credit" }
56
+ | { readonly kind: "closeStream" }
57
+ ;
58
+ export function frameTypeType(): L.Type<FrameType>;
59
+
60
+ /** Lean's CapDAG.Bifaci.Flow.Reorder. */
61
+ export interface Reorder {
62
+ readonly expected: bigint;
63
+ readonly held: Array<bigint>;
64
+ }
65
+ export function reorderType(): L.Type<Reorder>;
66
+
67
+ /** Lean's CapDAG.Bifaci.Flow.Accepted. */
68
+ export type Accepted =
69
+ | { readonly kind: "deliver"; readonly flow: Reorder; readonly seqs: Array<bigint> }
70
+ | { readonly kind: "hold"; readonly flow: Reorder }
71
+ | { readonly kind: "stale" }
72
+ | { readonly kind: "duplicate" }
73
+ | { readonly kind: "overflow" }
74
+ ;
75
+ export function acceptedType(): L.Type<Accepted>;
76
+
77
+ /** Lean's CapDAG.Bifaci.Pools.State. */
78
+ export interface State {
79
+ readonly pools: Array<Pool>;
80
+ readonly queue: Array<Waiter>;
81
+ readonly next: bigint;
82
+ }
83
+ export function stateType(): L.Type<State>;
84
+
85
+ /** Lean's CapDAG.Bifaci.Pools.Waiter. */
86
+ export interface Waiter {
87
+ readonly ticket: bigint;
88
+ readonly chain: Array<string>;
89
+ }
90
+ export function waiterType(): L.Type<Waiter>;
91
+
92
+ /** Lean's CapDAG.Bifaci.Pools.Arrival. */
93
+ export type PoolsArrival =
94
+ | { readonly kind: "admitted"; readonly state: State }
95
+ | { readonly kind: "queued"; readonly state: State; readonly ticket: bigint; readonly position: bigint }
96
+ | { readonly kind: "unknownPool"; readonly name: string }
97
+ ;
98
+ export function poolsArrivalType(): L.Type<PoolsArrival>;
99
+
100
+ /** Lean's CapDAG.Bifaci.Pools.Patience. */
101
+ export type Patience =
102
+ | { readonly kind: "unbounded" }
103
+ | { readonly kind: "atMost"; readonly remaining: bigint }
104
+ | { readonly kind: "exhausted" }
105
+ ;
106
+ export function patienceType(): L.Type<Patience>;
107
+
108
+ /** Lean's CapDAG.Bifaci.Request.Phase. */
109
+ export type Phase =
110
+ | { readonly kind: "created" }
111
+ | { readonly kind: "streaming" }
112
+ ;
113
+ export function phaseType(): L.Type<Phase>;
114
+
115
+ /** Lean's CapDAG.Bifaci.Request.Emitted. */
116
+ export type Emitted =
117
+ | { readonly kind: "streamStart"; readonly stream: string }
118
+ | { readonly kind: "chunk"; readonly stream: string; readonly index: bigint }
119
+ | { readonly kind: "streamEnd"; readonly stream: string; readonly count: L.Option<bigint> }
120
+ | { readonly kind: "fin" }
121
+ | { readonly kind: "err" }
122
+ | { readonly kind: "other" }
123
+ ;
124
+ export function emittedType(): L.Type<Emitted>;
125
+
126
+ /** Lean's CapDAG.Bifaci.Request.Violation. */
127
+ export type Violation =
128
+ | { readonly kind: "afterEnd" }
129
+ | { readonly kind: "streamRestarted"; readonly stream: string }
130
+ | { readonly kind: "streamNotOpen"; readonly stream: string }
131
+ | { readonly kind: "chunkOutOfPlace"; readonly stream: string; readonly expected: bigint; readonly got: bigint }
132
+ | { readonly kind: "chunkCountWrong"; readonly stream: string; readonly sent: bigint; readonly said: bigint }
133
+ | { readonly kind: "endWithOpenStream"; readonly stream: string }
134
+ ;
135
+ export function violationType(): L.Type<Violation>;
136
+
137
+ /** Lean's CapDAG.Bifaci.Request.Disposition. */
138
+ export type Disposition =
139
+ | { readonly kind: "route" }
140
+ | { readonly kind: "straggler" }
141
+ | { readonly kind: "noRoute" }
142
+ ;
143
+ export function dispositionType(): L.Type<Disposition>;
144
+
145
+ /** Lean's CapDAG.Bifaci.Request.Terminal. */
146
+ export type Terminal =
147
+ | { readonly kind: "finished" }
148
+ | { readonly kind: "failed" }
149
+ | { readonly kind: "cancelled" }
150
+ | { readonly kind: "masterDied" }
151
+ ;
152
+ export function terminalType(): L.Type<Terminal>;
153
+
154
+ /** Lean's CapDAG.Bifaci.Request.Write. */
155
+ export type Write =
156
+ | { readonly kind: "send"; readonly ends: boolean }
157
+ | { readonly kind: "suppress" }
158
+ ;
159
+ export function writeType(): L.Type<Write>;
160
+
4
161
  /** Lean's CapDAG.Exec.WfCap. */
5
162
  export interface WfCap {
6
163
  readonly input: Wf;
@@ -55,6 +212,14 @@ export type Constraint =
55
212
  ;
56
213
  export function constraintType(): L.Type<Constraint>;
57
214
 
215
+ /** Lean's CapDAG.Bifaci.Pools.Pool. */
216
+ export interface Pool {
217
+ readonly name: string;
218
+ readonly capacity: bigint;
219
+ readonly active: bigint;
220
+ }
221
+ export function poolType(): L.Type<Pool>;
222
+
58
223
  /** Lean's CapDAG.Exec.WfAsk. */
59
224
  export type WfAsk =
60
225
  | { readonly kind: "unknown" }
@@ -72,6 +237,82 @@ export const leanTypes: {
72
237
  /** The Lean program capdagFormal. */
73
238
  export class CapdagFormal {
74
239
  private constructor();
240
+ /** Lean's CapDAG.Bifaci.Credit.Gate.acquire : CapDAG.Bifaci.Credit.Gate → Nat → CapDAG.Bifaci.Credit.Acquire */
241
+ acquire(g: Gate, n: bigint): Acquire;
242
+ /** Lean's CapDAG.Bifaci.Credit.Gate.close : CapDAG.Bifaci.Credit.Gate → String → CapDAG.Bifaci.Credit.Gate */
243
+ close(g: Gate, reason: string): Gate;
244
+ /** Lean's CapDAG.Bifaci.Credit.Gate.grant : CapDAG.Bifaci.Credit.Gate → Nat → CapDAG.Bifaci.Credit.Gate */
245
+ grant(g: Gate, n: bigint): Gate;
246
+ /** Lean's CapDAG.Bifaci.Credit.Gate.opened : Nat → CapDAG.Bifaci.Credit.Gate */
247
+ gateOpened(window: bigint): Gate;
248
+ /** Lean's CapDAG.Bifaci.Credit.Window.arrive : CapDAG.Bifaci.Credit.Window → CapDAG.Bifaci.Credit.Arrival */
249
+ windowArrive(w_: Window): CreditArrival;
250
+ /** Lean's CapDAG.Bifaci.Credit.Window.consume : CapDAG.Bifaci.Credit.Window → CapDAG.Bifaci.Credit.Granted */
251
+ consume(w_: Window): Granted;
252
+ /** Lean's CapDAG.Bifaci.Credit.Window.continued : CapDAG.Bifaci.Credit.Window → CapDAG.Bifaci.Credit.Granted */
253
+ continued(w_: Window): Granted;
254
+ /** Lean's CapDAG.Bifaci.Credit.Window.flush : CapDAG.Bifaci.Credit.Window → CapDAG.Bifaci.Credit.Granted */
255
+ flush(w_: Window): Granted;
256
+ /** Lean's CapDAG.Bifaci.Credit.Window.opened : Nat → CapDAG.Bifaci.Credit.Window */
257
+ windowOpened(window: bigint): Window;
258
+ /** Lean's CapDAG.Bifaci.Credit.grantTarget : List (Option String) → Option String → Option (Option String) */
259
+ grantTarget(streams: Array<L.Option<string>>, named: L.Option<string>): L.Option<L.Option<string>>;
260
+ /** Lean's CapDAG.Bifaci.Credit.negotiate : Nat → Nat → Option Nat */
261
+ negotiate(ours: bigint, theirs: bigint): L.Option<bigint>;
262
+ /** Lean's CapDAG.Bifaci.Flow.FrameType.code : CapDAG.Bifaci.Flow.FrameType → Nat */
263
+ code(a: FrameType): bigint;
264
+ /** Lean's CapDAG.Bifaci.Flow.FrameType.isFlow : CapDAG.Bifaci.Flow.FrameType → Bool */
265
+ isFlow(a: FrameType): boolean;
266
+ /** Lean's CapDAG.Bifaci.Flow.FrameType.isTerminal : CapDAG.Bifaci.Flow.FrameType → Bool */
267
+ isTerminal(a: FrameType): boolean;
268
+ /** Lean's CapDAG.Bifaci.Flow.FrameType.ofCode : Nat → Option CapDAG.Bifaci.Flow.FrameType */
269
+ ofCode(a: bigint): L.Option<FrameType>;
270
+ /** Lean's CapDAG.Bifaci.Flow.Reorder.accept : CapDAG.Bifaci.Flow.Reorder → Nat → Nat → CapDAG.Bifaci.Flow.Accepted */
271
+ accept(r_: Reorder, seq: bigint, limit: bigint): Accepted;
272
+ /** Lean's CapDAG.Bifaci.Flow.Reorder.start : CapDAG.Bifaci.Flow.Reorder */
273
+ start(): Reorder;
274
+ /** Lean's CapDAG.Bifaci.Pools.State.admit : CapDAG.Bifaci.Pools.State → Nat → Option CapDAG.Bifaci.Pools.State */
275
+ admit(s: State, ticket: bigint): L.Option<State>;
276
+ /** Lean's CapDAG.Bifaci.Pools.State.admitNext : CapDAG.Bifaci.Pools.State → Option (CapDAG.Bifaci.Pools.Waiter × CapDAG.Bifaci.Pools.State) */
277
+ admitNext(s: State): L.Option<[Waiter, State]>;
278
+ /** Lean's CapDAG.Bifaci.Pools.State.arrive : CapDAG.Bifaci.Pools.State → List String → CapDAG.Bifaci.Pools.Arrival */
279
+ stateArrive(s: State, chain: Array<string>): PoolsArrival;
280
+ /** Lean's CapDAG.Bifaci.Pools.State.empty : CapDAG.Bifaci.Pools.State */
281
+ empty(): State;
282
+ /** Lean's CapDAG.Bifaci.Pools.State.hasRoom : CapDAG.Bifaci.Pools.State → List String → Bool */
283
+ hasRoom(s: State, chain: Array<string>): boolean;
284
+ /** Lean's CapDAG.Bifaci.Pools.State.heldBack : CapDAG.Bifaci.Pools.State → String → Nat */
285
+ heldBack(s: State, name: string): bigint;
286
+ /** Lean's CapDAG.Bifaci.Pools.State.join : CapDAG.Bifaci.Pools.State → List String → CapDAG.Bifaci.Pools.Arrival */
287
+ join(s: State, chain: Array<string>): PoolsArrival;
288
+ /** Lean's CapDAG.Bifaci.Pools.State.leave : CapDAG.Bifaci.Pools.State → Nat → CapDAG.Bifaci.Pools.State */
289
+ leave(s: State, ticket: bigint): State;
290
+ /** Lean's CapDAG.Bifaci.Pools.State.position : CapDAG.Bifaci.Pools.State → Nat → Nat */
291
+ position(s: State, ticket: bigint): bigint;
292
+ /** Lean's CapDAG.Bifaci.Pools.State.release : CapDAG.Bifaci.Pools.State → List String → CapDAG.Bifaci.Pools.State */
293
+ release(s: State, chain: Array<string>): State;
294
+ /** Lean's CapDAG.Bifaci.Pools.State.setCapacity : CapDAG.Bifaci.Pools.State → String → Nat → CapDAG.Bifaci.Pools.State */
295
+ setCapacity(s: State, name: string, capacity: bigint): State;
296
+ /** Lean's CapDAG.Bifaci.Pools.advertised : Bool → String → Nat → Option Nat → Nat */
297
+ advertised(running: boolean, pool: string, configured: bigint, available: L.Option<bigint>): bigint;
298
+ /** Lean's CapDAG.Bifaci.Pools.chain : String → List (String × List String) → List String */
299
+ chain(cap: string, shared: Array<[string, Array<string>]>): Array<string>;
300
+ /** Lean's CapDAG.Bifaci.Pools.effective : Nat → Option Nat → Nat */
301
+ effective(configured: bigint, available: L.Option<bigint>): bigint;
302
+ /** Lean's CapDAG.Bifaci.Pools.patience : Option Nat → Nat → CapDAG.Bifaci.Pools.Patience */
303
+ patience(unavailableFor: L.Option<bigint>, grace: bigint): Patience;
304
+ /** Lean's CapDAG.Bifaci.Request.Phase.after : CapDAG.Bifaci.Request.Phase → CapDAG.Bifaci.Flow.FrameType → CapDAG.Bifaci.Request.Phase */
305
+ after(p: Phase, frame: FrameType): Phase;
306
+ /** Lean's CapDAG.Bifaci.Request.check : List CapDAG.Bifaci.Request.Emitted → Option CapDAG.Bifaci.Request.Violation */
307
+ check(frames: Array<Emitted>): L.Option<Violation>;
308
+ /** Lean's CapDAG.Bifaci.Request.dispose : Bool → Bool → CapDAG.Bifaci.Request.Disposition */
309
+ dispose(live: boolean, endedLately: boolean): Disposition;
310
+ /** Lean's CapDAG.Bifaci.Request.ledger : Int → CapDAG.Bifaci.Flow.FrameType → Nat → Int */
311
+ ledger(remaining: bigint, frame: FrameType, granted: bigint): bigint;
312
+ /** Lean's CapDAG.Bifaci.Request.terminalOf : CapDAG.Bifaci.Flow.FrameType → Option CapDAG.Bifaci.Request.Terminal */
313
+ terminalOf(a: FrameType): L.Option<Terminal>;
314
+ /** Lean's CapDAG.Bifaci.Request.write : Bool → CapDAG.Bifaci.Flow.FrameType → CapDAG.Bifaci.Request.Write */
315
+ write(over: boolean, frame: FrameType): Write;
75
316
  /** Lean's CapDAG.Exec.accepts : CapDAG.Exec.WfCap → CapDAG.Exec.WfCap → Bool */
76
317
  accepts(pattern: WfCap, cap: WfCap): boolean;
77
318
  /** Lean's CapDAG.Exec.comparable : CapDAG.Exec.WfCap → CapDAG.Exec.WfCap → Bool */
package/formal/index.js CHANGED
@@ -1,4 +1,4 @@
1
- // Generated by lungo 1.78.3254 from Lean 4.34.1 for program capdagFormal. Do not edit.
1
+ // Generated by lungo 1.82.64 from Lean 4.34.1 for program capdagFormal. Do not edit.
2
2
  import * as L from "lungo-ts";
3
3
 
4
4
  async function programModule() {
@@ -12,10 +12,599 @@ async function programModule() {
12
12
  return response.arrayBuffer();
13
13
  }
14
14
 
15
+ /** Describes CapDAG.Bifaci.Credit.Gate for polymorphic functions. */
16
+ export function gateType() {
17
+ return new L.Type(
18
+ L.inductiveExpr(0),
19
+ (w, v) => {
20
+ if (typeof v !== "object" || v === null) throw new L.MalformedError("not a CapDAG.Bifaci.Credit.Gate");
21
+ w.u32(0);
22
+ L.NAT.encode(w, v.available);
23
+ L.option(L.STRING).encode(w, v.closed);
24
+ },
25
+ (r) => {
26
+ const c = r.u32();
27
+ if (c !== 0) throw new L.MalformedError(`constructor index ${c} of CapDAG.Bifaci.Credit.Gate`);
28
+ return ({ available: L.NAT.decode(r), closed: L.option(L.STRING).decode(r) });
29
+ },
30
+ );
31
+ }
32
+
33
+ /** Describes CapDAG.Bifaci.Credit.Acquire for polymorphic functions. */
34
+ export function acquireType() {
35
+ return new L.Type(
36
+ L.inductiveExpr(1),
37
+ (w, v) => {
38
+ if (typeof v !== "object" || v === null) throw new L.MalformedError("not a CapDAG.Bifaci.Credit.Acquire");
39
+ switch (v.kind) {
40
+ case "acquired":
41
+ w.u32(0);
42
+ gateType().encode(w, v.gate);
43
+ return;
44
+ case "wait":
45
+ w.u32(1);
46
+ return;
47
+ case "closed":
48
+ w.u32(2);
49
+ L.STRING.encode(w, v.reason);
50
+ return;
51
+ default:
52
+ throw new L.MalformedError(`${String(v.kind)} is not a constructor of CapDAG.Bifaci.Credit.Acquire`);
53
+ }
54
+ },
55
+ (r) => {
56
+ const c = r.u32();
57
+ switch (c) {
58
+ case 0: return ({ kind: "acquired", gate: gateType().decode(r) });
59
+ case 1: return ({ kind: "wait" });
60
+ case 2: return ({ kind: "closed", reason: L.STRING.decode(r) });
61
+ default: throw new L.MalformedError(`constructor index ${c} of CapDAG.Bifaci.Credit.Acquire`);
62
+ }
63
+ },
64
+ );
65
+ }
66
+
67
+ /** Describes CapDAG.Bifaci.Credit.Window for polymorphic functions. */
68
+ export function windowType() {
69
+ return new L.Type(
70
+ L.inductiveExpr(2),
71
+ (w, v) => {
72
+ if (typeof v !== "object" || v === null) throw new L.MalformedError("not a CapDAG.Bifaci.Credit.Window");
73
+ w.u32(0);
74
+ L.NAT.encode(w, v.remaining);
75
+ L.NAT.encode(w, v.pending);
76
+ L.NAT.encode(w, v.batch);
77
+ },
78
+ (r) => {
79
+ const c = r.u32();
80
+ if (c !== 0) throw new L.MalformedError(`constructor index ${c} of CapDAG.Bifaci.Credit.Window`);
81
+ return ({ remaining: L.NAT.decode(r), pending: L.NAT.decode(r), batch: L.NAT.decode(r) });
82
+ },
83
+ );
84
+ }
85
+
86
+ /** Describes CapDAG.Bifaci.Credit.Arrival for polymorphic functions. */
87
+ export function creditArrivalType() {
88
+ return new L.Type(
89
+ L.inductiveExpr(3),
90
+ (w, v) => {
91
+ if (typeof v !== "object" || v === null) throw new L.MalformedError("not a CapDAG.Bifaci.Credit.Arrival");
92
+ switch (v.kind) {
93
+ case "accepted":
94
+ w.u32(0);
95
+ windowType().encode(w, v.window);
96
+ return;
97
+ case "violation":
98
+ w.u32(1);
99
+ return;
100
+ default:
101
+ throw new L.MalformedError(`${String(v.kind)} is not a constructor of CapDAG.Bifaci.Credit.Arrival`);
102
+ }
103
+ },
104
+ (r) => {
105
+ const c = r.u32();
106
+ switch (c) {
107
+ case 0: return ({ kind: "accepted", window: windowType().decode(r) });
108
+ case 1: return ({ kind: "violation" });
109
+ default: throw new L.MalformedError(`constructor index ${c} of CapDAG.Bifaci.Credit.Arrival`);
110
+ }
111
+ },
112
+ );
113
+ }
114
+
115
+ /** Describes CapDAG.Bifaci.Credit.Granted for polymorphic functions. */
116
+ export function grantedType() {
117
+ return new L.Type(
118
+ L.inductiveExpr(4),
119
+ (w, v) => {
120
+ if (typeof v !== "object" || v === null) throw new L.MalformedError("not a CapDAG.Bifaci.Credit.Granted");
121
+ w.u32(0);
122
+ windowType().encode(w, v.window);
123
+ L.NAT.encode(w, v.grant);
124
+ },
125
+ (r) => {
126
+ const c = r.u32();
127
+ if (c !== 0) throw new L.MalformedError(`constructor index ${c} of CapDAG.Bifaci.Credit.Granted`);
128
+ return ({ window: windowType().decode(r), grant: L.NAT.decode(r) });
129
+ },
130
+ );
131
+ }
132
+
133
+ /** Describes CapDAG.Bifaci.Flow.FrameType for polymorphic functions. */
134
+ export function frameTypeType() {
135
+ return new L.Type(
136
+ L.inductiveExpr(5),
137
+ (w, v) => {
138
+ if (typeof v !== "object" || v === null) throw new L.MalformedError("not a CapDAG.Bifaci.Flow.FrameType");
139
+ switch (v.kind) {
140
+ case "hello":
141
+ w.u32(0);
142
+ return;
143
+ case "req":
144
+ w.u32(1);
145
+ return;
146
+ case "chunk":
147
+ w.u32(2);
148
+ return;
149
+ case "fin":
150
+ w.u32(3);
151
+ return;
152
+ case "log":
153
+ w.u32(4);
154
+ return;
155
+ case "err":
156
+ w.u32(5);
157
+ return;
158
+ case "heartbeat":
159
+ w.u32(6);
160
+ return;
161
+ case "streamStart":
162
+ w.u32(7);
163
+ return;
164
+ case "streamEnd":
165
+ w.u32(8);
166
+ return;
167
+ case "relayNotify":
168
+ w.u32(9);
169
+ return;
170
+ case "relayState":
171
+ w.u32(10);
172
+ return;
173
+ case "cancel":
174
+ w.u32(11);
175
+ return;
176
+ case "credit":
177
+ w.u32(12);
178
+ return;
179
+ case "closeStream":
180
+ w.u32(13);
181
+ return;
182
+ default:
183
+ throw new L.MalformedError(`${String(v.kind)} is not a constructor of CapDAG.Bifaci.Flow.FrameType`);
184
+ }
185
+ },
186
+ (r) => {
187
+ const c = r.u32();
188
+ switch (c) {
189
+ case 0: return ({ kind: "hello" });
190
+ case 1: return ({ kind: "req" });
191
+ case 2: return ({ kind: "chunk" });
192
+ case 3: return ({ kind: "fin" });
193
+ case 4: return ({ kind: "log" });
194
+ case 5: return ({ kind: "err" });
195
+ case 6: return ({ kind: "heartbeat" });
196
+ case 7: return ({ kind: "streamStart" });
197
+ case 8: return ({ kind: "streamEnd" });
198
+ case 9: return ({ kind: "relayNotify" });
199
+ case 10: return ({ kind: "relayState" });
200
+ case 11: return ({ kind: "cancel" });
201
+ case 12: return ({ kind: "credit" });
202
+ case 13: return ({ kind: "closeStream" });
203
+ default: throw new L.MalformedError(`constructor index ${c} of CapDAG.Bifaci.Flow.FrameType`);
204
+ }
205
+ },
206
+ );
207
+ }
208
+
209
+ /** Describes CapDAG.Bifaci.Flow.Reorder for polymorphic functions. */
210
+ export function reorderType() {
211
+ return new L.Type(
212
+ L.inductiveExpr(6),
213
+ (w, v) => {
214
+ if (typeof v !== "object" || v === null) throw new L.MalformedError("not a CapDAG.Bifaci.Flow.Reorder");
215
+ w.u32(0);
216
+ L.NAT.encode(w, v.expected);
217
+ L.list(L.NAT).encode(w, v.held);
218
+ },
219
+ (r) => {
220
+ const c = r.u32();
221
+ if (c !== 0) throw new L.MalformedError(`constructor index ${c} of CapDAG.Bifaci.Flow.Reorder`);
222
+ return ({ expected: L.NAT.decode(r), held: L.list(L.NAT).decode(r) });
223
+ },
224
+ );
225
+ }
226
+
227
+ /** Describes CapDAG.Bifaci.Flow.Accepted for polymorphic functions. */
228
+ export function acceptedType() {
229
+ return new L.Type(
230
+ L.inductiveExpr(7),
231
+ (w, v) => {
232
+ if (typeof v !== "object" || v === null) throw new L.MalformedError("not a CapDAG.Bifaci.Flow.Accepted");
233
+ switch (v.kind) {
234
+ case "deliver":
235
+ w.u32(0);
236
+ reorderType().encode(w, v.flow);
237
+ L.list(L.NAT).encode(w, v.seqs);
238
+ return;
239
+ case "hold":
240
+ w.u32(1);
241
+ reorderType().encode(w, v.flow);
242
+ return;
243
+ case "stale":
244
+ w.u32(2);
245
+ return;
246
+ case "duplicate":
247
+ w.u32(3);
248
+ return;
249
+ case "overflow":
250
+ w.u32(4);
251
+ return;
252
+ default:
253
+ throw new L.MalformedError(`${String(v.kind)} is not a constructor of CapDAG.Bifaci.Flow.Accepted`);
254
+ }
255
+ },
256
+ (r) => {
257
+ const c = r.u32();
258
+ switch (c) {
259
+ case 0: return ({ kind: "deliver", flow: reorderType().decode(r), seqs: L.list(L.NAT).decode(r) });
260
+ case 1: return ({ kind: "hold", flow: reorderType().decode(r) });
261
+ case 2: return ({ kind: "stale" });
262
+ case 3: return ({ kind: "duplicate" });
263
+ case 4: return ({ kind: "overflow" });
264
+ default: throw new L.MalformedError(`constructor index ${c} of CapDAG.Bifaci.Flow.Accepted`);
265
+ }
266
+ },
267
+ );
268
+ }
269
+
270
+ /** Describes CapDAG.Bifaci.Pools.State for polymorphic functions. */
271
+ export function stateType() {
272
+ return new L.Type(
273
+ L.inductiveExpr(8),
274
+ (w, v) => {
275
+ if (typeof v !== "object" || v === null) throw new L.MalformedError("not a CapDAG.Bifaci.Pools.State");
276
+ w.u32(0);
277
+ L.list(poolType()).encode(w, v.pools);
278
+ L.list(waiterType()).encode(w, v.queue);
279
+ L.NAT.encode(w, v.next);
280
+ },
281
+ (r) => {
282
+ const c = r.u32();
283
+ if (c !== 0) throw new L.MalformedError(`constructor index ${c} of CapDAG.Bifaci.Pools.State`);
284
+ return ({ pools: L.list(poolType()).decode(r), queue: L.list(waiterType()).decode(r), next: L.NAT.decode(r) });
285
+ },
286
+ );
287
+ }
288
+
289
+ /** Describes CapDAG.Bifaci.Pools.Waiter for polymorphic functions. */
290
+ export function waiterType() {
291
+ return new L.Type(
292
+ L.inductiveExpr(9),
293
+ (w, v) => {
294
+ if (typeof v !== "object" || v === null) throw new L.MalformedError("not a CapDAG.Bifaci.Pools.Waiter");
295
+ w.u32(0);
296
+ L.NAT.encode(w, v.ticket);
297
+ L.list(L.STRING).encode(w, v.chain);
298
+ },
299
+ (r) => {
300
+ const c = r.u32();
301
+ if (c !== 0) throw new L.MalformedError(`constructor index ${c} of CapDAG.Bifaci.Pools.Waiter`);
302
+ return ({ ticket: L.NAT.decode(r), chain: L.list(L.STRING).decode(r) });
303
+ },
304
+ );
305
+ }
306
+
307
+ /** Describes CapDAG.Bifaci.Pools.Arrival for polymorphic functions. */
308
+ export function poolsArrivalType() {
309
+ return new L.Type(
310
+ L.inductiveExpr(10),
311
+ (w, v) => {
312
+ if (typeof v !== "object" || v === null) throw new L.MalformedError("not a CapDAG.Bifaci.Pools.Arrival");
313
+ switch (v.kind) {
314
+ case "admitted":
315
+ w.u32(0);
316
+ stateType().encode(w, v.state);
317
+ return;
318
+ case "queued":
319
+ w.u32(1);
320
+ stateType().encode(w, v.state);
321
+ L.NAT.encode(w, v.ticket);
322
+ L.NAT.encode(w, v.position);
323
+ return;
324
+ case "unknownPool":
325
+ w.u32(2);
326
+ L.STRING.encode(w, v.name);
327
+ return;
328
+ default:
329
+ throw new L.MalformedError(`${String(v.kind)} is not a constructor of CapDAG.Bifaci.Pools.Arrival`);
330
+ }
331
+ },
332
+ (r) => {
333
+ const c = r.u32();
334
+ switch (c) {
335
+ case 0: return ({ kind: "admitted", state: stateType().decode(r) });
336
+ case 1: return ({ kind: "queued", state: stateType().decode(r), ticket: L.NAT.decode(r), position: L.NAT.decode(r) });
337
+ case 2: return ({ kind: "unknownPool", name: L.STRING.decode(r) });
338
+ default: throw new L.MalformedError(`constructor index ${c} of CapDAG.Bifaci.Pools.Arrival`);
339
+ }
340
+ },
341
+ );
342
+ }
343
+
344
+ /** Describes CapDAG.Bifaci.Pools.Patience for polymorphic functions. */
345
+ export function patienceType() {
346
+ return new L.Type(
347
+ L.inductiveExpr(11),
348
+ (w, v) => {
349
+ if (typeof v !== "object" || v === null) throw new L.MalformedError("not a CapDAG.Bifaci.Pools.Patience");
350
+ switch (v.kind) {
351
+ case "unbounded":
352
+ w.u32(0);
353
+ return;
354
+ case "atMost":
355
+ w.u32(1);
356
+ L.NAT.encode(w, v.remaining);
357
+ return;
358
+ case "exhausted":
359
+ w.u32(2);
360
+ return;
361
+ default:
362
+ throw new L.MalformedError(`${String(v.kind)} is not a constructor of CapDAG.Bifaci.Pools.Patience`);
363
+ }
364
+ },
365
+ (r) => {
366
+ const c = r.u32();
367
+ switch (c) {
368
+ case 0: return ({ kind: "unbounded" });
369
+ case 1: return ({ kind: "atMost", remaining: L.NAT.decode(r) });
370
+ case 2: return ({ kind: "exhausted" });
371
+ default: throw new L.MalformedError(`constructor index ${c} of CapDAG.Bifaci.Pools.Patience`);
372
+ }
373
+ },
374
+ );
375
+ }
376
+
377
+ /** Describes CapDAG.Bifaci.Request.Phase for polymorphic functions. */
378
+ export function phaseType() {
379
+ return new L.Type(
380
+ L.inductiveExpr(12),
381
+ (w, v) => {
382
+ if (typeof v !== "object" || v === null) throw new L.MalformedError("not a CapDAG.Bifaci.Request.Phase");
383
+ switch (v.kind) {
384
+ case "created":
385
+ w.u32(0);
386
+ return;
387
+ case "streaming":
388
+ w.u32(1);
389
+ return;
390
+ default:
391
+ throw new L.MalformedError(`${String(v.kind)} is not a constructor of CapDAG.Bifaci.Request.Phase`);
392
+ }
393
+ },
394
+ (r) => {
395
+ const c = r.u32();
396
+ switch (c) {
397
+ case 0: return ({ kind: "created" });
398
+ case 1: return ({ kind: "streaming" });
399
+ default: throw new L.MalformedError(`constructor index ${c} of CapDAG.Bifaci.Request.Phase`);
400
+ }
401
+ },
402
+ );
403
+ }
404
+
405
+ /** Describes CapDAG.Bifaci.Request.Emitted for polymorphic functions. */
406
+ export function emittedType() {
407
+ return new L.Type(
408
+ L.inductiveExpr(13),
409
+ (w, v) => {
410
+ if (typeof v !== "object" || v === null) throw new L.MalformedError("not a CapDAG.Bifaci.Request.Emitted");
411
+ switch (v.kind) {
412
+ case "streamStart":
413
+ w.u32(0);
414
+ L.STRING.encode(w, v.stream);
415
+ return;
416
+ case "chunk":
417
+ w.u32(1);
418
+ L.STRING.encode(w, v.stream);
419
+ L.NAT.encode(w, v.index);
420
+ return;
421
+ case "streamEnd":
422
+ w.u32(2);
423
+ L.STRING.encode(w, v.stream);
424
+ L.option(L.NAT).encode(w, v.count);
425
+ return;
426
+ case "fin":
427
+ w.u32(3);
428
+ return;
429
+ case "err":
430
+ w.u32(4);
431
+ return;
432
+ case "other":
433
+ w.u32(5);
434
+ return;
435
+ default:
436
+ throw new L.MalformedError(`${String(v.kind)} is not a constructor of CapDAG.Bifaci.Request.Emitted`);
437
+ }
438
+ },
439
+ (r) => {
440
+ const c = r.u32();
441
+ switch (c) {
442
+ case 0: return ({ kind: "streamStart", stream: L.STRING.decode(r) });
443
+ case 1: return ({ kind: "chunk", stream: L.STRING.decode(r), index: L.NAT.decode(r) });
444
+ case 2: return ({ kind: "streamEnd", stream: L.STRING.decode(r), count: L.option(L.NAT).decode(r) });
445
+ case 3: return ({ kind: "fin" });
446
+ case 4: return ({ kind: "err" });
447
+ case 5: return ({ kind: "other" });
448
+ default: throw new L.MalformedError(`constructor index ${c} of CapDAG.Bifaci.Request.Emitted`);
449
+ }
450
+ },
451
+ );
452
+ }
453
+
454
+ /** Describes CapDAG.Bifaci.Request.Violation for polymorphic functions. */
455
+ export function violationType() {
456
+ return new L.Type(
457
+ L.inductiveExpr(14),
458
+ (w, v) => {
459
+ if (typeof v !== "object" || v === null) throw new L.MalformedError("not a CapDAG.Bifaci.Request.Violation");
460
+ switch (v.kind) {
461
+ case "afterEnd":
462
+ w.u32(0);
463
+ return;
464
+ case "streamRestarted":
465
+ w.u32(1);
466
+ L.STRING.encode(w, v.stream);
467
+ return;
468
+ case "streamNotOpen":
469
+ w.u32(2);
470
+ L.STRING.encode(w, v.stream);
471
+ return;
472
+ case "chunkOutOfPlace":
473
+ w.u32(3);
474
+ L.STRING.encode(w, v.stream);
475
+ L.NAT.encode(w, v.expected);
476
+ L.NAT.encode(w, v.got);
477
+ return;
478
+ case "chunkCountWrong":
479
+ w.u32(4);
480
+ L.STRING.encode(w, v.stream);
481
+ L.NAT.encode(w, v.sent);
482
+ L.NAT.encode(w, v.said);
483
+ return;
484
+ case "endWithOpenStream":
485
+ w.u32(5);
486
+ L.STRING.encode(w, v.stream);
487
+ return;
488
+ default:
489
+ throw new L.MalformedError(`${String(v.kind)} is not a constructor of CapDAG.Bifaci.Request.Violation`);
490
+ }
491
+ },
492
+ (r) => {
493
+ const c = r.u32();
494
+ switch (c) {
495
+ case 0: return ({ kind: "afterEnd" });
496
+ case 1: return ({ kind: "streamRestarted", stream: L.STRING.decode(r) });
497
+ case 2: return ({ kind: "streamNotOpen", stream: L.STRING.decode(r) });
498
+ case 3: return ({ kind: "chunkOutOfPlace", stream: L.STRING.decode(r), expected: L.NAT.decode(r), got: L.NAT.decode(r) });
499
+ case 4: return ({ kind: "chunkCountWrong", stream: L.STRING.decode(r), sent: L.NAT.decode(r), said: L.NAT.decode(r) });
500
+ case 5: return ({ kind: "endWithOpenStream", stream: L.STRING.decode(r) });
501
+ default: throw new L.MalformedError(`constructor index ${c} of CapDAG.Bifaci.Request.Violation`);
502
+ }
503
+ },
504
+ );
505
+ }
506
+
507
+ /** Describes CapDAG.Bifaci.Request.Disposition for polymorphic functions. */
508
+ export function dispositionType() {
509
+ return new L.Type(
510
+ L.inductiveExpr(15),
511
+ (w, v) => {
512
+ if (typeof v !== "object" || v === null) throw new L.MalformedError("not a CapDAG.Bifaci.Request.Disposition");
513
+ switch (v.kind) {
514
+ case "route":
515
+ w.u32(0);
516
+ return;
517
+ case "straggler":
518
+ w.u32(1);
519
+ return;
520
+ case "noRoute":
521
+ w.u32(2);
522
+ return;
523
+ default:
524
+ throw new L.MalformedError(`${String(v.kind)} is not a constructor of CapDAG.Bifaci.Request.Disposition`);
525
+ }
526
+ },
527
+ (r) => {
528
+ const c = r.u32();
529
+ switch (c) {
530
+ case 0: return ({ kind: "route" });
531
+ case 1: return ({ kind: "straggler" });
532
+ case 2: return ({ kind: "noRoute" });
533
+ default: throw new L.MalformedError(`constructor index ${c} of CapDAG.Bifaci.Request.Disposition`);
534
+ }
535
+ },
536
+ );
537
+ }
538
+
539
+ /** Describes CapDAG.Bifaci.Request.Terminal for polymorphic functions. */
540
+ export function terminalType() {
541
+ return new L.Type(
542
+ L.inductiveExpr(16),
543
+ (w, v) => {
544
+ if (typeof v !== "object" || v === null) throw new L.MalformedError("not a CapDAG.Bifaci.Request.Terminal");
545
+ switch (v.kind) {
546
+ case "finished":
547
+ w.u32(0);
548
+ return;
549
+ case "failed":
550
+ w.u32(1);
551
+ return;
552
+ case "cancelled":
553
+ w.u32(2);
554
+ return;
555
+ case "masterDied":
556
+ w.u32(3);
557
+ return;
558
+ default:
559
+ throw new L.MalformedError(`${String(v.kind)} is not a constructor of CapDAG.Bifaci.Request.Terminal`);
560
+ }
561
+ },
562
+ (r) => {
563
+ const c = r.u32();
564
+ switch (c) {
565
+ case 0: return ({ kind: "finished" });
566
+ case 1: return ({ kind: "failed" });
567
+ case 2: return ({ kind: "cancelled" });
568
+ case 3: return ({ kind: "masterDied" });
569
+ default: throw new L.MalformedError(`constructor index ${c} of CapDAG.Bifaci.Request.Terminal`);
570
+ }
571
+ },
572
+ );
573
+ }
574
+
575
+ /** Describes CapDAG.Bifaci.Request.Write for polymorphic functions. */
576
+ export function writeType() {
577
+ return new L.Type(
578
+ L.inductiveExpr(17),
579
+ (w, v) => {
580
+ if (typeof v !== "object" || v === null) throw new L.MalformedError("not a CapDAG.Bifaci.Request.Write");
581
+ switch (v.kind) {
582
+ case "send":
583
+ w.u32(0);
584
+ L.BOOL.encode(w, v.ends);
585
+ return;
586
+ case "suppress":
587
+ w.u32(1);
588
+ return;
589
+ default:
590
+ throw new L.MalformedError(`${String(v.kind)} is not a constructor of CapDAG.Bifaci.Request.Write`);
591
+ }
592
+ },
593
+ (r) => {
594
+ const c = r.u32();
595
+ switch (c) {
596
+ case 0: return ({ kind: "send", ends: L.BOOL.decode(r) });
597
+ case 1: return ({ kind: "suppress" });
598
+ default: throw new L.MalformedError(`constructor index ${c} of CapDAG.Bifaci.Request.Write`);
599
+ }
600
+ },
601
+ );
602
+ }
603
+
15
604
  /** Describes CapDAG.Exec.WfCap for polymorphic functions. */
16
605
  export function wfCapType() {
17
606
  return new L.Type(
18
- L.inductiveExpr(0),
607
+ L.inductiveExpr(18),
19
608
  (w, v) => {
20
609
  if (typeof v !== "object" || v === null) throw new L.MalformedError("not a CapDAG.Exec.WfCap");
21
610
  w.u32(0);
@@ -35,7 +624,7 @@ export function wfCapType() {
35
624
  /** Describes CapDAG.Effect for polymorphic functions. */
36
625
  export function effectType() {
37
626
  return new L.Type(
38
- L.inductiveExpr(1),
627
+ L.inductiveExpr(19),
39
628
  (w, v) => {
40
629
  if (typeof v !== "object" || v === null) throw new L.MalformedError("not a CapDAG.Effect");
41
630
  switch (v.kind) {
@@ -71,7 +660,7 @@ export function effectType() {
71
660
  /** Describes CapDAG.Exec.WfQuery for polymorphic functions. */
72
661
  export function wfQueryType() {
73
662
  return new L.Type(
74
- L.inductiveExpr(2),
663
+ L.inductiveExpr(20),
75
664
  (w, v) => {
76
665
  if (typeof v !== "object" || v === null) throw new L.MalformedError("not a CapDAG.Exec.WfQuery");
77
666
  w.u32(0);
@@ -94,7 +683,7 @@ export class Wf extends L.Opaque {}
94
683
  /** Describes TaggedUrn.Exec.Wf for polymorphic functions. */
95
684
  export function wfType() {
96
685
  return new L.Type(
97
- L.inductiveExpr(3),
686
+ L.inductiveExpr(21),
98
687
  (w, v) => {
99
688
  if (!(v instanceof Wf)) throw new L.MalformedError("not a TaggedUrn.Exec.Wf");
100
689
  L.OPAQUE.encode(w, v);
@@ -106,7 +695,7 @@ export function wfType() {
106
695
  /** Describes CapDAG.Grade for polymorphic functions. */
107
696
  export function gradeType() {
108
697
  return new L.Type(
109
- L.inductiveExpr(4),
698
+ L.inductiveExpr(22),
110
699
  (w, v) => {
111
700
  if (typeof v !== "object" || v === null) throw new L.MalformedError("not a CapDAG.Grade");
112
701
  switch (v.kind) {
@@ -142,7 +731,7 @@ export function gradeType() {
142
731
  /** Describes TaggedUrn.Constraint for polymorphic functions. */
143
732
  export function constraintType() {
144
733
  return new L.Type(
145
- L.inductiveExpr(5),
734
+ L.inductiveExpr(23),
146
735
  (w, v) => {
147
736
  if (typeof v !== "object" || v === null) throw new L.MalformedError("not a TaggedUrn.Constraint");
148
737
  switch (v.kind) {
@@ -190,10 +779,29 @@ export function constraintType() {
190
779
  );
191
780
  }
192
781
 
782
+ /** Describes CapDAG.Bifaci.Pools.Pool for polymorphic functions. */
783
+ export function poolType() {
784
+ return new L.Type(
785
+ L.inductiveExpr(24),
786
+ (w, v) => {
787
+ if (typeof v !== "object" || v === null) throw new L.MalformedError("not a CapDAG.Bifaci.Pools.Pool");
788
+ w.u32(0);
789
+ L.STRING.encode(w, v.name);
790
+ L.NAT.encode(w, v.capacity);
791
+ L.NAT.encode(w, v.active);
792
+ },
793
+ (r) => {
794
+ const c = r.u32();
795
+ if (c !== 0) throw new L.MalformedError(`constructor index ${c} of CapDAG.Bifaci.Pools.Pool`);
796
+ return ({ name: L.STRING.decode(r), capacity: L.NAT.decode(r), active: L.NAT.decode(r) });
797
+ },
798
+ );
799
+ }
800
+
193
801
  /** Describes CapDAG.Exec.WfAsk for polymorphic functions. */
194
802
  export function wfAskType() {
195
803
  return new L.Type(
196
- L.inductiveExpr(6),
804
+ L.inductiveExpr(25),
197
805
  (w, v) => {
198
806
  if (typeof v !== "object" || v === null) throw new L.MalformedError("not a CapDAG.Exec.WfAsk");
199
807
  switch (v.kind) {
@@ -231,12 +839,31 @@ export function wfAskType() {
231
839
 
232
840
  /** The layout fingerprint and descriptor of each type, by Lean name, for modules using them. */
233
841
  export const leanTypes = Object.freeze({
842
+ "CapDAG.Bifaci.Credit.Gate": Object.freeze({ fingerprint: "b10dc9a4cff1977f4f6a2c415147f497f98740255d0158fb2b3a2a99d4d1b135", type: gateType }),
843
+ "CapDAG.Bifaci.Credit.Acquire": Object.freeze({ fingerprint: "0dabbf62c4dad8c3f81811acc80f5c789d25191897bb2621de51b5f94e54a4c9", type: acquireType }),
844
+ "CapDAG.Bifaci.Credit.Window": Object.freeze({ fingerprint: "28df89763b22214ef57dfd7f1a3c0da786ff78af9768fe453cd451870749b6fe", type: windowType }),
845
+ "CapDAG.Bifaci.Credit.Arrival": Object.freeze({ fingerprint: "940f01cf50eb8b763b9f44cc84753fcdbc65fbc0f816ab279408e74208649797", type: creditArrivalType }),
846
+ "CapDAG.Bifaci.Credit.Granted": Object.freeze({ fingerprint: "47f8d3e63e9aaf7c4b602f781afce57fc832e3d4d645c6adabd25c461abed233", type: grantedType }),
847
+ "CapDAG.Bifaci.Flow.FrameType": Object.freeze({ fingerprint: "3d6742b864aeb68cf6add586acfcd1a9663a3816d718f8d8aadc3c5e3dab3e2f", type: frameTypeType }),
848
+ "CapDAG.Bifaci.Flow.Reorder": Object.freeze({ fingerprint: "d1e8b655f24db5e8b2348d6d41084a5c454346eb0a81fcf11b671432e72291bf", type: reorderType }),
849
+ "CapDAG.Bifaci.Flow.Accepted": Object.freeze({ fingerprint: "a821d7a044f52a71dfd932fff60d2f3560ce5197658283853a56fb54aa96b69b", type: acceptedType }),
850
+ "CapDAG.Bifaci.Pools.State": Object.freeze({ fingerprint: "20f7299c188d09234cda39e9cc356242e2b5bc56a09cf819d12d7f50fa24989b", type: stateType }),
851
+ "CapDAG.Bifaci.Pools.Waiter": Object.freeze({ fingerprint: "48d81c7e41df114e88751bb5c1f4a84c16bac3ad28d8eacba141d45f92c79da0", type: waiterType }),
852
+ "CapDAG.Bifaci.Pools.Arrival": Object.freeze({ fingerprint: "6bee196c56c330c4ef348f4dd5a68558b2d19105592969cc64a0e7150bd22451", type: poolsArrivalType }),
853
+ "CapDAG.Bifaci.Pools.Patience": Object.freeze({ fingerprint: "d32e3427e590ca6002e38cface52d020c7df74603f952bf568401f7291d5648c", type: patienceType }),
854
+ "CapDAG.Bifaci.Request.Phase": Object.freeze({ fingerprint: "7407437b58ce033618bf82341b13aaa9661d29a5a9b0f1bf1547ea0bfcfd8374", type: phaseType }),
855
+ "CapDAG.Bifaci.Request.Emitted": Object.freeze({ fingerprint: "97a274be14c5baecf9c50243d3651da838c5de4375366d4102cbcff85fb211c8", type: emittedType }),
856
+ "CapDAG.Bifaci.Request.Violation": Object.freeze({ fingerprint: "203fb2fc4f8ff3c79b70871b4274852e742adf97c3cc4e6631439ec66d838f09", type: violationType }),
857
+ "CapDAG.Bifaci.Request.Disposition": Object.freeze({ fingerprint: "540307dfb6e509ccde4b894c69566edd1f3f9c3223b9325e97ee91b20d0fb82f", type: dispositionType }),
858
+ "CapDAG.Bifaci.Request.Terminal": Object.freeze({ fingerprint: "3597c3196cef5e4468b5449eb0da09af414bb8c3aa40d92b027089f6ae81c870", type: terminalType }),
859
+ "CapDAG.Bifaci.Request.Write": Object.freeze({ fingerprint: "9ae21282903c8131c25ca1cc527e51fd1fa5137aa77c9ef4f3d091e9415a109a", type: writeType }),
234
860
  "CapDAG.Exec.WfCap": Object.freeze({ fingerprint: "2b8d6466d218f4ae6bc98d95bba55d98f21cac4a49446ae170993773cefdb830", type: wfCapType }),
235
861
  "CapDAG.Effect": Object.freeze({ fingerprint: "38c7bd3c0527cda156713cd441c9b6b92bd5df8a39108fa101449a789abcb477", type: effectType }),
236
862
  "CapDAG.Exec.WfQuery": Object.freeze({ fingerprint: "e734861d70e3177f6563c4492990bb65131f0450b8dfc62071eb61b6c5f08b8e", type: wfQueryType }),
237
863
  "TaggedUrn.Exec.Wf": Object.freeze({ fingerprint: "20e9f81ad195b2f4a481e7a5dcae2b3d0de6efe7b3dc720db0e2aa3b52527785", type: wfType }),
238
864
  "CapDAG.Grade": Object.freeze({ fingerprint: "0a2a20a14d9ecca6121343df2d8a7f2478b3e837710ed522ed385d35efdf46f2", type: gradeType }),
239
865
  "TaggedUrn.Constraint": Object.freeze({ fingerprint: "481fc09e23c6415a7c3f05887577ec940a6ecc84b005e63476c1060b59edcac7", type: constraintType }),
866
+ "CapDAG.Bifaci.Pools.Pool": Object.freeze({ fingerprint: "60bca9d670886c7830c76779ad692b4fbb6e4e30c0ce6b3e9d5a91a9b5b7b1e6", type: poolType }),
240
867
  "CapDAG.Exec.WfAsk": Object.freeze({ fingerprint: "d286477c7abc4e6bc6ee2d06889372b71a5bb06605b592ebabb6ad3eaf71b952", type: wfAskType }),
241
868
  });
242
869
 
@@ -246,6 +873,120 @@ export class CapdagFormal {
246
873
  constructor(program) {
247
874
  this.#program = program;
248
875
  }
876
+ acquire(g, n) {
877
+ return this.#program.invoke("capdagFormal__call_l_CapDAG_dBifaci_dCredit_dGate_dacquire", [], [[gateType(), g], [L.NAT, n]], L.value(acquireType()));
878
+ }
879
+ close(g, reason) {
880
+ return this.#program.invoke("capdagFormal__call_l_CapDAG_dBifaci_dCredit_dGate_dclose", [], [[gateType(), g], [L.STRING, reason]], L.value(gateType()));
881
+ }
882
+ grant(g, n) {
883
+ return this.#program.invoke("capdagFormal__call_l_CapDAG_dBifaci_dCredit_dGate_dgrant", [], [[gateType(), g], [L.NAT, n]], L.value(gateType()));
884
+ }
885
+ gateOpened(window) {
886
+ return this.#program.invoke("capdagFormal__call_l_CapDAG_dBifaci_dCredit_dGate_dopened", [], [[L.NAT, window]], L.value(gateType()));
887
+ }
888
+ windowArrive(w_) {
889
+ return this.#program.invoke("capdagFormal__call_l_CapDAG_dBifaci_dCredit_dWindow_darrive", [], [[windowType(), w_]], L.value(creditArrivalType()));
890
+ }
891
+ consume(w_) {
892
+ return this.#program.invoke("capdagFormal__call_l_CapDAG_dBifaci_dCredit_dWindow_dconsume", [], [[windowType(), w_]], L.value(grantedType()));
893
+ }
894
+ continued(w_) {
895
+ return this.#program.invoke("capdagFormal__call_l_CapDAG_dBifaci_dCredit_dWindow_dcontinued", [], [[windowType(), w_]], L.value(grantedType()));
896
+ }
897
+ flush(w_) {
898
+ return this.#program.invoke("capdagFormal__call_l_CapDAG_dBifaci_dCredit_dWindow_dflush", [], [[windowType(), w_]], L.value(grantedType()));
899
+ }
900
+ windowOpened(window) {
901
+ return this.#program.invoke("capdagFormal__call_l_CapDAG_dBifaci_dCredit_dWindow_dopened", [], [[L.NAT, window]], L.value(windowType()));
902
+ }
903
+ grantTarget(streams, named) {
904
+ return this.#program.invoke("capdagFormal__call_l_CapDAG_dBifaci_dCredit_dgrantTarget", [], [[L.list(L.option(L.STRING)), streams], [L.option(L.STRING), named]], L.value(L.option(L.option(L.STRING))));
905
+ }
906
+ negotiate(ours, theirs) {
907
+ return this.#program.invoke("capdagFormal__call_l_CapDAG_dBifaci_dCredit_dnegotiate", [], [[L.NAT, ours], [L.NAT, theirs]], L.value(L.option(L.NAT)));
908
+ }
909
+ code(a) {
910
+ return this.#program.invoke("capdagFormal__call_l_CapDAG_dBifaci_dFlow_dFrameType_dcode", [], [[frameTypeType(), a]], L.value(L.NAT));
911
+ }
912
+ isFlow(a) {
913
+ return this.#program.invoke("capdagFormal__call_l_CapDAG_dBifaci_dFlow_dFrameType_disFlow", [], [[frameTypeType(), a]], L.value(L.BOOL));
914
+ }
915
+ isTerminal(a) {
916
+ return this.#program.invoke("capdagFormal__call_l_CapDAG_dBifaci_dFlow_dFrameType_disTerminal", [], [[frameTypeType(), a]], L.value(L.BOOL));
917
+ }
918
+ ofCode(a) {
919
+ return this.#program.invoke("capdagFormal__call_l_CapDAG_dBifaci_dFlow_dFrameType_dofCode", [], [[L.NAT, a]], L.value(L.option(frameTypeType())));
920
+ }
921
+ accept(r_, seq, limit) {
922
+ return this.#program.invoke("capdagFormal__call_l_CapDAG_dBifaci_dFlow_dReorder_daccept", [], [[reorderType(), r_], [L.NAT, seq], [L.NAT, limit]], L.value(acceptedType()));
923
+ }
924
+ start() {
925
+ return this.#program.invoke("capdagFormal__call_l_CapDAG_dBifaci_dFlow_dReorder_dstart", [], [], L.value(reorderType()));
926
+ }
927
+ admit(s, ticket) {
928
+ return this.#program.invoke("capdagFormal__call_l_CapDAG_dBifaci_dPools_dState_dadmit", [], [[stateType(), s], [L.NAT, ticket]], L.value(L.option(stateType())));
929
+ }
930
+ admitNext(s) {
931
+ return this.#program.invoke("capdagFormal__call_l_CapDAG_dBifaci_dPools_dState_dadmitNext", [], [[stateType(), s]], L.value(L.option(L.pair(waiterType(), stateType()))));
932
+ }
933
+ stateArrive(s, chain) {
934
+ return this.#program.invoke("capdagFormal__call_l_CapDAG_dBifaci_dPools_dState_darrive", [], [[stateType(), s], [L.list(L.STRING), chain]], L.value(poolsArrivalType()));
935
+ }
936
+ empty() {
937
+ return this.#program.invoke("capdagFormal__call_l_CapDAG_dBifaci_dPools_dState_dempty", [], [], L.value(stateType()));
938
+ }
939
+ hasRoom(s, chain) {
940
+ return this.#program.invoke("capdagFormal__call_l_CapDAG_dBifaci_dPools_dState_dhasRoom", [], [[stateType(), s], [L.list(L.STRING), chain]], L.value(L.BOOL));
941
+ }
942
+ heldBack(s, name) {
943
+ return this.#program.invoke("capdagFormal__call_l_CapDAG_dBifaci_dPools_dState_dheldBack", [], [[stateType(), s], [L.STRING, name]], L.value(L.NAT));
944
+ }
945
+ join(s, chain) {
946
+ return this.#program.invoke("capdagFormal__call_l_CapDAG_dBifaci_dPools_dState_djoin", [], [[stateType(), s], [L.list(L.STRING), chain]], L.value(poolsArrivalType()));
947
+ }
948
+ leave(s, ticket) {
949
+ return this.#program.invoke("capdagFormal__call_l_CapDAG_dBifaci_dPools_dState_dleave", [], [[stateType(), s], [L.NAT, ticket]], L.value(stateType()));
950
+ }
951
+ position(s, ticket) {
952
+ return this.#program.invoke("capdagFormal__call_l_CapDAG_dBifaci_dPools_dState_dposition", [], [[stateType(), s], [L.NAT, ticket]], L.value(L.NAT));
953
+ }
954
+ release(s, chain) {
955
+ return this.#program.invoke("capdagFormal__call_l_CapDAG_dBifaci_dPools_dState_drelease", [], [[stateType(), s], [L.list(L.STRING), chain]], L.value(stateType()));
956
+ }
957
+ setCapacity(s, name, capacity) {
958
+ return this.#program.invoke("capdagFormal__call_l_CapDAG_dBifaci_dPools_dState_dsetCapacity", [], [[stateType(), s], [L.STRING, name], [L.NAT, capacity]], L.value(stateType()));
959
+ }
960
+ advertised(running, pool, configured, available) {
961
+ return this.#program.invoke("capdagFormal__call_l_CapDAG_dBifaci_dPools_dadvertised", [], [[L.BOOL, running], [L.STRING, pool], [L.NAT, configured], [L.option(L.NAT), available]], L.value(L.NAT));
962
+ }
963
+ chain(cap, shared) {
964
+ return this.#program.invoke("capdagFormal__call_l_CapDAG_dBifaci_dPools_dchain", [], [[L.STRING, cap], [L.list(L.pair(L.STRING, L.list(L.STRING))), shared]], L.value(L.list(L.STRING)));
965
+ }
966
+ effective(configured, available) {
967
+ return this.#program.invoke("capdagFormal__call_l_CapDAG_dBifaci_dPools_deffective", [], [[L.NAT, configured], [L.option(L.NAT), available]], L.value(L.NAT));
968
+ }
969
+ patience(unavailableFor, grace) {
970
+ return this.#program.invoke("capdagFormal__call_l_CapDAG_dBifaci_dPools_dpatience", [], [[L.option(L.NAT), unavailableFor], [L.NAT, grace]], L.value(patienceType()));
971
+ }
972
+ after(p, frame) {
973
+ return this.#program.invoke("capdagFormal__call_l_CapDAG_dBifaci_dRequest_dPhase_dafter", [], [[phaseType(), p], [frameTypeType(), frame]], L.value(phaseType()));
974
+ }
975
+ check(frames) {
976
+ return this.#program.invoke("capdagFormal__call_l_CapDAG_dBifaci_dRequest_dcheck", [], [[L.list(emittedType()), frames]], L.value(L.option(violationType())));
977
+ }
978
+ dispose(live, endedLately) {
979
+ return this.#program.invoke("capdagFormal__call_l_CapDAG_dBifaci_dRequest_ddispose", [], [[L.BOOL, live], [L.BOOL, endedLately]], L.value(dispositionType()));
980
+ }
981
+ ledger(remaining, frame, granted) {
982
+ return this.#program.invoke("capdagFormal__call_l_CapDAG_dBifaci_dRequest_dledger", [], [[L.INT, remaining], [frameTypeType(), frame], [L.NAT, granted]], L.value(L.INT));
983
+ }
984
+ terminalOf(a) {
985
+ return this.#program.invoke("capdagFormal__call_l_CapDAG_dBifaci_dRequest_dterminalOf", [], [[frameTypeType(), a]], L.value(L.option(terminalType())));
986
+ }
987
+ write(over, frame) {
988
+ return this.#program.invoke("capdagFormal__call_l_CapDAG_dBifaci_dRequest_dwrite", [], [[L.BOOL, over], [frameTypeType(), frame]], L.value(writeType()));
989
+ }
249
990
  accepts(pattern, cap) {
250
991
  return this.#program.invoke("capdagFormal__call_l_CapDAG_dExec_daccepts", [], [[wfCapType(), pattern], [wfCapType(), cap]], L.value(L.BOOL));
251
992
  }
Binary file
package/package.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "author": "Bahram Joharshamshiri",
3
3
  "dependencies": {
4
- "lungo-ts": "1.78.3254",
4
+ "lungo-ts": "1.82.64",
5
5
  "peggy": "^5.1.0",
6
- "tagged-urn": "^1.68.11"
6
+ "tagged-urn": "^1.73.7"
7
7
  },
8
8
  "description": "JavaScript implementation of Cap URN (Capability Uniform Resource Names) with strict validation and matching",
9
9
  "engines": {
@@ -50,5 +50,5 @@
50
50
  "test": "node capdag.test.js"
51
51
  },
52
52
  "type": "module",
53
- "version": "1.363.10"
53
+ "version": "1.371.14"
54
54
  }