libpetri 1.5.1 → 1.8.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.
@@ -8,6 +8,15 @@ interface Token<T> {
8
8
  readonly value: T;
9
9
  /** Epoch milliseconds when the token was created. */
10
10
  readonly createdAt: number;
11
+ /**
12
+ * JSON-friendly projection of the token value, populated by
13
+ * {@link SessionArchiveReader} when hydrating a v3 archive so replay
14
+ * consumers see the same structured shape the writer emitted. Live tokens
15
+ * (produced by {@link tokenOf} / {@link tokenAt}) leave this `undefined`;
16
+ * the runtime ignores it. See [EVT-025](../../../spec/08-events-observability.md)
17
+ * AC5. (libpetri 1.8.0+)
18
+ */
19
+ readonly structured?: unknown;
11
20
  }
12
21
  /** Creates a token with the given value and current timestamp. */
13
22
  declare function tokenOf<T>(value: T): Token<T>;
@@ -364,10 +373,28 @@ declare class TransitionContext {
364
373
  /** Returns declared read places (context, not consumed). */
365
374
  readPlaces(): ReadonlySet<Place<any>>;
366
375
  private requireRead;
367
- /** Add output value. Throws if place not declared as output. */
368
- output<T>(place: Place<T>, value: T): this;
369
- /** Add output token with metadata. */
370
- outputToken<T>(place: Place<T>, token: Token<T>): this;
376
+ /**
377
+ * Add one or more output values to the same place in a single call.
378
+ *
379
+ * Validates the place once, then appends each value to the output
380
+ * collector. Calling with zero values is a no-op.
381
+ *
382
+ * @example
383
+ * ctx.output(outPlace, 'a', 'b', 'c');
384
+ * ctx.output(outPlace, ...someArray);
385
+ *
386
+ * @throws if place not declared as output.
387
+ */
388
+ output<T>(place: Place<T>, ...values: T[]): this;
389
+ /**
390
+ * Add one or more pre-built output tokens to the same place in a single call.
391
+ *
392
+ * Validates the place once, then appends each token. Calling with zero
393
+ * tokens is a no-op.
394
+ *
395
+ * @throws if place not declared as output.
396
+ */
397
+ outputToken<T>(place: Place<T>, ...tokens: Token<T>[]): this;
371
398
  /** Returns declared output places. */
372
399
  outputPlaces(): ReadonlySet<Place<any>>;
373
400
  private requireOutput;
@@ -1,4 +1,4 @@
1
- import { P as Place, b as Transition, a as PetriNet, E as EnvironmentPlace } from '../petri-net-C3Jy5HCt.js';
1
+ import { P as Place, b as Transition, a as PetriNet, E as EnvironmentPlace } from '../petri-net-D-GN9g_D.js';
2
2
  import { Expr, init, Bool, FuncDecl } from 'z3-solver';
3
3
 
4
4
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "libpetri",
3
- "version": "1.5.1",
3
+ "version": "1.8.0",
4
4
  "description": "Coloured Time Petri Net engine — TypeScript port",
5
5
  "homepage": "https://libpetri.org",
6
6
  "repository": {