Skip to main content
windowed({...}) from @bijectionhq/library-series publishes one output sample per subject and window start. It returns a subtree that owns its output, and publishes each window and its input evidence in one transaction.

Declare inputs, grid and plan

Every input shares the business key by. Use a series for samples and a timeline for values in force over a period. An input may not be family labelled.
bijection/energy.ts
The subtree is energy.output (the result series), energy.state, energy.track, energy.status, energy.input and the clock reaction energy.tick. roles.track may register ranges, roles.read may read status and worker inputs, and roles.maintain is what the clock reaction holds. The builder serializes the plan and puts its digest in the definition. Use reduce for count, sum, mean, min or max, integral and coverage for bounded gaps, and atStart for a timeline value. number and combine supply constants and binary arithmetic.

Track windows and read results

From a client, call track with grid-aligned instants:
The end is exclusive. The grid begins at origin, which defaults to the Unix epoch, and a call tracks up to 64 subject-window pairs. The clock reaction revisits due windows to pick up changed inputs. Read results from energy.output by the business key and the window start. Each records through (the version its inputs were read at, ctx.frame.version), definition, series and final. With finality: "available", a window publishes once its full context closes and may be revised as inputs arrive. With finality: "settled", it also waits for lateness. Supply frontier: { revision, read } when the source must attest its progress through the context, lookahead included.

Place large windows on external compute

Local evaluation admits up to 256 input facts and 128 KiB. Add job: { revision, target, within } for larger windows or an external implementation. revision is the worker artifact’s SHA-256. target receives the windowContract(by, output) value types and the revision, and answers the target the window submits to. While an attempt is pending, the window pins its input version, so the worker reads exactly that input version. The worker receives the window and context bounds and the serialized plan and its digest, and pages each input through energy.input for that attempt. A TypeScript worker can evaluate the same plan with evaluateWindow from @bijectionhq/library-series/algebra. The library accepts the result only for the current attempt and publishes it with its evidence.