libpetri 5.0.0 → 6.0.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,4 +1,4 @@
1
- import { T as Token } from './petri-net-CH7UvjOW.js';
1
+ import { T as Token } from './petri-net-34SkD5RT.js';
2
2
 
3
3
  /**
4
4
  * Events emitted during Petri Net execution.
@@ -23,6 +23,12 @@ interface TransitionEnabled {
23
23
  readonly timestamp: number;
24
24
  readonly transitionName: string;
25
25
  }
26
+ /**
27
+ * A transition's clock restarted while it stayed marked enabled: another firing took tokens
28
+ * it needed and its places were refilled before the executor re-evaluated it (TIME-012).
29
+ * This executor re-evaluates between a firing and its deposit, so it reports such a restart
30
+ * as `transition-enabled`.
31
+ */
26
32
  interface TransitionClockRestarted {
27
33
  readonly type: 'transition-clock-restarted';
28
34
  readonly timestamp: number;
@@ -1,4 +1,4 @@
1
- import { P as PetriNet } from '../petri-net-CH7UvjOW.js';
1
+ import { P as PetriNet } from '../petri-net-34SkD5RT.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-CH7UvjOW.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 immediate, aj as inhibitorArc, ak as inputArc, al as isPassthrough, am as isUnit, an as keyForPlace, ao as latest, ap as matchCorrelates, aq as matchKey, ar as matchSpec, as as nameId, at as one, au as outPlace, av as outputArc, aw as passthrough, ax as place, ay as produce, az as readArc, aA as requiredCount, aB as resetArc, aC as timeout, aD as timeoutPlace, aE as tokenAt, aF as tokenOf, aG as transform, aH as transformAsync, aI as transformFrom, aJ as unitToken, aK as window, aL as withTimeout, aM as xor, aN as xorPlaces } from './petri-net-CH7UvjOW.js';
3
- import { E as EventStore } from './event-store-hlH3-bzJ.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-hlH3-bzJ.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-34SkD5RT.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 immediate, aj as inhibitorArc, ak as inputArc, al as isPassthrough, am as isUnit, an as keyForPlace, ao as latest, ap as matchCorrelates, aq as matchKey, ar as matchSpec, as as nameId, at as one, au as outPlace, av as outputArc, aw as passthrough, ax as place, ay as produce, az as readArc, aA as requiredCount, aB as resetArc, aC as timeout, aD as timeoutPlace, aE as tokenAt, aF as tokenOf, aG as transform, aH as transformAsync, aI as transformFrom, aJ as unitToken, aK as window, aL as withTimeout, aM as xor, aN as xorPlaces } from './petri-net-34SkD5RT.js';
3
+ import { E as EventStore } from './event-store-D6i4u41W.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-D6i4u41W.js';
5
5
 
6
6
  /**
7
7
  * Discriminated sum-type abstraction over Petri nets, distinguishing **closed**
@@ -325,13 +325,23 @@ declare class BitmapNetExecutor implements PetriNetExecutor {
325
325
  private readonly externalQueue;
326
326
  private wakeUpResolve;
327
327
  private readonly readyBuffer;
328
- private readonly pendingResetPlaces;
328
+ /**
329
+ * Per transition, one bit: a firing left it disabled in the intermediate marking while it
330
+ * was marked enabled (TIME-012), so the next dirty scan that finds it enabled restarts its
331
+ * clock. Set at fire time, cleared at the end of every scan; `anyRestartPending` lets the
332
+ * scan skip the clear when nothing was flagged.
333
+ */
334
+ private readonly restartPendingWords;
335
+ private anyRestartPending;
336
+ /** Per place, the count a firing must leave it at to have disabled nothing through it. */
337
+ private readonly restartThresholds;
329
338
  /**
330
339
  * Undeclared place names already reported (CORE-072 AC4). Keyed by name — TS
331
340
  * Place identity is name-based — so a hot loop warns once, not per token.
332
341
  */
333
342
  private readonly warnedUnknownPlaces;
334
- private readonly transitionInputPlaceNames;
343
+ /** Transitions already warned for writing several tokens to a place their spec names once (IO-016 AC4). */
344
+ private readonly warnedMultiplicity;
335
345
  private running;
336
346
  private draining;
337
347
  private closed;
@@ -366,7 +376,14 @@ declare class BitmapNetExecutor implements PetriNetExecutor {
366
376
  */
367
377
  private enforceDeadlines;
368
378
  private canEnable;
369
- private hasInputFromResetPlace;
379
+ /**
380
+ * Flags each other transition that firing `tid` has just disabled through `pid`
381
+ * (TIME-012). Called from {@link updateBitmapAfterConsumption} on the intermediate marking
382
+ * M - Pre(t) (inputs consumed and resets drained, outputs not yet deposited), and only for
383
+ * a place the firing left below its restart threshold. Removing tokens never trips an
384
+ * inhibitor arc, so the bit tests reject every other kind of neighbour cheaply.
385
+ */
386
+ private flagIntermediateDisablements;
370
387
  private fireReadyTransitions;
371
388
  /**
372
389
  * Fast path for nets where all transitions are immediate and same priority.
@@ -436,6 +453,13 @@ declare class BitmapNetExecutor implements PetriNetExecutor {
436
453
  * initial-marking and injection seams. Retention never depends on this.
437
454
  */
438
455
  private warnUnknownPlace;
456
+ /**
457
+ * Reports, once per transition, a firing that wrote more than one token to a place
458
+ * its output spec names once (IO-016 AC4), as the EVT-013 log-message event. The
459
+ * tokens are deposited regardless: the diagnostic makes the under-approximation
460
+ * every branch-enumerating analysis makes of this transition visible.
461
+ */
462
+ private warnMultiplicity;
439
463
  private emitEvent;
440
464
  }
441
465
 
@@ -509,6 +533,10 @@ declare class PrecompiledNet {
509
533
  /** -2=no spec, -1=complex, >=0=single output place ID. */
510
534
  readonly simpleOutputPlaceId: Int32Array;
511
535
  readonly inputPlaceCount: Uint32Array;
536
+ /**
537
+ * @deprecated Not read by the executor. Kept so the exported shape of `PrecompiledNet`
538
+ * stays stable; scheduled for removal in the next major release.
539
+ */
512
540
  readonly inputPlaceMaskWords: readonly Uint32Array[];
513
541
  readonly placeToTransitions: readonly (readonly number[])[];
514
542
  readonly consumptionPlaceIds: readonly (readonly number[])[];
@@ -598,6 +626,8 @@ declare class PrecompiledNetExecutor implements PetriNetExecutor {
598
626
  * materializing a Marking has one to hand.
599
627
  */
600
628
  private readonly unknownPlaceTokens;
629
+ /** Transitions already warned for writing several tokens to a place their spec names once (IO-016 AC4). */
630
+ private readonly warnedMultiplicity;
601
631
  /** Monotonic source for ν-name minting (ctx.freshName(), NU-010). */
602
632
  private freshNameCounter;
603
633
  /**
@@ -634,8 +664,16 @@ declare class PrecompiledNetExecutor implements PetriNetExecutor {
634
664
  private readonly inFlightResolves;
635
665
  private readonly inFlightErrors;
636
666
  private inFlightCount;
637
- private readonly pendingResetWords;
638
- private hasPendingResets;
667
+ /**
668
+ * Per transition, one bit: a firing left it disabled in the intermediate marking while it
669
+ * was marked enabled (TIME-012), so the next dirty scan that finds it enabled restarts its
670
+ * clock. Set at fire time, cleared at the end of every scan; `anyRestartPending` lets the
671
+ * scan skip the clear when nothing was flagged.
672
+ */
673
+ private readonly restartPendingWords;
674
+ private anyRestartPending;
675
+ /** Per place, the count a firing must leave it at to have disabled nothing through it. */
676
+ private readonly restartThresholds;
639
677
  private readonly completionQueue;
640
678
  private readonly externalQueue;
641
679
  private wakeUpResolve;
@@ -676,7 +714,13 @@ declare class PrecompiledNetExecutor implements PetriNetExecutor {
676
714
  private canEnable;
677
715
  private countMatching;
678
716
  private removeFirstMatching;
679
- private hasInputFromResetPlace;
717
+ /**
718
+ * Flags each other transition that firing `tid` has just disabled through `pid`
719
+ * (TIME-012). Called from {@link updateBitmapAfterConsumption} on the intermediate marking,
720
+ * only for a place the firing left below its restart threshold. Mirrors the bitmap
721
+ * executor, which gives the rationale.
722
+ */
723
+ private flagIntermediateDisablements;
680
724
  private fireReadyTransitions;
681
725
  /**
682
726
  * Fast path for nets where all transitions are immediate and same priority.
@@ -745,6 +789,14 @@ declare class PrecompiledNetExecutor implements PetriNetExecutor {
745
789
  executionId(): string;
746
790
  drain(): void;
747
791
  close(): void;
792
+ /**
793
+ * Reports, once per transition, a firing that wrote more than one token to a place
794
+ * its output spec names once (IO-016 AC4), as the EVT-013 log-message event. The
795
+ * tokens are deposited regardless: the diagnostic makes the under-approximation
796
+ * every branch-enumerating analysis makes of this transition visible. Mirrors the
797
+ * bitmap executor word for word.
798
+ */
799
+ private warnMultiplicity;
748
800
  private emitEvent;
749
801
  }
750
802