libpetri 2.12.1 → 2.13.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.
@@ -1,6 +1,6 @@
1
1
  import { Writable } from 'node:stream';
2
- import { P as PetriNet, b as Transition, T as Token } from '../petri-net-Byc3gSgJ.js';
3
- import { E as EventStore, N as NetEvent } from '../event-store--nMbAO1v.js';
2
+ import { P as PetriNet, b as Transition, T as Token } from '../petri-net-C3LSY-vm.js';
3
+ import { E as EventStore, N as NetEvent } from '../event-store-DKTenPbC.js';
4
4
 
5
5
  /**
6
6
  * Commands sent from debug UI client to server via WebSocket.
@@ -1,5 +1,5 @@
1
1
  import { Application } from 'typedoc';
2
- import { P as PetriNet, S as SubnetDef, o as Instance } from '../petri-net-Byc3gSgJ.js';
2
+ import { P as PetriNet, S as SubnetDef, o as Instance } from '../petri-net-C3LSY-vm.js';
3
3
 
4
4
  /**
5
5
  * TypeDoc plugin for `@petrinet` and `@subnet` tags — auto-generates
@@ -1,4 +1,4 @@
1
- import { T as Token } from './petri-net-Byc3gSgJ.js';
1
+ import { T as Token } from './petri-net-C3LSY-vm.js';
2
2
 
3
3
  /**
4
4
  * Events emitted during Petri Net execution.
@@ -1,4 +1,4 @@
1
- import { P as PetriNet } from '../petri-net-Byc3gSgJ.js';
1
+ import { P as PetriNet } from '../petri-net-C3LSY-vm.js';
2
2
 
3
3
  /**
4
4
  * Format-agnostic typed graph model.
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
- import { P as PetriNet, S as SubnetDef, a as Place, T as Token, b as Transition, E as EnvironmentPlace, c as TransitionContext, O as Out } from './petri-net-Byc3gSgJ.js';
2
- export { A as Arc, d as ArcInhibitor, e as ArcInput, f as ArcOutput, g as ArcRead, h as ArcReset, C as Channel, i as ComposeBindings, F as FusionSet, j as FusionSetBuilder, I as In, k as InAll, l as InAtLeast, m as InExactly, n as InOne, o as Instance, p as Interface, q as InterfaceBuilder, K as KeyFn, L as LogFn, M as MAX_DURATION_MS, r as MatchKey, s as MatchSpec, N as NameId, t as OutAnd, u as OutForwardInput, v as OutPlace, w as OutTimeout, x as OutXor, y as OutputEntry, z as PetriNetBuilder, B as Port, D as PortDirection, G as SubnetDefBuilder, H as SubnetInstance, J as Timing, Q as TimingDeadline, R as TimingDelayed, U as TimingExact, V as TimingImmediate, W as TimingWindow, X as TokenInput, Y as TokenOutput, Z as TransitionAction, _ as TransitionBuilder, $ as VerificationHarness, a0 as VerificationResult, a1 as all, a2 as allPlaces, a3 as and, a4 as andPlaces, a5 as arcPlace, a6 as atLeast, a7 as consumptionCount, a8 as deadline, a9 as delayed, aa as earliest, ab as enumerateBranches, ac as environmentPlace, ad as exact, ae as exactly, af as fork, ag as forwardInput, ah as hasDeadline, ai as hasGuard, aj as immediate, ak as inhibitorArc, al as inputArc, am as isUnit, an as keyForPlace, ao as latest, ap as matchCorrelates, aq as matchKey, ar as matchSpec, as as matchesGuard, at as nameId, au as one, av as outPlace, aw as outputArc, ax as passthrough, ay as place, az as produce, aA as readArc, aB as requiredCount, aC as resetArc, aD as timeout, aE as timeoutPlace, aF as tokenAt, aG as tokenOf, aH as transform, aI as transformAsync, aJ as transformFrom, aK as unitToken, aL as window, aM as withTimeout, aN as xor, aO as xorPlaces } from './petri-net-Byc3gSgJ.js';
3
- import { E as EventStore } from './event-store--nMbAO1v.js';
4
- export { A as ActionTimedOut, a as ExecutionCompleted, b as ExecutionStarted, I as InMemoryEventStore, L as LogMessage, M as MarkingSnapshot, N as NetEvent, T as TokenAdded, c as TokenRemoved, d as TransitionClockRestarted, e as TransitionCompleted, f as TransitionEnabled, g as TransitionFailed, h as TransitionStarted, i as TransitionTimedOut, j as eventTransitionName, k as eventsOfType, l as failures, m as filterEvents, n as inMemoryEventStore, o as isFailureEvent, p as noopEventStore, t as transitionEvents } from './event-store--nMbAO1v.js';
1
+ import { P as PetriNet, S as SubnetDef, a as Place, T as Token, b as Transition, E as EnvironmentPlace, c as TransitionContext, O as Out } from './petri-net-C3LSY-vm.js';
2
+ export { A as Arc, d as ArcInhibitor, e as ArcInput, f as ArcOutput, g as ArcRead, h as ArcReset, C as Channel, i as ComposeBindings, F as FusionSet, j as FusionSetBuilder, I as In, k as InAll, l as InAtLeast, m as InExactly, n as InOne, o as Instance, p as Interface, q as InterfaceBuilder, K as KeyFn, L as LogFn, M as MAX_DURATION_MS, r as MatchKey, s as MatchSpec, N as NameId, t as OutAnd, u as OutForwardInput, v as OutPlace, w as OutTimeout, x as OutXor, y as OutputEntry, z as PetriNetBuilder, B as Port, D as PortDirection, G as SubnetDefBuilder, H as SubnetInstance, J as Timing, Q as TimingDeadline, R as TimingDelayed, U as TimingExact, V as TimingImmediate, W as TimingWindow, X as TokenInput, Y as TokenOutput, Z as TransitionAction, _ as TransitionBuilder, $ as VerificationHarness, a0 as VerificationResult, a1 as all, a2 as allPlaces, a3 as and, a4 as andPlaces, a5 as arcPlace, a6 as atLeast, a7 as consumptionCount, a8 as deadline, a9 as delayed, aa as earliest, ab as enumerateBranches, ac as environmentPlace, ad as exact, ae as exactly, af as fork, ag as forwardInput, ah as hasDeadline, ai as hasGuard, aj as immediate, ak as inhibitorArc, al as inputArc, am as isPassthrough, an as isUnit, ao as keyForPlace, ap as latest, aq as matchCorrelates, ar as matchKey, as as matchSpec, at as matchesGuard, au as nameId, av as one, aw as outPlace, ax as outputArc, ay as passthrough, az as place, aA as produce, aB as readArc, aC as requiredCount, aD as resetArc, aE as timeout, aF as timeoutPlace, aG as tokenAt, aH as tokenOf, aI as transform, aJ as transformAsync, aK as transformFrom, aL as unitToken, aM as window, aN as withTimeout, aO as xor, aP as xorPlaces } from './petri-net-C3LSY-vm.js';
3
+ import { E as EventStore } from './event-store-DKTenPbC.js';
4
+ export { A as ActionTimedOut, a as ExecutionCompleted, b as ExecutionStarted, I as InMemoryEventStore, L as LogMessage, M as MarkingSnapshot, N as NetEvent, T as TokenAdded, c as TokenRemoved, d as TransitionClockRestarted, e as TransitionCompleted, f as TransitionEnabled, g as TransitionFailed, h as TransitionStarted, i as TransitionTimedOut, j as eventTransitionName, k as eventsOfType, l as failures, m as filterEvents, n as inMemoryEventStore, o as isFailureEvent, p as noopEventStore, t as transitionEvents } from './event-store-DKTenPbC.js';
5
5
 
6
6
  /**
7
7
  * Discriminated sum-type abstraction over Petri nets, distinguishing **closed**
package/dist/index.js CHANGED
@@ -4,15 +4,24 @@ import {
4
4
  and,
5
5
  andPlaces,
6
6
  enumerateBranches,
7
+ fork,
7
8
  forwardInput,
9
+ isPassthrough,
8
10
  isProven,
9
11
  isViolated,
10
12
  outPlace,
13
+ passthrough,
14
+ produce,
15
+ requireOutputProducingActions,
11
16
  timeout,
12
17
  timeoutPlace,
18
+ transform,
19
+ transformAsync,
20
+ transformFrom,
21
+ withTimeout,
13
22
  xor,
14
23
  xorPlaces
15
- } from "./chunk-V3WTQRHC.js";
24
+ } from "./chunk-7VJ5CYUU.js";
16
25
  import {
17
26
  eventTransitionName,
18
27
  isFailureEvent
@@ -142,77 +151,6 @@ function nameId(value) {
142
151
  return value;
143
152
  }
144
153
 
145
- // src/core/transition-action.ts
146
- function passthrough() {
147
- return PASSTHROUGH;
148
- }
149
- var PASSTHROUGH = async () => {
150
- };
151
- function transform(fn) {
152
- return async (ctx) => {
153
- const result = fn(ctx);
154
- for (const outputPlace of ctx.outputPlaces()) {
155
- ctx.output(outputPlace, result);
156
- }
157
- };
158
- }
159
- function fork() {
160
- return transform((ctx) => {
161
- const inputPlaces = ctx.inputPlaces();
162
- if (inputPlaces.size !== 1) {
163
- throw new Error(`Fork requires exactly 1 input place, found ${inputPlaces.size}`);
164
- }
165
- const inputPlace = inputPlaces.values().next().value;
166
- return ctx.input(inputPlace);
167
- });
168
- }
169
- function transformFrom(inputPlace, fn) {
170
- return transform((ctx) => fn(ctx.input(inputPlace)));
171
- }
172
- function transformAsync(fn) {
173
- return async (ctx) => {
174
- const result = await fn(ctx);
175
- for (const outputPlace of ctx.outputPlaces()) {
176
- ctx.output(outputPlace, result);
177
- }
178
- };
179
- }
180
- function produce(place2, value) {
181
- return async (ctx) => {
182
- ctx.output(place2, value);
183
- };
184
- }
185
- function withTimeout(action, timeoutMs, timeoutPlace2, timeoutValue) {
186
- return (ctx) => {
187
- return new Promise((resolve2, reject) => {
188
- let completed = false;
189
- const timer = setTimeout(() => {
190
- if (!completed) {
191
- completed = true;
192
- ctx.output(timeoutPlace2, timeoutValue);
193
- resolve2();
194
- }
195
- }, timeoutMs);
196
- action(ctx).then(
197
- () => {
198
- if (!completed) {
199
- completed = true;
200
- clearTimeout(timer);
201
- resolve2();
202
- }
203
- },
204
- (err) => {
205
- if (!completed) {
206
- completed = true;
207
- clearTimeout(timer);
208
- reject(err);
209
- }
210
- }
211
- );
212
- });
213
- };
214
- }
215
-
216
154
  // src/core/token-output.ts
217
155
  var TokenOutput = class {
218
156
  _entries = [];
@@ -1326,10 +1264,6 @@ function describeTiming(t) {
1326
1264
  return `Exact(atMs=${t.atMs})`;
1327
1265
  }
1328
1266
  }
1329
- var PASSTHROUGH_REF = passthrough();
1330
- function isPassthrough(action) {
1331
- return action === PASSTHROUGH_REF;
1332
- }
1333
1267
  function keyOfIn(arc) {
1334
1268
  switch (arc.type) {
1335
1269
  case "one":
@@ -1572,6 +1506,7 @@ var SubnetDef = class _SubnetDef {
1572
1506
  }
1573
1507
  }
1574
1508
  const syntheticNet = PetriNet.builder("verify_" + this.name).compose(sut, portMappings).build();
1509
+ requireOutputProducingActions(syntheticNet);
1575
1510
  const perProperty = /* @__PURE__ */ new Map();
1576
1511
  for (const property of properties) {
1577
1512
  const verifier = SmtVerifier.forNet(syntheticNet).property(property);
@@ -1923,6 +1858,10 @@ var PetriNet = class _PetriNet {
1923
1858
  }
1924
1859
  /**
1925
1860
  * Creates a new PetriNet with actions bound via a resolver function.
1861
+ *
1862
+ * The resolver is called once per transition with its name. Returning `null`
1863
+ * defers that transition — it keeps whatever action it already carries — which
1864
+ * is what makes staged binding (**MOD-024** AC7) work.
1926
1865
  */
1927
1866
  bindActionsWithResolver(actionResolver) {
1928
1867
  const boundTransitions = /* @__PURE__ */ new Set();
@@ -2556,6 +2495,7 @@ var CompiledNet = class _CompiledNet {
2556
2495
  _hasMatch;
2557
2496
  constructor(net) {
2558
2497
  this.net = net;
2498
+ requireOutputProducingActions(net);
2559
2499
  const allPlacesSet = /* @__PURE__ */ new Map();
2560
2500
  for (const t of net.transitions) {
2561
2501
  for (const spec of t.inputSpecs) allPlacesSet.set(spec.place.name, spec.place);
@@ -5612,6 +5552,7 @@ export {
5612
5552
  inputArc,
5613
5553
  intersects,
5614
5554
  isFailureEvent,
5555
+ isPassthrough,
5615
5556
  isUnit,
5616
5557
  keyForPlace,
5617
5558
  latest,