footprintjs 11.0.0 → 11.0.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.
Files changed (61) hide show
  1. package/AGENTS.md +2 -0
  2. package/README.md +4 -4
  3. package/dist/advanced.js +1 -1
  4. package/dist/esm/advanced.d.ts +1 -1
  5. package/dist/esm/advanced.js +1 -1
  6. package/dist/esm/lib/decide/decide.d.ts +6 -0
  7. package/dist/esm/lib/decide/decide.js +27 -14
  8. package/dist/esm/lib/decide/types.d.ts +16 -7
  9. package/dist/esm/lib/decide/types.js +1 -1
  10. package/dist/esm/lib/engine/handlers/SelectorHandler.js +2 -2
  11. package/dist/esm/lib/engine/handlers/breakFlag.d.ts +9 -2
  12. package/dist/esm/lib/engine/handlers/breakFlag.js +15 -5
  13. package/dist/esm/lib/engine/narrative/CombinedNarrativeRecorder.js +7 -3
  14. package/dist/esm/lib/engine/narrative/types.d.ts +3 -1
  15. package/dist/esm/lib/engine/narrative/types.js +1 -1
  16. package/dist/esm/lib/engine/traversal/FlowchartTraverser.js +2 -2
  17. package/dist/esm/lib/filter/evaluator.d.ts +6 -2
  18. package/dist/esm/lib/filter/evaluator.js +16 -16
  19. package/dist/esm/lib/memory/StageContext.d.ts +20 -0
  20. package/dist/esm/lib/memory/StageContext.js +52 -8
  21. package/dist/esm/lib/memory/index.d.ts +1 -1
  22. package/dist/esm/lib/memory/index.js +1 -1
  23. package/dist/esm/lib/memory/redaction.d.ts +88 -12
  24. package/dist/esm/lib/memory/redaction.js +175 -20
  25. package/dist/esm/lib/reactive/createTypedScope.js +6 -2
  26. package/dist/esm/lib/reactive/types.d.ts +4 -1
  27. package/dist/esm/lib/reactive/types.js +1 -1
  28. package/dist/esm/lib/runner/snapshot.js +2 -2
  29. package/dist/esm/lib/scope/ScopeFacade.d.ts +19 -3
  30. package/dist/esm/lib/scope/ScopeFacade.js +36 -15
  31. package/dist/esm/lib/scope/runtime.d.ts +8 -0
  32. package/dist/esm/lib/scope/runtime.js +1 -1
  33. package/dist/lib/decide/decide.js +27 -14
  34. package/dist/lib/decide/types.js +1 -1
  35. package/dist/lib/engine/handlers/SelectorHandler.js +2 -2
  36. package/dist/lib/engine/handlers/breakFlag.js +15 -5
  37. package/dist/lib/engine/narrative/CombinedNarrativeRecorder.js +7 -3
  38. package/dist/lib/engine/narrative/types.js +1 -1
  39. package/dist/lib/engine/traversal/FlowchartTraverser.js +2 -2
  40. package/dist/lib/filter/evaluator.js +15 -15
  41. package/dist/lib/memory/StageContext.js +52 -8
  42. package/dist/lib/memory/index.js +1 -1
  43. package/dist/lib/memory/redaction.js +176 -21
  44. package/dist/lib/reactive/createTypedScope.js +6 -2
  45. package/dist/lib/reactive/types.js +1 -1
  46. package/dist/lib/runner/snapshot.js +2 -2
  47. package/dist/lib/scope/ScopeFacade.js +36 -15
  48. package/dist/lib/scope/runtime.js +1 -1
  49. package/dist/types/advanced.d.ts +1 -1
  50. package/dist/types/lib/decide/decide.d.ts +6 -0
  51. package/dist/types/lib/decide/types.d.ts +16 -7
  52. package/dist/types/lib/engine/handlers/breakFlag.d.ts +9 -2
  53. package/dist/types/lib/engine/narrative/types.d.ts +3 -1
  54. package/dist/types/lib/filter/evaluator.d.ts +6 -2
  55. package/dist/types/lib/memory/StageContext.d.ts +20 -0
  56. package/dist/types/lib/memory/index.d.ts +1 -1
  57. package/dist/types/lib/memory/redaction.d.ts +88 -12
  58. package/dist/types/lib/reactive/types.d.ts +4 -1
  59. package/dist/types/lib/scope/ScopeFacade.d.ts +19 -3
  60. package/dist/types/lib/scope/runtime.d.ts +8 -0
  61. package/package.json +2 -2
@@ -3,7 +3,7 @@ export type { RetentionPolicy } from '../capture/policies.js';
3
3
  export type { ReadSummaryMarker, WriteSummaryMarker } from '../capture/summarize.js';
4
4
  export { DiagnosticCollector } from './DiagnosticCollector.js';
5
5
  export type { FlowControlType, FlowMessage, ReadTrackingMode, StageSnapshot, WriteTrackingMode } from './frameTypes.js';
6
- export type { RedactionVerdict } from './redaction.js';
6
+ export type { EvidenceRule, RedactionVerdict, ServedThreshold, StageSources } from './redaction.js';
7
7
  export { RedactionRule } from './redaction.js';
8
8
  export { SCOPE_PLACEHOLDER } from './redaction.js';
9
9
  export type { RunDials, RunPolicy } from './runPolicy.js';
@@ -4,4 +4,4 @@ export { RedactionRule } from './redaction.js';
4
4
  export { SCOPE_PLACEHOLDER } from './redaction.js';
5
5
  export { DEFAULT_RUN_POLICY, runPolicy } from './runPolicy.js';
6
6
  export { StageContext } from './StageContext.js';
7
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi9zcmMvbGliL21lbW9yeS9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxrR0FBa0c7QUFJbEcsT0FBTyxFQUFFLG1CQUFtQixFQUFFLE1BQU0sMEJBQTBCLENBQUM7QUFHL0QsT0FBTyxFQUFFLGFBQWEsRUFBRSxNQUFNLGdCQUFnQixDQUFDO0FBQy9DLE9BQU8sRUFBRSxpQkFBaUIsRUFBRSxNQUFNLGdCQUFnQixDQUFDO0FBRW5ELE9BQU8sRUFBRSxrQkFBa0IsRUFBRSxTQUFTLEVBQUUsTUFBTSxnQkFBZ0IsQ0FBQztBQUMvRCxPQUFPLEVBQUUsWUFBWSxFQUFFLE1BQU0sbUJBQW1CLENBQUMiLCJzb3VyY2VzQ29udGVudCI6WyIvKiogRW5naW5lIGZyYW1lLCBkaWFnbm9zdGljcywgcnVuIHBvbGljeSBhbmQgcmVkYWN0aW9uLiBSZWNvcmQgcHJpbWl0aXZlcyBiZWxvbmcgdG8gZm9vdHRyYWNlLiAqL1xuXG5leHBvcnQgdHlwZSB7IFJldGVudGlvblBvbGljeSB9IGZyb20gJy4uL2NhcHR1cmUvcG9saWNpZXMuanMnO1xuZXhwb3J0IHR5cGUgeyBSZWFkU3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TQ09QRV9QTEFDRUhPTERFUiB9IGZyb20gJy4vcmVkYWN0aW9uLmpzJztcbmV4cG9ydCB0eXBlIHsgUnVuRGlhbHMsIFJ1blBvbGljeSB9IGZyb20gJy4vcnVuUG9saWN5LmpzJztcbmV4cG9ydCB7IERFRkFVTFRfUlVOX1BPTElDWSwgcnVuUG9saWN5IH0gZnJvbSAnLi9ydW5Qb2xpY3kuanMnO1xuZXhwb3J0IHsgU3RhZ2VDb250ZXh0IH0gZnJvbSAnLi9TdGFnZUNvbnRleHQuanMnO1xuIl19
@@ -22,7 +22,11 @@
22
22
  * own, so only they select it;
23
23
  * - a subflow mapper's copy — a key an `inputMapper`/`outputMapper` (or a
24
24
  * `parallelForEach` items selector) wrote inherits the redaction of the
25
- * selected value it copied ({@link MapperTaint}).
25
+ * selected value it copied ({@link MapperTaint});
26
+ * - what a stage's own code made and a record quotes — a decision's threshold
27
+ * ({@link RedactionRule.serveThreshold}), a rule's thrown text, a break
28
+ * reason, an idempotency key ({@link RedactionRule.retainStageText}) — by the
29
+ * name it sits under AND by the stage's sources: what it read, what its args hold.
26
30
  * A mark is a NAME, run-wide, until the key is deleted; a pause carries the
27
31
  * marks — names only — to the resumed run ({@link RedactionRule.marksForCheckpoint}).
28
32
  * A value with no name — a scalar root input/output or pause payload, free
@@ -152,6 +156,37 @@ export type RedactionVerdict = {
152
156
  readonly paths: readonly string[];
153
157
  };
154
158
  export declare const CLEAR: RedactionVerdict;
159
+ /**
160
+ * Where a stage's own code may have copied a value from, as data. The rule cannot see what a string or a threshold
161
+ * was built from, so it asks these instead: the taint law ({@link RedactionRule.retainStageText},
162
+ * {@link RedactionRule.serveThreshold}).
163
+ */
164
+ export interface StageSources {
165
+ /** The stage's args (`$getArgs()`). Reading them never counts in `selectedReads`. */
166
+ readonly input?: unknown;
167
+ /** Reads of a selected value on this frame so far (`StageContext · taintedReads`). */
168
+ readonly selectedReads?: number;
169
+ }
170
+ /** What a condition row keeps of its threshold: the value to store, and whether that value is a hole. */
171
+ export interface ServedThreshold {
172
+ readonly threshold: unknown;
173
+ /** Absent for a value: the string `[REDACTED]` can be a real threshold. */
174
+ readonly thresholdRedacted?: true;
175
+ }
176
+ /** A threshold nothing can answer for: the placeholder, and the marker that says it is one. */
177
+ export declare const THRESHOLD_HOLE: ServedThreshold;
178
+ /**
179
+ * What one `decide()` / `select()` asks the run's rule, answered live as data ({@link RedactionRule.evidenceRule}), so
180
+ * `decide/` and `filter/` hold neither a rule nor a frame.
181
+ */
182
+ export interface EvidenceRule {
183
+ /** Is the ACTUAL value under `key` masked? What `conditions[].redacted` says. */
184
+ readonly masksActual: (key: string) => boolean;
185
+ /** {@link RedactionRule.serveThreshold}. Ask AFTER the filter's own read of `key`: that read can be the selected one. */
186
+ readonly serveThreshold: (key: string, threshold: unknown) => ServedThreshold;
187
+ /** The text a rule threw, as evidence serves it. Ask after the rule ran: its own reads count. */
188
+ readonly servedMatchError: (text: string) => string;
189
+ }
155
190
  /**
156
191
  * The user-level NAME of `key` under `path` — the key itself at the top level, else the segments
157
192
  * joined by a dot (`['profile'] + 'auth'` → `'profile.auth'`): what a verdict decides on, a mark
@@ -226,16 +261,56 @@ export declare class RedactionRule {
226
261
  retainDiagnostic(address: readonly string[], value: unknown): unknown;
227
262
  /**
228
263
  * An idempotency key as records serve it (P3, design §6). The key is a VALUE, and the documented way to make one
229
- * is from the input or the state (`order-${args.orderId}`) — so it is selected by its NAME (the diagnostic entry
230
- * `{ idempotencyKey }`: a state rule of that name, or `policy.diagnostics` at `logs.idempotencyKey`) AND by its
231
- * SOURCES, conservatively, the subflow-mapper taint law's way: when the input it may be derived from holds a
232
- * selected key at any depth, or the stage read a selected value before making it (`selectedReads`), it is served
264
+ * is from the input or the state (`order-${args.orderId}`) — so it is text the stage made: {@link retainStageText}.
265
+ */
266
+ retainIdempotencyKey(key: string, sources: StageSources): string;
267
+ /**
268
+ * Text a stage's own code made, as records serve it — an idempotency key, the text a decision rule threw, a break
269
+ * reason. Selected by its NAME (the diagnostic entry at `address`: a state rule of that name, or `policy.diagnostics`)
270
+ * AND by its SOURCES, conservatively, the subflow-mapper taint law's way ({@link sourcesSelected}): it is then served
233
271
  * whole as the placeholder. Never value equality. An inert rule never reads it.
272
+ *
273
+ * It is a string once it is made, so nothing can change it afterwards. An object where the type says text (a JS caller,
274
+ * an `Error` whose `message` is one) is a hole: turning it into text runs its `toString` AFTER the sources were asked,
275
+ * and that code can read a selected value.
276
+ */
277
+ retainStageText(address: readonly string[], text: string, sources: StageSources): string;
278
+ /**
279
+ * A filter's threshold as a condition row keeps it. THE ONE LAW for a threshold: every condition row asks it, once. A
280
+ * threshold is author code's value and may have been copied from anything, so it is served only when nothing says it
281
+ * holds a selected value:
282
+ *
283
+ * - NAME: its key's verdict is clear (`verdictAt`: keys, patterns, marks AND `fields`, never the marked set alone);
284
+ * - SOURCES: the stage has read no selected value so far and its args hold no selected key ({@link sourcesSelected});
285
+ * - ONE READ: {@link readThreshold} made a detached copy of it with no author code. The copy is what the next clause
286
+ * looks at and what the row keeps, so what the check saw is what every reader gets, and nothing can change it after;
287
+ * - SHAPE: the copy holds no selected name at any depth, an object or an `in` element being a record handed out whole
288
+ * under its key's name ({@link carriesSelectedKey}), and it was not read from a value this run served masked.
289
+ *
290
+ * Otherwise the row serves a hole, never a partial scrub. Conservative: the count is per frame, so once a stage read a
291
+ * selected value every later threshold in it is hidden. A threshold in a stage with no selected read, under a key
292
+ * nothing selects, stays visible: it is what makes the decision explainable.
293
+ *
294
+ * An inert rule reads nothing and keeps the value itself, the reference, for its whole life. `behind` turns a threshold
295
+ * that IS a scope handle (`{ in: s.allowed }`) into the state behind it: the library's own Proxy is no reason to hide
296
+ * state nothing selects. A handle inside an object the stage built stays a Proxy like any other, so a hole.
297
+ */
298
+ serveThreshold(key: string, threshold: unknown, sources: StageSources, behind?: (value: unknown) => unknown): ServedThreshold;
299
+ /** The answers one `decide()` / `select()` asks, live, over the stage's sources at each question. */
300
+ evidenceRule(sources: () => StageSources, behind?: (value: unknown) => unknown): EvidenceRule;
301
+ /**
302
+ * THE TAINT LAW. Could the stage's code hold a selected value? It read one (`selectedReads`), or its input holds a
303
+ * selected key at any depth (`$getArgs()` reads never count). Per frame, by name, never by value: a value the stage
304
+ * did not read on this frame, such as a primitive copied under a new name by an earlier stage, is selected by its own
305
+ * name only.
306
+ */
307
+ private sourcesSelected;
308
+ /**
309
+ * Does a read with no key hand over something this rule selects? It hands over everything under `path`, a record
310
+ * handed out whole: the path's own verdict, or a selected name at any depth inside it ({@link carriesSelectedKey}).
311
+ * A policy that selects nothing present says no. `StageContext · noteKeylessRead` counts the answer for the taint law.
234
312
  */
235
- retainIdempotencyKey(key: string, sources: {
236
- readonly input?: unknown;
237
- readonly selectedReads?: number;
238
- }): string;
313
+ holdsSelected(path: readonly string[], value: unknown): boolean;
239
314
  /**
240
315
  * Retain flow-message text (`flowMessages.description` / `.rationale`): text
241
316
  * the engine composes has no name of its own, so no state selector reaches
@@ -261,9 +336,10 @@ export declare class RedactionRule {
261
336
  structuredError: StructuredErrorInfo;
262
337
  };
263
338
  /**
264
- * Does a thrown value carry a selected name — an own key, at any depth, that
265
- * the policy or a mark selects? Total: a value whose keys cannot be read is
266
- * served masked (the safe side), never a second throw from an error path.
339
+ * Does a value handed out whole carry a selected name — an own key, at any depth, that
340
+ * the policy or a mark selects? `base` is the name the value sits under, when it has one
341
+ * (a threshold under its key), so a dotted rule reaches it. Total: a value whose keys cannot
342
+ * be read is served masked (the safe side), never a second throw from an error path.
267
343
  */
268
344
  private carriesSelectedKey;
269
345
  /**