libpetri 5.1.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.
@@ -762,7 +762,7 @@ function stripClusterEdgeAttrs(line) {
762
762
  }
763
763
 
764
764
  // src/viewer/version.ts
765
- var VERSION = true ? "5.1.0" : "0.0.0-dev";
765
+ var VERSION = true ? "6.0.0" : "0.0.0-dev";
766
766
 
767
767
  // src/viewer/index.ts
768
768
  async function mount(dotSource, container, opts = {}) {
@@ -1013,4 +1013,4 @@ export {
1013
1013
  VERSION,
1014
1014
  mount
1015
1015
  };
1016
- //# sourceMappingURL=chunk-BPGE7GZR.js.map
1016
+ //# sourceMappingURL=chunk-5LE2M5PW.js.map
@@ -47,4 +47,4 @@ export {
47
47
  eventInstancePrefix,
48
48
  isFailureEvent
49
49
  };
50
- //# sourceMappingURL=chunk-SXK2Z45Z.js.map
50
+ //# sourceMappingURL=chunk-H2KAMPGN.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/event/net-event.ts"],"sourcesContent":["import type { Token } from '../core/token.js';\n\n/**\n * Events emitted during Petri Net execution.\n * Discriminated union capturing all observable state changes.\n */\nexport type NetEvent =\n | ExecutionStarted\n | ExecutionCompleted\n | TransitionEnabled\n | TransitionClockRestarted\n | TransitionStarted\n | TransitionCompleted\n | TransitionFailed\n | TransitionTimedOut\n | ActionTimedOut\n | TokenAdded\n | TokenRemoved\n | LogMessage\n | MarkingSnapshot;\n\n// ======================== Execution Lifecycle ========================\n\nexport interface ExecutionStarted {\n readonly type: 'execution-started';\n readonly timestamp: number;\n readonly netName: string;\n readonly executionId: string;\n}\n\nexport interface ExecutionCompleted {\n readonly type: 'execution-completed';\n readonly timestamp: number;\n readonly netName: string;\n readonly executionId: string;\n readonly totalDurationMs: number;\n}\n\n// ======================== Transition Lifecycle ========================\n\nexport interface TransitionEnabled {\n readonly type: 'transition-enabled';\n readonly timestamp: number;\n readonly transitionName: string;\n}\n\n/**\n * A transition's clock restarted while it stayed marked enabled: another firing took tokens\n * it needed and its places were refilled before the executor re-evaluated it (TIME-012).\n * This executor re-evaluates between a firing and its deposit, so it reports such a restart\n * as `transition-enabled`.\n */\nexport interface TransitionClockRestarted {\n readonly type: 'transition-clock-restarted';\n readonly timestamp: number;\n readonly transitionName: string;\n}\n\nexport interface TransitionStarted {\n readonly type: 'transition-started';\n readonly timestamp: number;\n readonly transitionName: string;\n readonly consumedTokens: readonly Token<unknown>[];\n}\n\nexport interface TransitionCompleted {\n readonly type: 'transition-completed';\n readonly timestamp: number;\n readonly transitionName: string;\n readonly producedTokens: readonly Token<unknown>[];\n readonly durationMs: number;\n}\n\nexport interface TransitionFailed {\n readonly type: 'transition-failed';\n readonly timestamp: number;\n readonly transitionName: string;\n readonly errorMessage: string;\n readonly exceptionType: string;\n /** Original stack trace, if available. */\n readonly stack?: string;\n}\n\n/**\n * Emitted when a transition exceeds its deadline (upper time bound) without firing.\n * Classical TPN semantics: transition is forcibly disabled by the executor in\n * `updateDirtyTransitions()` when elapsed time exceeds `latest(timing)`.\n */\nexport interface TransitionTimedOut {\n readonly type: 'transition-timed-out';\n readonly timestamp: number;\n readonly transitionName: string;\n /** The deadline that was exceeded, in milliseconds from enablement. */\n readonly deadlineMs: number;\n /** Actual time elapsed since enablement, in milliseconds. */\n readonly actualDurationMs: number;\n}\n\nexport interface ActionTimedOut {\n readonly type: 'action-timed-out';\n readonly timestamp: number;\n readonly transitionName: string;\n readonly timeoutMs: number;\n}\n\n// ======================== Token Movement ========================\n\nexport interface TokenAdded {\n readonly type: 'token-added';\n readonly timestamp: number;\n readonly placeName: string;\n readonly token: Token<unknown>;\n}\n\nexport interface TokenRemoved {\n readonly type: 'token-removed';\n readonly timestamp: number;\n readonly placeName: string;\n readonly token: Token<unknown>;\n}\n\n// ======================== Log Capture ========================\n\nexport interface LogMessage {\n readonly type: 'log-message';\n readonly timestamp: number;\n readonly transitionName: string;\n readonly logger: string;\n readonly level: string;\n readonly message: string;\n readonly error: string | null;\n readonly errorMessage: string | null;\n}\n\n// ======================== Checkpointing ========================\n\n/**\n * Snapshot of the full marking (token state) at a point in time.\n * Emitted at two points during execution:\n * 1. After initialization (before the main loop) — captures the initial marking\n * 2. Before the execution-completed event — captures the final marking\n */\nexport interface MarkingSnapshot {\n readonly type: 'marking-snapshot';\n readonly timestamp: number;\n /** Place name -> tokens in that place at snapshot time. Only non-empty places are included. */\n readonly marking: ReadonlyMap<string, readonly Token<unknown>[]>;\n}\n\n// ======================== Helper Functions ========================\n\n/** Extracts transition name from events that have one. Returns null otherwise. */\nexport function eventTransitionName(event: NetEvent): string | null {\n switch (event.type) {\n case 'transition-enabled':\n case 'transition-clock-restarted':\n case 'transition-started':\n case 'transition-completed':\n case 'transition-failed':\n case 'transition-timed-out':\n case 'action-timed-out':\n case 'log-message':\n return event.transitionName;\n default:\n return null;\n }\n}\n\n/**\n * Returns the instance prefix derived from a place or transition name per\n * `spec/11-modular-composition.md` **MOD-041**: the substring before the\n * **last** `/`, or `undefined` when the name is not part of any composed\n * subnet instance (no `/`).\n *\n * This helper is duplicated inside the event package (rather than delegated\n * to {@link import('../export/subnet-prefixes.js')}) to keep the event\n * subsystem dependency-free of the export layer per the package-isolation\n * contract.\n *\n * @param name place or transition name (may be `null` / `undefined`)\n * @returns derived instance prefix, or `undefined`\n */\nexport function instancePrefixOfName(name: string | null | undefined): string | undefined {\n if (name == null) return undefined;\n const idx = name.lastIndexOf('/');\n if (idx <= 0) return undefined;\n return name.substring(0, idx);\n}\n\n/**\n * Derived instance prefix per **MOD-041** for any {@link NetEvent} that\n * names a transition or a place. Returns `undefined` for execution lifecycle\n * events and marking snapshots (which do not carry a single\n * transition/place name) and for events whose name has no `/`.\n *\n * Mirrors the per-record `instancePrefix()` getter on the Java\n * {@code NetEvent} sealed hierarchy.\n */\nexport function eventInstancePrefix(event: NetEvent): string | undefined {\n switch (event.type) {\n case 'transition-enabled':\n case 'transition-clock-restarted':\n case 'transition-started':\n case 'transition-completed':\n case 'transition-failed':\n case 'transition-timed-out':\n case 'action-timed-out':\n case 'log-message':\n return instancePrefixOfName(event.transitionName);\n case 'token-added':\n case 'token-removed':\n return instancePrefixOfName(event.placeName);\n default:\n return undefined;\n }\n}\n\n/** Checks if the event is a failure type. */\nexport function isFailureEvent(event: NetEvent): boolean {\n return event.type === 'transition-failed'\n || event.type === 'transition-timed-out'\n || event.type === 'action-timed-out';\n}\n"],"mappings":";AAwJO,SAAS,oBAAoB,OAAgC;AAClE,UAAQ,MAAM,MAAM;AAAA,IAClB,KAAK;AAAA,IACL,KAAK;AAAA,IACL,KAAK;AAAA,IACL,KAAK;AAAA,IACL,KAAK;AAAA,IACL,KAAK;AAAA,IACL,KAAK;AAAA,IACL,KAAK;AACH,aAAO,MAAM;AAAA,IACf;AACE,aAAO;AAAA,EACX;AACF;AAgBO,SAAS,qBAAqB,MAAqD;AACxF,MAAI,QAAQ,KAAM,QAAO;AACzB,QAAM,MAAM,KAAK,YAAY,GAAG;AAChC,MAAI,OAAO,EAAG,QAAO;AACrB,SAAO,KAAK,UAAU,GAAG,GAAG;AAC9B;AAWO,SAAS,oBAAoB,OAAqC;AACvE,UAAQ,MAAM,MAAM;AAAA,IAClB,KAAK;AAAA,IACL,KAAK;AAAA,IACL,KAAK;AAAA,IACL,KAAK;AAAA,IACL,KAAK;AAAA,IACL,KAAK;AAAA,IACL,KAAK;AAAA,IACL,KAAK;AACH,aAAO,qBAAqB,MAAM,cAAc;AAAA,IAClD,KAAK;AAAA,IACL,KAAK;AACH,aAAO,qBAAqB,MAAM,SAAS;AAAA,IAC7C;AACE,aAAO;AAAA,EACX;AACF;AAGO,SAAS,eAAe,OAA0B;AACvD,SAAO,MAAM,SAAS,uBACjB,MAAM,SAAS,0BACf,MAAM,SAAS;AACtB;","names":[]}