libpetri 5.0.0 → 5.1.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.
- package/dist/{chunk-4HMFNYTH.js → chunk-BPGE7GZR.js} +2 -2
- package/dist/{chunk-75KEJQGC.js → chunk-EL4E6LVO.js} +1002 -205
- package/dist/chunk-EL4E6LVO.js.map +1 -0
- package/dist/debug/index.d.ts +2 -2
- package/dist/doclet/index.d.ts +1 -1
- package/dist/doclet/resources/petrinet-diagrams.js +4892 -4896
- package/dist/{event-store-hlH3-bzJ.d.ts → event-store-CUyHiIH7.d.ts} +1 -1
- package/dist/export/index.d.ts +1 -1
- package/dist/index.d.ts +23 -4
- package/dist/index.js +69 -4
- package/dist/index.js.map +1 -1
- package/dist/{petri-net-CH7UvjOW.d.ts → petri-net-6G5r1Wwb.d.ts} +59 -2
- package/dist/render-dom/index.js +1 -1
- package/dist/verification/index.d.ts +435 -14
- package/dist/verification/index.js +31 -1
- package/dist/verification/index.js.map +1 -1
- package/dist/viewer/index.js +1 -1
- package/dist/viewer/viewer.iife.js +4892 -4896
- package/package.json +5 -5
- package/dist/chunk-75KEJQGC.js.map +0 -1
- /package/dist/{chunk-4HMFNYTH.js.map → chunk-BPGE7GZR.js.map} +0 -0
package/dist/export/index.d.ts
CHANGED
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-
|
|
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-
|
|
3
|
-
import { E as EventStore } from './event-store-
|
|
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-
|
|
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-6G5r1Wwb.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-6G5r1Wwb.js';
|
|
3
|
+
import { E as EventStore } from './event-store-CUyHiIH7.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-CUyHiIH7.js';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Discriminated sum-type abstraction over Petri nets, distinguishing **closed**
|
|
@@ -331,6 +331,8 @@ declare class BitmapNetExecutor implements PetriNetExecutor {
|
|
|
331
331
|
* Place identity is name-based — so a hot loop warns once, not per token.
|
|
332
332
|
*/
|
|
333
333
|
private readonly warnedUnknownPlaces;
|
|
334
|
+
/** Transitions already warned for writing several tokens to a place their spec names once (IO-016 AC4). */
|
|
335
|
+
private readonly warnedMultiplicity;
|
|
334
336
|
private readonly transitionInputPlaceNames;
|
|
335
337
|
private running;
|
|
336
338
|
private draining;
|
|
@@ -436,6 +438,13 @@ declare class BitmapNetExecutor implements PetriNetExecutor {
|
|
|
436
438
|
* initial-marking and injection seams. Retention never depends on this.
|
|
437
439
|
*/
|
|
438
440
|
private warnUnknownPlace;
|
|
441
|
+
/**
|
|
442
|
+
* Reports, once per transition, a firing that wrote more than one token to a place
|
|
443
|
+
* its output spec names once (IO-016 AC4), as the EVT-013 log-message event. The
|
|
444
|
+
* tokens are deposited regardless: the diagnostic makes the under-approximation
|
|
445
|
+
* every branch-enumerating analysis makes of this transition visible.
|
|
446
|
+
*/
|
|
447
|
+
private warnMultiplicity;
|
|
439
448
|
private emitEvent;
|
|
440
449
|
}
|
|
441
450
|
|
|
@@ -598,6 +607,8 @@ declare class PrecompiledNetExecutor implements PetriNetExecutor {
|
|
|
598
607
|
* materializing a Marking has one to hand.
|
|
599
608
|
*/
|
|
600
609
|
private readonly unknownPlaceTokens;
|
|
610
|
+
/** Transitions already warned for writing several tokens to a place their spec names once (IO-016 AC4). */
|
|
611
|
+
private readonly warnedMultiplicity;
|
|
601
612
|
/** Monotonic source for ν-name minting (ctx.freshName(), NU-010). */
|
|
602
613
|
private freshNameCounter;
|
|
603
614
|
/**
|
|
@@ -745,6 +756,14 @@ declare class PrecompiledNetExecutor implements PetriNetExecutor {
|
|
|
745
756
|
executionId(): string;
|
|
746
757
|
drain(): void;
|
|
747
758
|
close(): void;
|
|
759
|
+
/**
|
|
760
|
+
* Reports, once per transition, a firing that wrote more than one token to a place
|
|
761
|
+
* its output spec names once (IO-016 AC4), as the EVT-013 log-message event. The
|
|
762
|
+
* tokens are deposited regardless: the diagnostic makes the under-approximation
|
|
763
|
+
* every branch-enumerating analysis makes of this transition visible. Mirrors the
|
|
764
|
+
* bitmap executor word for word.
|
|
765
|
+
*/
|
|
766
|
+
private warnMultiplicity;
|
|
748
767
|
private emitEvent;
|
|
749
768
|
}
|
|
750
769
|
|
package/dist/index.js
CHANGED
|
@@ -28,7 +28,7 @@ import {
|
|
|
28
28
|
withTimeout,
|
|
29
29
|
xor,
|
|
30
30
|
xorPlaces
|
|
31
|
-
} from "./chunk-
|
|
31
|
+
} from "./chunk-EL4E6LVO.js";
|
|
32
32
|
import {
|
|
33
33
|
eventTransitionName,
|
|
34
34
|
isFailureEvent
|
|
@@ -3253,6 +3253,8 @@ var BitmapNetExecutor = class {
|
|
|
3253
3253
|
* Place identity is name-based — so a hot loop warns once, not per token.
|
|
3254
3254
|
*/
|
|
3255
3255
|
warnedUnknownPlaces = /* @__PURE__ */ new Set();
|
|
3256
|
+
/** Transitions already warned for writing several tokens to a place their spec names once (IO-016 AC4). */
|
|
3257
|
+
warnedMultiplicity = /* @__PURE__ */ new Set();
|
|
3256
3258
|
transitionInputPlaceNames;
|
|
3257
3259
|
running = false;
|
|
3258
3260
|
draining = false;
|
|
@@ -3913,7 +3915,9 @@ var BitmapNetExecutor = class {
|
|
|
3913
3915
|
try {
|
|
3914
3916
|
const outputs = flight.context.rawOutput();
|
|
3915
3917
|
if (t.outputSpec !== null) {
|
|
3916
|
-
|
|
3918
|
+
const produced2 = outputs.placesWithTokens();
|
|
3919
|
+
const claim = validateOutSpec(t.name, t.outputSpec, produced2);
|
|
3920
|
+
if (outputs.entries().length > produced2.size) this.warnMultiplicity(t.name, outputs, claim);
|
|
3917
3921
|
}
|
|
3918
3922
|
const produced = [];
|
|
3919
3923
|
for (const entry of outputs.entries()) {
|
|
@@ -4124,6 +4128,33 @@ var BitmapNetExecutor = class {
|
|
|
4124
4128
|
errorMessage: null
|
|
4125
4129
|
});
|
|
4126
4130
|
}
|
|
4131
|
+
/**
|
|
4132
|
+
* Reports, once per transition, a firing that wrote more than one token to a place
|
|
4133
|
+
* its output spec names once (IO-016 AC4), as the EVT-013 log-message event. The
|
|
4134
|
+
* tokens are deposited regardless: the diagnostic makes the under-approximation
|
|
4135
|
+
* every branch-enumerating analysis makes of this transition visible.
|
|
4136
|
+
*/
|
|
4137
|
+
warnMultiplicity(transitionName, outputs, claim) {
|
|
4138
|
+
if (this.warnedMultiplicity.has(transitionName)) return;
|
|
4139
|
+
const counts = /* @__PURE__ */ new Map();
|
|
4140
|
+
for (const entry of outputs.entries()) {
|
|
4141
|
+
if (claim.has(entry.place.name)) counts.set(entry.place.name, (counts.get(entry.place.name) ?? 0) + 1);
|
|
4142
|
+
}
|
|
4143
|
+
const repeated = [];
|
|
4144
|
+
for (const [name, n] of counts) if (n > 1) repeated.push(`${name}: ${n}`);
|
|
4145
|
+
if (repeated.length === 0) return;
|
|
4146
|
+
this.warnedMultiplicity.add(transitionName);
|
|
4147
|
+
this.emitEvent({
|
|
4148
|
+
type: "log-message",
|
|
4149
|
+
timestamp: Date.now(),
|
|
4150
|
+
transitionName,
|
|
4151
|
+
logger: "libpetri.runtime",
|
|
4152
|
+
level: "WARN",
|
|
4153
|
+
message: `'${transitionName}': wrote more than one token to a place its output spec names once (${repeated.join(", ")}); branch-enumerating analyses model one token per named place, so this firing exceeds what they explore (IO-016)`,
|
|
4154
|
+
error: null,
|
|
4155
|
+
errorMessage: null
|
|
4156
|
+
});
|
|
4157
|
+
}
|
|
4127
4158
|
emitEvent(event) {
|
|
4128
4159
|
if (this.eventStoreEnabled) {
|
|
4129
4160
|
try {
|
|
@@ -4517,6 +4548,8 @@ var PrecompiledNetExecutor = class {
|
|
|
4517
4548
|
* materializing a Marking has one to hand.
|
|
4518
4549
|
*/
|
|
4519
4550
|
unknownPlaceTokens = /* @__PURE__ */ new Map();
|
|
4551
|
+
/** Transitions already warned for writing several tokens to a place their spec names once (IO-016 AC4). */
|
|
4552
|
+
warnedMultiplicity = /* @__PURE__ */ new Set();
|
|
4520
4553
|
/** Monotonic source for ν-name minting (ctx.freshName(), NU-010). */
|
|
4521
4554
|
freshNameCounter = 0;
|
|
4522
4555
|
/**
|
|
@@ -5393,13 +5426,17 @@ var PrecompiledNetExecutor = class {
|
|
|
5393
5426
|
const simplePid = prog.simpleOutputPlaceId[tid];
|
|
5394
5427
|
if (simplePid >= 0) {
|
|
5395
5428
|
const produced2 = outputs.placesWithTokens();
|
|
5396
|
-
|
|
5429
|
+
const named = prog.places[simplePid].name;
|
|
5430
|
+
if (!produced2.has(named)) {
|
|
5397
5431
|
throw new OutViolationError(
|
|
5398
5432
|
`'${t.name}': output does not match the declared spec - produced {}, which no single branch of the spec claims exactly`
|
|
5399
5433
|
);
|
|
5400
5434
|
}
|
|
5435
|
+
if (outputs.entries().length > produced2.size) this.warnMultiplicity(t.name, outputs, /* @__PURE__ */ new Set([named]));
|
|
5401
5436
|
} else if (simplePid === -1) {
|
|
5402
|
-
|
|
5437
|
+
const produced2 = outputs.placesWithTokens();
|
|
5438
|
+
const claim = validateOutSpec(t.name, t.outputSpec, produced2);
|
|
5439
|
+
if (outputs.entries().length > produced2.size) this.warnMultiplicity(t.name, outputs, claim);
|
|
5403
5440
|
}
|
|
5404
5441
|
}
|
|
5405
5442
|
const produced = [];
|
|
@@ -5619,6 +5656,34 @@ var PrecompiledNetExecutor = class {
|
|
|
5619
5656
|
this.wakeUp();
|
|
5620
5657
|
}
|
|
5621
5658
|
// ======================== Event Emission ========================
|
|
5659
|
+
/**
|
|
5660
|
+
* Reports, once per transition, a firing that wrote more than one token to a place
|
|
5661
|
+
* its output spec names once (IO-016 AC4), as the EVT-013 log-message event. The
|
|
5662
|
+
* tokens are deposited regardless: the diagnostic makes the under-approximation
|
|
5663
|
+
* every branch-enumerating analysis makes of this transition visible. Mirrors the
|
|
5664
|
+
* bitmap executor word for word.
|
|
5665
|
+
*/
|
|
5666
|
+
warnMultiplicity(transitionName, outputs, claim) {
|
|
5667
|
+
if (this.warnedMultiplicity.has(transitionName)) return;
|
|
5668
|
+
const counts = /* @__PURE__ */ new Map();
|
|
5669
|
+
for (const entry of outputs.entries()) {
|
|
5670
|
+
if (claim.has(entry.place.name)) counts.set(entry.place.name, (counts.get(entry.place.name) ?? 0) + 1);
|
|
5671
|
+
}
|
|
5672
|
+
const repeated = [];
|
|
5673
|
+
for (const [name, n] of counts) if (n > 1) repeated.push(`${name}: ${n}`);
|
|
5674
|
+
if (repeated.length === 0) return;
|
|
5675
|
+
this.warnedMultiplicity.add(transitionName);
|
|
5676
|
+
this.emitEvent({
|
|
5677
|
+
type: "log-message",
|
|
5678
|
+
timestamp: Date.now(),
|
|
5679
|
+
transitionName,
|
|
5680
|
+
logger: "libpetri.runtime",
|
|
5681
|
+
level: "WARN",
|
|
5682
|
+
message: `'${transitionName}': wrote more than one token to a place its output spec names once (${repeated.join(", ")}); branch-enumerating analyses model one token per named place, so this firing exceeds what they explore (IO-016)`,
|
|
5683
|
+
error: null,
|
|
5684
|
+
errorMessage: null
|
|
5685
|
+
});
|
|
5686
|
+
}
|
|
5622
5687
|
emitEvent(event) {
|
|
5623
5688
|
if (this.eventStoreEnabled) {
|
|
5624
5689
|
try {
|