libpetri 2.12.0 → 2.12.1

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.
@@ -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
- private readonly _rawOutput;
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
@@ -1,5 +1,5 @@
1
- import { b as Transition, a as Place, P as PetriNet, E as EnvironmentPlace, aP as MarkingState, aQ as PInvariant, aR as MarkingStateBuilder, aS as SmtProperty, aT as SmtVerificationResult } from '../petri-net-B4wQwsUj.js';
2
- export { aU as BranchPlaceBound, aV as DeadlockFree, aW as JoinedOrDeadLettered, aX as MutualExclusion, aY as PlaceBound, aZ as Proven, a_ as SmtStatistics, a$ as TokenSupplier, b0 as Unknown, b1 as Unreachable, b2 as Verdict, $ as VerificationHarness, a0 as VerificationResult, b3 as Violated, b4 as branchPlaceBound, b5 as deadlockFree, b6 as isProven, b7 as isViolated, b8 as joinedOrDeadLettered, b9 as mutualExclusion, ba as pInvariant, bb as pInvariantToString, bc as placeBound, bd as propertyDescription, be as unreachable } from '../petri-net-B4wQwsUj.js';
1
+ import { b as Transition, a as Place, P as PetriNet, E as EnvironmentPlace, aP as MarkingState, aQ as PInvariant, aR as MarkingStateBuilder, aS as SmtProperty, aT as SmtVerificationResult } from '../petri-net-Byc3gSgJ.js';
2
+ export { aU as BranchPlaceBound, aV as DeadlockFree, aW as JoinedOrDeadLettered, aX as MutualExclusion, aY as PlaceBound, aZ as Proven, a_ as SmtStatistics, a$ as TokenSupplier, b0 as Unknown, b1 as Unreachable, b2 as Verdict, $ as VerificationHarness, a0 as VerificationResult, b3 as Violated, b4 as branchPlaceBound, b5 as deadlockFree, b6 as isProven, b7 as isViolated, b8 as joinedOrDeadLettered, b9 as mutualExclusion, ba as pInvariant, bb as pInvariantToString, bc as placeBound, bd as propertyDescription, be as unreachable } from '../petri-net-Byc3gSgJ.js';
3
3
  import { Expr, init, Bool, FuncDecl } from 'z3-solver';
4
4
 
5
5
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "libpetri",
3
- "version": "2.12.0",
3
+ "version": "2.12.1",
4
4
  "description": "Coloured Time Petri Net engine — TypeScript port",
5
5
  "homepage": "https://libpetri.org",
6
6
  "repository": {