libpetri 2.12.0 → 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.
- package/dist/{chunk-V3WTQRHC.js → chunk-7VJ5CYUU.js} +104 -2
- package/dist/chunk-7VJ5CYUU.js.map +1 -0
- package/dist/debug/index.d.ts +2 -2
- package/dist/doclet/index.d.ts +1 -1
- package/dist/{event-store-CAkN_ayv.d.ts → event-store-DKTenPbC.d.ts} +1 -1
- package/dist/export/index.d.ts +1 -1
- package/dist/index.d.ts +51 -4
- package/dist/index.js +247 -117
- package/dist/index.js.map +1 -1
- package/dist/{petri-net-B4wQwsUj.d.ts → petri-net-C3LSY-vm.d.ts} +63 -9
- package/dist/verification/index.d.ts +9 -3
- package/dist/verification/index.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-V3WTQRHC.js.map +0 -1
|
@@ -405,10 +405,22 @@ interface OutputEntry {
|
|
|
405
405
|
*/
|
|
406
406
|
declare class TokenOutput {
|
|
407
407
|
private readonly _entries;
|
|
408
|
+
/**
|
|
409
|
+
* Once true, further writes are dropped instead of appended. Set by the executor
|
|
410
|
+
* (via {@link import('./transition-context.js').TransitionContext.detachForTimeout})
|
|
411
|
+
* when a firing times out, so the action it has stopped waiting for can no longer
|
|
412
|
+
* reach the marking. Irreversible.
|
|
413
|
+
*/
|
|
414
|
+
private detached;
|
|
408
415
|
/** Add a value to an output place (creates token with current timestamp). */
|
|
409
416
|
add<T>(place: Place<T>, value: T): this;
|
|
410
417
|
/** Add a pre-existing token to an output place. */
|
|
411
418
|
addToken<T>(place: Place<T>, token: Token<T>): this;
|
|
419
|
+
/**
|
|
420
|
+
* @internal Severs this collector: subsequent {@link add}/{@link addToken} calls are
|
|
421
|
+
* dropped. Executor machinery invoked when a firing times out — never call from an action.
|
|
422
|
+
*/
|
|
423
|
+
detach(): void;
|
|
412
424
|
/** Returns all collected outputs. */
|
|
413
425
|
entries(): readonly OutputEntry[];
|
|
414
426
|
/** Check if any outputs were produced. */
|
|
@@ -432,7 +444,17 @@ type LogFn = (level: string, message: string, error?: Error) => void;
|
|
|
432
444
|
*/
|
|
433
445
|
declare class TransitionContext {
|
|
434
446
|
private readonly rawInput;
|
|
435
|
-
|
|
447
|
+
/**
|
|
448
|
+
* What the executor harvests. Identical to {@link writeTarget} until
|
|
449
|
+
* {@link detachForTimeout} replaces it with a fresh collector the action cannot reach.
|
|
450
|
+
*/
|
|
451
|
+
private _rawOutput;
|
|
452
|
+
/**
|
|
453
|
+
* What the action writes to. Never reassigned, so an action already inside
|
|
454
|
+
* `output(...)` cannot be redirected mid-write; severance happens by detaching this
|
|
455
|
+
* collector, not by swapping it.
|
|
456
|
+
*/
|
|
457
|
+
private readonly writeTarget;
|
|
436
458
|
private readonly allowedInputs;
|
|
437
459
|
private readonly allowedReads;
|
|
438
460
|
private readonly allowedOutputs;
|
|
@@ -496,6 +518,30 @@ declare class TransitionContext {
|
|
|
496
518
|
/** Returns declared output places. */
|
|
497
519
|
outputPlaces(): ReadonlySet<Place<any>>;
|
|
498
520
|
private requireOutput;
|
|
521
|
+
/**
|
|
522
|
+
* Severs the action's output from the marking, for use when a firing times out.
|
|
523
|
+
*
|
|
524
|
+
* After this call the action's `output(...)` writes are dropped, and the executor
|
|
525
|
+
* harvests a fresh collector the action holds no reference to. Anything the action
|
|
526
|
+
* wrote *before* the timeout is discarded with it: a partial result merged with the
|
|
527
|
+
* timeout branch would violate the transition's own output spec.
|
|
528
|
+
*
|
|
529
|
+
* This is the only isolation available — libpetri does not own the promise the action
|
|
530
|
+
* runs on, so it cannot stop the work, only stop the result from landing.
|
|
531
|
+
*
|
|
532
|
+
* @internal Executor machinery — must be called by the executor, never by an action.
|
|
533
|
+
*/
|
|
534
|
+
detachForTimeout(): void;
|
|
535
|
+
/**
|
|
536
|
+
* Produces into the executor's harvest collector rather than the action's write target.
|
|
537
|
+
*
|
|
538
|
+
* Identical to {@link output} before {@link detachForTimeout}; after it, this is the
|
|
539
|
+
* only route that still reaches the marking. Used by the executor to deposit the
|
|
540
|
+
* timeout branch.
|
|
541
|
+
*
|
|
542
|
+
* @internal Executor machinery — must be called by the executor, never by an action.
|
|
543
|
+
*/
|
|
544
|
+
outputToHarvest<T>(place: Place<T>, value: T): this;
|
|
499
545
|
/**
|
|
500
546
|
* @internal Installs the ν-name minter. Wired by the executor at firing time
|
|
501
547
|
* so names minted by {@link freshName} are monotonic across the run and
|
|
@@ -531,15 +577,19 @@ declare class TransitionContext {
|
|
|
531
577
|
type TransitionAction = (ctx: TransitionContext) => Promise<void>;
|
|
532
578
|
/**
|
|
533
579
|
* Identity action: produces no outputs.
|
|
580
|
+
* For transitions that only consume tokens without producing any.
|
|
534
581
|
*
|
|
535
|
-
* Returns a stable singleton reference (
|
|
536
|
-
*
|
|
537
|
-
* .composeActions} during channel composition (MOD-021) to short-circuit a
|
|
538
|
-
* passthrough-on-both-sides merge to passthrough — saving a microtask hop
|
|
539
|
-
* and matching the Java implementation's behaviour where both transitions'
|
|
540
|
-
* default actions collapse to the builder's own passthrough default.
|
|
582
|
+
* Returns a stable singleton reference (CORE-051), so {@link isPassthrough}
|
|
583
|
+
* can recognise it.
|
|
541
584
|
*/
|
|
542
585
|
declare function passthrough(): TransitionAction;
|
|
586
|
+
/**
|
|
587
|
+
* Whether `action` is the built-in {@link passthrough} — i.e. provably produces
|
|
588
|
+
* no output tokens. Identity-based, so a hand-written no-op is not claimed.
|
|
589
|
+
*
|
|
590
|
+
* @param action the action to test; `null` / `undefined` is not passthrough
|
|
591
|
+
*/
|
|
592
|
+
declare function isPassthrough(action: TransitionAction | null | undefined): boolean;
|
|
543
593
|
/**
|
|
544
594
|
* Transform action: applies function to context, copies result to ALL output places.
|
|
545
595
|
*
|
|
@@ -1493,8 +1543,12 @@ declare class PetriNet {
|
|
|
1493
1543
|
bindActions(actionBindings: Map<string, TransitionAction> | Record<string, TransitionAction>): PetriNet;
|
|
1494
1544
|
/**
|
|
1495
1545
|
* Creates a new PetriNet with actions bound via a resolver function.
|
|
1546
|
+
*
|
|
1547
|
+
* The resolver is called once per transition with its name. Returning `null`
|
|
1548
|
+
* defers that transition — it keeps whatever action it already carries — which
|
|
1549
|
+
* is what makes staged binding (**MOD-024** AC7) work.
|
|
1496
1550
|
*/
|
|
1497
|
-
bindActionsWithResolver(actionResolver: (name: string) => TransitionAction): PetriNet;
|
|
1551
|
+
bindActionsWithResolver(actionResolver: (name: string) => TransitionAction | null): PetriNet;
|
|
1498
1552
|
static builder(name: string): PetriNetBuilder;
|
|
1499
1553
|
}
|
|
1500
1554
|
declare class PetriNetBuilder {
|
|
@@ -1728,4 +1782,4 @@ declare class PetriNetBuilder {
|
|
|
1728
1782
|
private buildWithFusion;
|
|
1729
1783
|
}
|
|
1730
1784
|
|
|
1731
|
-
export { type VerificationHarness as $, type Arc as A, type Port as B, type Channel as C, type PortDirection as D, type EnvironmentPlace as E, FusionSet as F, SubnetDefBuilder as G, type SubnetInstance as H, type In as I, type Timing as J, type KeyFn as K, type LogFn as L, MAX_DURATION_MS as M, type NameId as N, type Out as O, PetriNet as P, type TimingDeadline as Q, type TimingDelayed as R, SubnetDef as S, type Token as T, type TimingExact as U, type TimingImmediate as V, type TimingWindow as W, TokenInput as X, TokenOutput as Y, type TransitionAction as Z, TransitionBuilder as _, type Place as a, type
|
|
1785
|
+
export { type VerificationHarness as $, type Arc as A, type Port as B, type Channel as C, type PortDirection as D, type EnvironmentPlace as E, FusionSet as F, SubnetDefBuilder as G, type SubnetInstance as H, type In as I, type Timing as J, type KeyFn as K, type LogFn as L, MAX_DURATION_MS as M, type NameId as N, type Out as O, PetriNet as P, type TimingDeadline as Q, type TimingDelayed as R, SubnetDef as S, type Token as T, type TimingExact as U, type TimingImmediate as V, type TimingWindow as W, TokenInput as X, TokenOutput as Y, type TransitionAction as Z, TransitionBuilder as _, type Place as a, type SmtStatistics as a$, type VerificationResult as a0, all as a1, allPlaces as a2, and as a3, andPlaces as a4, arcPlace as a5, atLeast as a6, consumptionCount as a7, deadline as a8, delayed as a9, produce as aA, readArc as aB, requiredCount as aC, resetArc as aD, timeout as aE, timeoutPlace as aF, tokenAt as aG, tokenOf as aH, transform as aI, transformAsync as aJ, transformFrom as aK, unitToken as aL, window as aM, withTimeout as aN, xor as aO, xorPlaces as aP, MarkingState as aQ, type PInvariant as aR, MarkingStateBuilder as aS, type SmtProperty as aT, type SmtVerificationResult as aU, type BranchPlaceBound as aV, type DeadlockFree as aW, type JoinedOrDeadLettered as aX, type MutualExclusion as aY, type PlaceBound as aZ, type Proven as a_, earliest as aa, enumerateBranches as ab, environmentPlace as ac, exact as ad, exactly as ae, fork as af, forwardInput as ag, hasDeadline as ah, hasGuard as ai, immediate as aj, inhibitorArc as ak, inputArc as al, isPassthrough as am, isUnit as an, keyForPlace as ao, latest as ap, matchCorrelates as aq, matchKey as ar, matchSpec as as, matchesGuard as at, nameId as au, one as av, outPlace as aw, outputArc as ax, passthrough as ay, place as az, Transition as b, type TokenSupplier as b0, type Unknown as b1, type Unreachable as b2, type Verdict as b3, type Violated as b4, branchPlaceBound as b5, deadlockFree as b6, isProven as b7, isViolated as b8, joinedOrDeadLettered as b9, mutualExclusion as ba, pInvariant as bb, pInvariantToString as bc, placeBound as bd, propertyDescription as be, unreachable as bf, TransitionContext as c, type ArcInhibitor as d, type ArcInput as e, type ArcOutput as f, type ArcRead as g, type ArcReset as h, ComposeBindings as i, FusionSetBuilder as j, type InAll as k, type InAtLeast as l, type InExactly as m, type InOne as n, Instance as o, Interface as p, InterfaceBuilder as q, type MatchKey as r, type MatchSpec as s, type OutAnd as t, type OutForwardInput as u, type OutPlace as v, type OutTimeout as w, type OutXor as x, type OutputEntry as y, PetriNetBuilder as z };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { b as Transition, a as Place, P as PetriNet, E as EnvironmentPlace,
|
|
2
|
-
export {
|
|
1
|
+
import { b as Transition, a as Place, P as PetriNet, E as EnvironmentPlace, aQ as MarkingState, aR as PInvariant, aS as MarkingStateBuilder, aT as SmtProperty, aU as SmtVerificationResult } from '../petri-net-C3LSY-vm.js';
|
|
2
|
+
export { aV as BranchPlaceBound, aW as DeadlockFree, aX as JoinedOrDeadLettered, aY as MutualExclusion, aZ as PlaceBound, a_ as Proven, a$ as SmtStatistics, b0 as TokenSupplier, b1 as Unknown, b2 as Unreachable, b3 as Verdict, $ as VerificationHarness, a0 as VerificationResult, b4 as Violated, b5 as branchPlaceBound, b6 as deadlockFree, b7 as isProven, b8 as isViolated, b9 as joinedOrDeadLettered, ba as mutualExclusion, bb as pInvariant, bc as pInvariantToString, bd as placeBound, be as propertyDescription, bf as unreachable } from '../petri-net-C3LSY-vm.js';
|
|
3
3
|
import { Expr, init, Bool, FuncDecl } from 'z3-solver';
|
|
4
4
|
|
|
5
5
|
/**
|
|
@@ -426,6 +426,8 @@ declare class SmtVerifier {
|
|
|
426
426
|
prioritySemantics(semantics: PrioritySemantics): this;
|
|
427
427
|
/**
|
|
428
428
|
* Runs the verification pipeline.
|
|
429
|
+
*
|
|
430
|
+
* @throws Error if the net violates CORE-043 — verification rejects the same nets execution rejects.
|
|
429
431
|
*/
|
|
430
432
|
verify(): Promise<SmtVerificationResult>;
|
|
431
433
|
/**
|
|
@@ -646,7 +648,11 @@ declare class StateClassGraph {
|
|
|
646
648
|
private readonly _predecessors;
|
|
647
649
|
private readonly _complete;
|
|
648
650
|
private constructor();
|
|
649
|
-
/**
|
|
651
|
+
/**
|
|
652
|
+
* Builds the state class graph for a Time Petri Net.
|
|
653
|
+
*
|
|
654
|
+
* @throws Error if the net violates CORE-043 — analysis rejects the same nets execution rejects.
|
|
655
|
+
*/
|
|
650
656
|
static build(net: PetriNet, initialMarking: MarkingState, maxClasses: number, environmentPlaces?: Set<EnvironmentPlace<any>>, environmentMode?: EnvironmentAnalysisMode): StateClassGraph;
|
|
651
657
|
stateClasses(): readonly StateClass[];
|
|
652
658
|
size(): number;
|