@sedum-dev/core 0.1.0-alpha.7 → 0.1.0-alpha.9

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.
package/README.md CHANGED
@@ -24,11 +24,11 @@ The loader reports `format` coverage and leaves `steps: not_checked`. `resolveFl
24
24
 
25
25
  Build `@sedum-dev/core` before launching the Playwright driver. The package ships `./page-script.js` as a browser-only IIFE; `PlaywrightBrowserDriver` installs it as a context init script before pages are created. A missing asset produces `script-missing`; a missing or incompatible bridge produces `PageScriptError`.
26
26
 
27
- The versioned `window.__sedum` protocol exposes `collect`, `digest`, `visibleText`, `pageVersion`, `quiet`, `findBySignals`, `clickTarget`, `readTarget`, `controlState`, `checkAim`, and `clearRefs`. Use the typed functions exported from `@sedum-dev/core` rather than calling the global directly. A collection has a document/route/revision version, total count, and a continuation offset. An incomplete collection is not evidence of absence or a unique cache match. `findBySignals` rescans all eligible candidates; it does not pass an HMAC key into the page. Every rescan invalidates earlier refs. `quiet` reports an observation interval, not final page completion. `visibleText` uses the same readable-text projection as `digest` without its provider size limit; deterministic exact-text checks consume it locally.
27
+ The versioned `window.__sedum` protocol exposes `collect`, `digest`, `visibleText`, `pageVersion`, `quiet`, `findBySignals`, `clickTarget`, `readTarget`, `controlState`, `checkAim`, `hoverElement`, and `clearRefs`. Use the typed functions exported from `@sedum-dev/core` rather than calling the global directly. A collection has a document/route/revision version, total count, and a continuation offset. An incomplete collection is not evidence of absence or a unique cache match. `findBySignals` rescans all eligible candidates; it does not pass an HMAC key into the page. Every rescan invalidates earlier refs. `quiet` reports an observation interval, not final page completion. `visibleText` uses the same readable-text projection as `digest` without its provider size limit; deterministic exact-text checks consume it locally.
28
28
 
29
29
  `projectCandidates` and `projectDigest` are the provider boundary: they only admit the approved fields and reject over-limit or incomplete content. The provider adapter must enforce the 512-code-point sentence/claim limits and the 64-KiB UTF-8 serialized request limit immediately before the SDK call. Allowed visible text, including secret-looking text, is sent unchanged; do not describe this projection as redaction. Never include internal candidate signals, page versions/routes, selectors, editable values, or raw HTML in a provider request.
30
30
 
31
- `stageEntry`, `pageKey`, and `matchLiveEntry` supply the transient cache-signal contract. The checkout key is supplied by the cache store; it must be a random 256-bit secret stored in worktree-resolved Git metadata, never in the page script or a provider payload. `stageEntry` requires the complete eligible candidate set, complete bounded item context with a target-specific word, and a unique match. It refuses caching when that evidence is unavailable, even if the page supplies a hook or ID. Call it only after a successful action. Store only `CacheEntry`'s keyed digests and bounded metadata. No entry is a hit until all current eligible candidates are checked. A hit still requires a fresh `clickTarget` aim and `BrowserPage.clickRef` action; a miss remains visible to the caller. `clickRef` asks Playwright to settle the exact snapshot target without dispatching pointer events, revalidates it after that wait, then delegates actionability, event dispatch, cancellation, and same-frame HTTP(S) navigation to Playwright and the browser. Sedum does not hold or replay a link's default action, and page code may change the result of a native click just as it can for a user. Download, new-tab, and non-HTTP(S) links remain non-actionable because they are outside the current single-page driver contract. A `clickRef` result with `reason: "action_started"` and `retryable: false` means the final click was handed to Playwright but failed, so a page handler may already have caused an effect and the executor must not repeat it automatically.
31
+ `stageEntry`, `pageKey`, and `matchLiveEntry` supply the transient cache-signal contract. The checkout key is supplied by the cache store; it must be a random 256-bit secret stored in worktree-resolved Git metadata, never in the page script or a provider payload. `stageEntry` requires the complete eligible candidate set, complete bounded item context with a target-specific word, and a unique match. It refuses caching when that evidence is unavailable, even if the page supplies a hook or ID. Call it only after a successful action. Store only `CacheEntry`'s keyed digests and bounded metadata. No entry is a hit until all current eligible candidates are checked. A hit still requires a fresh `clickTarget` aim and `BrowserPage.clickRef` action; a miss remains visible to the caller. `clickRef` asks Playwright to settle the exact snapshot target without dispatching pointer events, revalidates it after that wait, then delegates actionability, event dispatch, cancellation, and same-frame HTTP(S) navigation to Playwright and the browser. For a CSS-hover-revealed target, discovery only inspects stylesheet rules whose winning author declarations it can prove; `clickRef` retrieves and hovers the exact snapshot host, waits for the exact target, and revalidates it before clicking. Once hover pointer dispatch starts, any failure is non-retryable because a page handler may already have caused an effect. Sedum does not hold or replay a link's default action, and page code may change the result of a native click just as it can for a user. Download, new-tab, and non-HTTP(S) links remain non-actionable because they are outside the current single-page driver contract. A `clickRef` result with `reason: "action_started"` and `retryable: false` means pointer or click dispatch started but did not safely complete, so the executor must not repeat it automatically.
32
32
 
33
33
  `executeStep` is the narrow action boundary. It takes a classified operation and a snapshot-scoped target from the resolver; it never classifies or re-resolves itself. `type` replaces text with Playwright `fill` on the exact element from a `fill` candidate snapshot, while click reuses the `clickTarget` aim and `clickRef`. Press is page-level and scroll emits one vertical wheel event. A stale target or failed pre-dispatch action is retryable; once browser dispatch may have begun, failure is non-retryable. A click or press compares the immediate page version and settles only a change already observed. Keep substituted values in `RuntimeValue`/`RuntimeUrl` and route-bearing targets in `ResolvedStepTarget` rather than interpolating them into a command sentence or literal URL; only trusted URL segments and placeholder labels are displayable. Public executor results and errors contain no raw runtime value, full route, Playwright cause, or stack. `goto` uses the driver's safe-diagnostics option, and all uncertain Playwright call-log lines are replaced wholesale.
34
34
 
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { z } from 'zod';
2
2
  import { Page, BrowserContext } from 'playwright-core';
3
- import { F as FlowSource, D as DeclaredDataValue, M as ModuleBinding, a as FlowToken, b as FlowScalar, S as SentenceStep, c as FlowDiagnostic, d as FlowDefinition, P as ParsedFlowResult, e as ParsedModuleResult, V as ValidationInput, f as FlowValidationResult, g as ModuleStep, R as ResolvedModuleCall, h as FullValidationCoverage, T as TestBody, i as ScriptRegistration, A as AiValues } from './script-api-B8MYTfrL.js';
4
- export { j as Ai, k as AiValue, l as FlowStep, m as FormatCoverage, n as ModuleDefinition, o as Parser, p as SecretValue, q as TestContext, r as TestInfo, s as TestOptions, t as formatFlowDiagnostic, u as isFullyValidated, v as isSecret, w as parseFrame, x as pathKey, y as revealSecret, z as samePath, B as scriptRegistry, C as secret, E as sourceInFile, G as test } from './script-api-B8MYTfrL.js';
3
+ import { F as FlowSource, D as DeclaredDataValue, M as ModuleBinding, a as FlowToken, b as FlowScalar, S as SentenceStep, c as FlowDiagnostic, d as FlowDefinition, P as ParsedFlowResult, e as ParsedModuleResult, V as ValidationInput, f as FlowValidationResult, g as ModuleStep, R as ResolvedModuleCall, h as FullValidationCoverage, T as TestBody, i as ScriptRegistration, A as AiValues } from './script-api-DzYBsXzT.js';
4
+ export { j as Ai, k as AiValue, l as FlowStep, m as FormatCoverage, n as ModuleDefinition, o as Parser, p as SecretValue, q as TestContext, r as TestInfo, s as TestOptions, t as formatFlowDiagnostic, u as isFullyValidated, v as isSecret, w as parseFrame, x as pathKey, y as revealSecret, z as samePath, B as scriptRegistry, C as secret, E as sourceInFile, G as test } from './script-api-DzYBsXzT.js';
5
5
  import { inspect } from 'node:util';
6
6
  import 'playwright/test';
7
7
 
@@ -39,6 +39,7 @@ declare const ResultFrameSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
39
39
  reason: z.ZodString;
40
40
  }, z.core.$strict>], "status">;
41
41
  declare const ResultCallSchema: z.ZodObject<{
42
+ provider: z.ZodOptional<z.ZodString>;
42
43
  modality: z.ZodOptional<z.ZodLiteral<"vision">>;
43
44
  purpose: z.ZodEnum<{
44
45
  classification: "classification";
@@ -144,6 +145,14 @@ declare const ResultStepSchema: z.ZodObject<{
144
145
  sentence: z.ZodString;
145
146
  detail: z.ZodString;
146
147
  group: z.ZodOptional<z.ZodArray<z.ZodString>>;
148
+ goal: z.ZodOptional<z.ZodObject<{
149
+ completion: z.ZodLiteral<"planner">;
150
+ text: z.ZodString;
151
+ actions: z.ZodNumber;
152
+ requests: z.ZodNumber;
153
+ reason: z.ZodString;
154
+ dataSeed: z.ZodOptional<z.ZodNumber>;
155
+ }, z.core.$strict>>;
147
156
  sourceStack: z.ZodArray<z.ZodObject<{
148
157
  file: z.ZodString;
149
158
  line: z.ZodNumber;
@@ -243,6 +252,7 @@ declare const ResultStepSchema: z.ZodObject<{
243
252
  timeoutReason: z.ZodNullable<z.ZodString>;
244
253
  }, z.core.$strict>>;
245
254
  calls: z.ZodArray<z.ZodObject<{
255
+ provider: z.ZodOptional<z.ZodString>;
246
256
  modality: z.ZodOptional<z.ZodLiteral<"vision">>;
247
257
  purpose: z.ZodEnum<{
248
258
  classification: "classification";
@@ -372,6 +382,14 @@ declare const ResultAttemptSchema: z.ZodObject<{
372
382
  sentence: z.ZodString;
373
383
  detail: z.ZodString;
374
384
  group: z.ZodOptional<z.ZodArray<z.ZodString>>;
385
+ goal: z.ZodOptional<z.ZodObject<{
386
+ completion: z.ZodLiteral<"planner">;
387
+ text: z.ZodString;
388
+ actions: z.ZodNumber;
389
+ requests: z.ZodNumber;
390
+ reason: z.ZodString;
391
+ dataSeed: z.ZodOptional<z.ZodNumber>;
392
+ }, z.core.$strict>>;
375
393
  sourceStack: z.ZodArray<z.ZodObject<{
376
394
  file: z.ZodString;
377
395
  line: z.ZodNumber;
@@ -471,6 +489,7 @@ declare const ResultAttemptSchema: z.ZodObject<{
471
489
  timeoutReason: z.ZodNullable<z.ZodString>;
472
490
  }, z.core.$strict>>;
473
491
  calls: z.ZodArray<z.ZodObject<{
492
+ provider: z.ZodOptional<z.ZodString>;
474
493
  modality: z.ZodOptional<z.ZodLiteral<"vision">>;
475
494
  purpose: z.ZodEnum<{
476
495
  classification: "classification";
@@ -528,6 +547,7 @@ declare const ResultAttemptSchema: z.ZodObject<{
528
547
  }, z.core.$strict>>;
529
548
  }, z.core.$strict>>;
530
549
  calls: z.ZodOptional<z.ZodArray<z.ZodObject<{
550
+ provider: z.ZodOptional<z.ZodString>;
531
551
  modality: z.ZodOptional<z.ZodLiteral<"vision">>;
532
552
  purpose: z.ZodEnum<{
533
553
  classification: "classification";
@@ -650,6 +670,14 @@ declare const ResultTestSchema: z.ZodObject<{
650
670
  sentence: z.ZodString;
651
671
  detail: z.ZodString;
652
672
  group: z.ZodOptional<z.ZodArray<z.ZodString>>;
673
+ goal: z.ZodOptional<z.ZodObject<{
674
+ completion: z.ZodLiteral<"planner">;
675
+ text: z.ZodString;
676
+ actions: z.ZodNumber;
677
+ requests: z.ZodNumber;
678
+ reason: z.ZodString;
679
+ dataSeed: z.ZodOptional<z.ZodNumber>;
680
+ }, z.core.$strict>>;
653
681
  sourceStack: z.ZodArray<z.ZodObject<{
654
682
  file: z.ZodString;
655
683
  line: z.ZodNumber;
@@ -749,6 +777,7 @@ declare const ResultTestSchema: z.ZodObject<{
749
777
  timeoutReason: z.ZodNullable<z.ZodString>;
750
778
  }, z.core.$strict>>;
751
779
  calls: z.ZodArray<z.ZodObject<{
780
+ provider: z.ZodOptional<z.ZodString>;
752
781
  modality: z.ZodOptional<z.ZodLiteral<"vision">>;
753
782
  purpose: z.ZodEnum<{
754
783
  classification: "classification";
@@ -806,6 +835,7 @@ declare const ResultTestSchema: z.ZodObject<{
806
835
  }, z.core.$strict>>;
807
836
  }, z.core.$strict>>;
808
837
  calls: z.ZodOptional<z.ZodArray<z.ZodObject<{
838
+ provider: z.ZodOptional<z.ZodString>;
809
839
  modality: z.ZodOptional<z.ZodLiteral<"vision">>;
810
840
  purpose: z.ZodEnum<{
811
841
  classification: "classification";
@@ -953,6 +983,7 @@ declare const RunResultSchema: z.ZodObject<{
953
983
  costComplete: z.ZodBoolean;
954
984
  }, z.core.$strict>;
955
985
  setupCalls: z.ZodArray<z.ZodObject<{
986
+ provider: z.ZodOptional<z.ZodString>;
956
987
  modality: z.ZodOptional<z.ZodLiteral<"vision">>;
957
988
  purpose: z.ZodEnum<{
958
989
  classification: "classification";
@@ -1045,6 +1076,14 @@ declare const RunResultSchema: z.ZodObject<{
1045
1076
  sentence: z.ZodString;
1046
1077
  detail: z.ZodString;
1047
1078
  group: z.ZodOptional<z.ZodArray<z.ZodString>>;
1079
+ goal: z.ZodOptional<z.ZodObject<{
1080
+ completion: z.ZodLiteral<"planner">;
1081
+ text: z.ZodString;
1082
+ actions: z.ZodNumber;
1083
+ requests: z.ZodNumber;
1084
+ reason: z.ZodString;
1085
+ dataSeed: z.ZodOptional<z.ZodNumber>;
1086
+ }, z.core.$strict>>;
1048
1087
  sourceStack: z.ZodArray<z.ZodObject<{
1049
1088
  file: z.ZodString;
1050
1089
  line: z.ZodNumber;
@@ -1144,6 +1183,7 @@ declare const RunResultSchema: z.ZodObject<{
1144
1183
  timeoutReason: z.ZodNullable<z.ZodString>;
1145
1184
  }, z.core.$strict>>;
1146
1185
  calls: z.ZodArray<z.ZodObject<{
1186
+ provider: z.ZodOptional<z.ZodString>;
1147
1187
  modality: z.ZodOptional<z.ZodLiteral<"vision">>;
1148
1188
  purpose: z.ZodEnum<{
1149
1189
  classification: "classification";
@@ -1201,6 +1241,7 @@ declare const RunResultSchema: z.ZodObject<{
1201
1241
  }, z.core.$strict>>;
1202
1242
  }, z.core.$strict>>;
1203
1243
  calls: z.ZodOptional<z.ZodArray<z.ZodObject<{
1244
+ provider: z.ZodOptional<z.ZodString>;
1204
1245
  modality: z.ZodOptional<z.ZodLiteral<"vision">>;
1205
1246
  purpose: z.ZodEnum<{
1206
1247
  classification: "classification";
@@ -1534,6 +1575,8 @@ interface PageBridge {
1534
1575
  }): CandidatePage;
1535
1576
  clickTarget(ref: string): AimResult;
1536
1577
  checkAim(aim: Aim): AimResult;
1578
+ /** The exact visible ancestor whose hover reveals an aimed control. */
1579
+ hoverElement(aim: Aim): Element | null;
1537
1580
  fillElement(target: FillTarget): Element | null;
1538
1581
  readTarget(target: FillTarget): ReadTargetResult;
1539
1582
  controlState(target: FillTarget): ControlStateResult;
@@ -1923,6 +1966,8 @@ interface ProviderRate {
1923
1966
  readonly checkedAt: string;
1924
1967
  }
1925
1968
  interface ProviderCall {
1969
+ /** Concrete provider identity; absent on legacy or genuinely unknown calls. */
1970
+ readonly provider?: string;
1926
1971
  /** Set by the locator for visual fallback calls, independent of model name. */
1927
1972
  readonly modality?: "vision";
1928
1973
  readonly requestedModel: string;
@@ -1940,6 +1985,21 @@ interface ProviderCall {
1940
1985
  /** Milliseconds spent waiting for a provider concurrency slot. */
1941
1986
  readonly queueWaitMs?: number;
1942
1987
  }
1988
+ /** One complete test projected for provider-neutral affected-test scoring. */
1989
+ interface RelevanceTest {
1990
+ readonly file: string;
1991
+ readonly source: string;
1992
+ readonly modules: readonly {
1993
+ readonly file: string;
1994
+ readonly source: string;
1995
+ }[];
1996
+ }
1997
+ interface RelevanceProvider {
1998
+ scoreRelevance(diff: string, tests: readonly RelevanceTest[], options?: ProviderCallOptions): Promise<{
1999
+ readonly probabilities: readonly number[];
2000
+ readonly calls: readonly ProviderCall[];
2001
+ }>;
2002
+ }
1943
2003
  interface ResolverDecision {
1944
2004
  readonly selection: {
1945
2005
  readonly kind: "candidate";
@@ -1999,6 +2059,79 @@ declare class ProviderError extends Error {
1999
2059
  /** A failed request may have been billed even when usage was not returned. */
2000
2060
  declare function unknownCostCall(error: unknown): ProviderCall;
2001
2061
 
2062
+ /** One cooldown window never exceeds this, matching the SDK's `maxRetryAfterMs`. */
2063
+ declare const MAX_COOLDOWN_MS = 60000;
2064
+ /** Cumulative wait a call may spend after its first 429 before it gives up. */
2065
+ declare const RATE_LIMIT_BUDGET_MS = 300000;
2066
+ /** Fraction of each backoff delay randomly subtracted, as in the SDK policy. */
2067
+ declare const BACKOFF_JITTER = 0.25;
2068
+ declare const DEFAULT_PROVIDER_CONCURRENCY = 4;
2069
+ declare const MAX_PROVIDER_CONCURRENCY = 32;
2070
+ /**
2071
+ * Server-requested delay in milliseconds, following the TypeSafe SDK's
2072
+ * `RetryPolicy`: `retry-after-ms`, then `Retry-After` as seconds or an HTTP
2073
+ * date. Returns null when absent or malformed so the caller falls back to
2074
+ * backoff.
2075
+ */
2076
+ declare function parseRetryAfter(headers: Headers | undefined, now: number): number | null;
2077
+ /** Exponential backoff with subtractive jitter, capped at one window. */
2078
+ declare function backoffDelay(failures: number, initialMs: number, random: number): number;
2079
+ /** The delay for one 429: the server's request when given, else backoff. */
2080
+ declare function cooldownDelay(retryAfterMs: number | null, rateLimitCount: number, initialMs: number, random: number): number;
2081
+ /**
2082
+ * Additive-increase ramp after a cooldown: one request first, one more per
2083
+ * success, back to one on any new 429.
2084
+ */
2085
+ declare function nextConcurrency(current: number, cap: number, event: "success" | "rate-limited"): number;
2086
+ declare class GateWaitExceeded extends Error {
2087
+ constructor();
2088
+ }
2089
+ declare class GateAborted extends Error {
2090
+ constructor();
2091
+ }
2092
+ interface ProviderGateOptions {
2093
+ readonly concurrency?: number;
2094
+ readonly now?: () => number;
2095
+ }
2096
+ /**
2097
+ * Admission control shared by every lane of a run: a concurrency cap on
2098
+ * in-flight provider requests plus one cooldown that pauses all of them after
2099
+ * a 429. Backed by p-queue.
2100
+ */
2101
+ declare class ProviderGate {
2102
+ readonly cap: number;
2103
+ private readonly queue;
2104
+ private readonly now;
2105
+ private cooldownUntil;
2106
+ private timer;
2107
+ constructor(options?: ProviderGateOptions);
2108
+ /** Current admission limit; below the cap while ramping after a cooldown. */
2109
+ get concurrency(): number;
2110
+ get coolingDown(): boolean;
2111
+ get inFlight(): number;
2112
+ /**
2113
+ * Run `task` once a slot is free and no cooldown is active. Waiting ends
2114
+ * with `GateAborted` when `signal` aborts, or `GateWaitExceeded` after
2115
+ * `maxWaitMs`; neither consumes a slot.
2116
+ */
2117
+ run<T>(task: () => Promise<T>, options?: {
2118
+ readonly signal?: AbortSignal;
2119
+ readonly maxWaitMs?: number;
2120
+ }): Promise<{
2121
+ readonly value: T;
2122
+ readonly waitedMs: number;
2123
+ }>;
2124
+ /** Pause admission for every lane until at least `until`; later requests extend it. */
2125
+ cooldown(until: number): void;
2126
+ /**
2127
+ * Release the pending cooldown timer when the run ends, so an interrupted
2128
+ * or timed-out run does not keep the process alive until the window closes.
2129
+ */
2130
+ close(): void;
2131
+ /** One successful response widens admission by one, up to the cap. */
2132
+ succeeded(): void;
2133
+ }
2134
+
2002
2135
  declare const DEFAULT_VISION_MODEL = "google/gemini-3.8-flash";
2003
2136
  interface VisionObservation {
2004
2137
  readonly instruction: string;
@@ -2375,6 +2508,12 @@ interface ClassificationResult {
2375
2508
  */
2376
2509
  declare const WAIT_UNTIL: RegExp;
2377
2510
  declare function canonicalSentence(sentence: string): string;
2511
+ /**
2512
+ * Whether a sentence has a statically recognizable claim shape. This is
2513
+ * intentionally narrower than natural language: an unreadable shape must not
2514
+ * let an authored action pass offline validation as an `ai.holds` claim.
2515
+ */
2516
+ declare function isClaimSentence(sentence: string): boolean;
2378
2517
  declare function preflightSentence(sentence: string): ClassificationDiagnosticCode | null;
2379
2518
  declare function patternOperation(sentence: string): StepOperationKind | null;
2380
2519
  /** Validate the lexical operands that cannot safely be guessed by execution. */
@@ -2399,12 +2538,13 @@ declare function classificationKey(sentence: string): string;
2399
2538
  declare class FileClassificationCache implements ClassificationCache {
2400
2539
  readonly path: string;
2401
2540
  readonly requestedModel: string;
2541
+ readonly provider: string;
2402
2542
  readonly loadReason: "ok" | "absent" | "corrupt" | "format_mismatch";
2403
2543
  private readonly invalidKeys;
2404
2544
  private readonly entries;
2405
2545
  private dirty;
2406
2546
  private constructor();
2407
- static load(path: string, requestedModel: string): Promise<FileClassificationCache>;
2547
+ static load(path: string, requestedModel: string, provider?: string): Promise<FileClassificationCache>;
2408
2548
  get(sentence: string): CacheLookup;
2409
2549
  put(sentence: string, answer: CachedClassification): void;
2410
2550
  save(): Promise<void>;
@@ -2669,6 +2809,15 @@ interface GoalState {
2669
2809
  readonly declaredDataKeys?: readonly string[];
2670
2810
  readonly completionCriteria?: readonly string[];
2671
2811
  readonly operationInstructions?: string;
2812
+ readonly automaticData?: boolean;
2813
+ /** TypeScript goals stop at planner completion; YAML requests verification. */
2814
+ readonly completion?: "planner";
2815
+ }
2816
+ interface GoalValueState {
2817
+ readonly goal: string;
2818
+ readonly page: string;
2819
+ readonly field: string;
2820
+ readonly choices: Readonly<Record<string, string>>;
2672
2821
  }
2673
2822
  interface GoalChoice {
2674
2823
  readonly choice: string;
@@ -2680,7 +2829,15 @@ interface GoalDecision {
2680
2829
  readonly target?: GoalChoice;
2681
2830
  readonly call: ProviderCall;
2682
2831
  }
2832
+ declare const GOAL_NO_MATCH = "__sedum_no_match";
2683
2833
  interface GoalPlanner {
2834
+ /** Optional for older providers; enables automatic synthetic data in goal mode. */
2835
+ chooseGoalValue?(state: GoalValueState, options?: ProviderCallOptions): Promise<{
2836
+ readonly value: GoalChoice;
2837
+ readonly call: ProviderCall;
2838
+ }>;
2839
+ /** Minimum target Choice cardinality required by this provider protocol. */
2840
+ readonly targetChoiceMinOptions?: 2;
2684
2841
  /** Exactly one HTTP attempt; operation and speculative target heads share it. */
2685
2842
  chooseGoal(state: GoalState, options?: ProviderCallOptions): Promise<GoalDecision>;
2686
2843
  }
@@ -2696,7 +2853,13 @@ interface GoalOptions {
2696
2853
  readonly timeoutMs?: number;
2697
2854
  /** Experimental operation-only margin; target margin and confidence floors stay fixed. */
2698
2855
  readonly operationMinMargin?: number;
2856
+ /** Reproduce the POC's local Faker sequence (English locale, pinned version). */
2857
+ readonly dataSeed?: number;
2699
2858
  readonly signal?: AbortSignal;
2859
+ /** Redaction history, never offered as available fill bindings. */
2860
+ readonly opaqueEntries?: readonly ResolvedDataEntry[];
2861
+ /** Register generated text with the host's report redactor before any fill. */
2862
+ readonly onGeneratedValue?: (value: RuntimeValue) => void;
2700
2863
  /** Awaited after each dispatched action; contains no typed values. */
2701
2864
  readonly onAction?: (action: GoalAction) => Promise<void>;
2702
2865
  }
@@ -2715,6 +2878,7 @@ interface GoalAction {
2715
2878
  readonly calls: readonly ProviderCall[];
2716
2879
  }
2717
2880
  interface GoalResult {
2881
+ readonly dataSeed?: number;
2718
2882
  readonly status: "passed" | "failed";
2719
2883
  readonly reason: string;
2720
2884
  readonly requests: number;
@@ -2728,6 +2892,17 @@ interface GoalResult {
2728
2892
  * CLICK 0.46". Contains no typed values.
2729
2893
  */
2730
2894
  readonly detail?: string;
2895
+ /** Safe terminal context for report metadata/evidence; never contains typed values. */
2896
+ readonly failure?: {
2897
+ readonly version: PageVersion;
2898
+ readonly operation?: "click" | "type";
2899
+ readonly targetName?: string;
2900
+ readonly targetRole?: string;
2901
+ readonly confidence?: number | null;
2902
+ readonly probability?: number;
2903
+ /** Allowlisted local generator identity; never the generated value. */
2904
+ readonly generator?: string;
2905
+ };
2731
2906
  readonly verification: readonly {
2732
2907
  claim: string;
2733
2908
  verdict: string;
@@ -2739,7 +2914,7 @@ interface GoalResult {
2739
2914
  declare function goalOperations(state: GoalState): Record<string, string>;
2740
2915
  /** Same confidence and comparable-margin floor as Sedum's strict locator. */
2741
2916
  declare function goalChoiceAccepted(answer: GoalChoice, ids: readonly string[], minMargin?: number): boolean;
2742
- /** No generated text, selectors, JavaScript, arbitrary keys, or navigation URLs. */
2917
+ /** Only host-owned value generators; no model-authored text or executable code. */
2743
2918
  declare function runGoal(page: BrowserPage, planner: GoalPlanner, judge: Judge, options: GoalOptions): Promise<GoalResult>;
2744
2919
 
2745
2920
  /**
@@ -2924,6 +3099,12 @@ interface SentencePresentation {
2924
3099
  }
2925
3100
  /** @internal Execute one classified sentence and record it as one step. */
2926
3101
  declare function executeSentence(page: BrowserPage, step: ClassifiedFlowSentence, dependencies: AttemptDependencies, data: Record<string, ResolvedDataEntry>, opaqueEntries: ResolvedDataEntry[], presentation?: SentencePresentation): Promise<"continue" | "failed" | FlowRunResult>;
3102
+ /** Goal replay frames show the resulting page, never a stale pre-action target box. */
3103
+ declare function recordGoalAction(page: BrowserPage, action: GoalAction, report: AttemptReport, repoRoot: string, source: FlowSource, group?: readonly string[], canceled?: boolean): Promise<void>;
3104
+ /** Capture the current safe page and selected target for a terminal goal failure. */
3105
+ declare function goalFailureArtifacts(page: BrowserPage, result: GoalResult, report: AttemptReport, id: string): Promise<Pick<ResultStep, "page" | "locator" | "evidence" | "targetBox"> & {
3106
+ readonly detail?: string;
3107
+ }>;
2927
3108
  /** Run one validated attempt with setup, body, and exhaustive teardown. */
2928
3109
  declare function runFlow(file: string, runDependencies: FlowRunnerDependencies): Promise<FlowRunResult>;
2929
3110
 
@@ -2972,7 +3153,7 @@ interface ScriptSentence {
2972
3153
  }
2973
3154
  interface ScriptSentenceScan {
2974
3155
  readonly sentences: readonly ScriptSentence[];
2975
- /** Sentences built at run time; they cannot be checked before a run. */
3156
+ /** Static diagnostics, including run-time shapes that cannot be checked. */
2976
3157
  readonly warnings: readonly FlowDiagnostic[];
2977
3158
  /** Parameter names of the functions this file declares, by position. */
2978
3159
  readonly functions: ReadonlyMap<string, readonly string[]>;
@@ -3061,4 +3242,4 @@ interface ActionRequest {
3061
3242
  readonly description: string;
3062
3243
  }
3063
3244
 
3064
- export { ACCEPTANCE_POLICY_VERSION, type ActionRequest, AiValues, type Aim, type AimResult, AssertionEngineError, type AssertionEngineErrorCode, type AssertionOptions, type AttemptDependencies, type AttemptReport, type BrowserContextOptions, type BrowserContextSession, type BrowserDriver, BrowserDriverError, type BrowserDriverErrorCode, type BrowserInstallResult, type BrowserKind, type BrowserLaunchOptions, type BrowserPage, type BrowserSession, CACHE_FORMAT, CANDIDATE_LIMIT, CLASSIFICATION_PROMPT_VERSION, type CacheEntry, type CacheLookup, type CacheMissReason, type CacheStore, type CachedClassification, type Candidate, type CandidatePage, ClassificationBatchError, type ClassificationCache, type ClassificationDiagnostic, type ClassificationDiagnosticCode, type ClassificationInput, type ClassificationMetrics, type ClassificationProvider, type ClassificationResult, type ClassifiedFlowDefinition, type ClassifiedFlowSentence, type ClassifiedFlowStep, type ClassifiedModuleStep, type ClassifiedStep, type ClassifyFlowOptions, type ClickOptions, type ClickResult, type ControlStateResult, DEFAULT_BAND, DEFAULT_CONTRADICTION_CUTOFF, DEFAULT_MIN_P, DEFAULT_VISION_MODEL, DIGEST_LIMIT, DataResolutionError, DeclaredDataValue, type DigestResult, type DiscoveryProblem, type DiscoveryProblemCode, FileClassificationCache, type FillResult, type FillTarget, type FlowClassificationDiagnostic, type FlowClassificationResult, FlowDefinition, FlowDiagnostic, type FlowRunResult, type FlowRunnerDependencies, FlowScalar, FlowSource, FlowToken, FlowValidationResult, FullValidationCoverage, type GoalAction, type GoalChoice, type GoalDecision, type GoalOptions, type GoalPlanner, type GoalResult, type GoalState, type HelperCall, type HistoryMove, type ImportBinding, type InvalidListEntry, type ItemVerdict, type Judge, type JudgeDecision, type JudgePageDigest, type LineRange, type ListedDiagnostic, type ListedTest, type LoadedScriptFile, LocatorCacheConflict, type LocatorCacheDiagnostic, type LocatorCacheLookup, type LocatorCacheSeed, type LocatorDiagnostic, type LocatorFailure, type LocatorOptionDiagnostic, type LocatorOptions, type LocatorResult, MATCHER_VERSION, MIN_MODEL_MARGIN, MIN_MODEL_PROBABILITY, MODEL_CHOICES, type MatchResult, type MeasureResult, type ModelChoice, type ModelClassification, ModuleBinding, ModuleBindingResolutionError, ModuleStep, NAME_LIMIT, NOT_CHECKED_OFFLINE_CODE, type NavigationOptions, type NavigationResult, NoopCacheStore, NoopClassificationCache, OPERATIONS, OPERATION_SET_VERSION, OpenRouterVisionResolver, type Operation, PAGE_PROTOCOL, PEER_LIMIT, type PageBridge, PageScriptError, type PageVersion, type ParseFlowOptions, ParsedFlowResult, ParsedModuleResult, PlaywrightBrowserDriver, type ProjectFileValidation, type ProjectFiles, type ProjectValidationCounts, type ProjectValidationOptions, type ProjectValidationResult, type ProviderCall, type ProviderCallOptions, ProviderError, type ProviderErrorCode, type ProviderRate, type ProviderTokenUsage, type ReadTargetResult, type RejectionOwner, RejectionRouter, type RepeatedMemberPolicy, type ReportPrivacy, type ResolveFlowModulesOptions, type ResolvedDataEntry, type ResolvedFlowResult, ResolvedModuleCall, ResolvedStepTarget, type Resolver, type ResolverCandidate, type ResolverCandidates, type ResolverDecision, type ResolverItem, type ResolverOption, type ResultAttempt, ResultAttemptSchema, type ResultCall, ResultCallSchema, ResultErrorSchema, type ResultExecution, ResultExecutionSchema, type ResultFrame, ResultFrameSchema, ResultJudgementSchema, ResultLocatorSchema, ResultObservationSchema, type ResultPage, ResultPageSchema, type ResultProblem, ResultProblemSchema, type ResultSink, ResultSourceSchema, type ResultStep, ResultStepSchema, type ResultTest, ResultTestSchema, ResultTotalsSchema, ReusableBrowserDriver, RunRecorder, type RunResult, RunResultSchema, type RunningTest, RuntimeUrl, RuntimeValue, SCRIPT_TEST_SUFFIX, ScriptRegistration, type ScriptSentence, type ScriptSentenceScan, type ScriptTest, ScriptUsageError, type SentenceClassification, type SentencePresentation, SentenceStep, type SettleOptions, type SettleResult, type StepCommand, StepExecutionError, type StepExecutionOptions, type StepExecutionResult, type StepFailureCode, type StepFailurePhase, type StepOperation, type StepOperationKind, type StepOutcome, type StepSource, type StepTokenization, type StrayReason, TEST_SUFFIXES, TestBody, type TestListing, TestRecording, type TestStartInput, type UnattributedRejection, VISION_PROMPT, ValidationInput, type VerifyDecision, type VerifyFlag, type VerifyOptions, type VerifyPolicy, type VerifyResult, type VisionFailure, type VisionKeyProbe, type VisionObservation, VisionRequestError, type VisionResolver, WAIT_UNTIL, attributeRejection, callExtent, canonicalSentence, captureVisionObservation, checkRegistrations, classificationKey, classifyParsedFlow, classifySentenceSteps, classifySteps, clearPageRefs, clickTarget, closeQuietly, codePoints, collectCandidates, compareDiagnostics, controlState, dedupeDiagnostics, describeRejection, discoverFlowFiles, discoverProjectFiles, displayPath, evaluateModelAnswer, evaluateVerifyScores, executeSentence, executeStep, findBrowserExecutable, findIdentityCollisions, firstDiagnostic, goalChoiceAccepted, goalOperations, inlineValues, installChromium, isFlowScalar, isRunWideProviderError, isSafeRole, isScriptTestFile, isWeakPeer, keyedDigest, listTests, liveCandidates, loadFlowFile, loadListingEntries, loadScriptFile, matchEntry, matchLiveEntry, measure, navigationWhy, normalizeSignal, opaqueMatches, pageDigest, pageKey, pageVersion, parseDataTemplate, parseFlow, parseModule, patternOperation, preflightSentence, probeOpenRouterKey, projectCandidates, projectDigest, quietPage, readTarget, redactOpaqueText, reportPage, resolveData, resolveEntryUrl, resolveFlowModules, resolveModuleBindings, resolveTarget, resolveTypeOperand, resultCall, resultTotals, runFlow, runGoal, runResultJsonSchema, runScriptTest, runtimeFailure, safeSource, safeText, safeUrl, sameVisualVersion, scanImportBindings, scanLocalImports, scanScriptSentences, scriptListingEntries, stageEntry, tokenize, tokenizeStep, unknownCostCall, unsupported, validateFlows, validateOperand, validateProject, validateRunResult, validateTypeOperand, valueEntries, verify, visibleText, visualCandidates, walkSuiteFiles };
3245
+ export { ACCEPTANCE_POLICY_VERSION, type ActionRequest, AiValues, type Aim, type AimResult, AssertionEngineError, type AssertionEngineErrorCode, type AssertionOptions, type AttemptDependencies, type AttemptReport, BACKOFF_JITTER, type BrowserContextOptions, type BrowserContextSession, type BrowserDriver, BrowserDriverError, type BrowserDriverErrorCode, type BrowserInstallResult, type BrowserKind, type BrowserLaunchOptions, type BrowserPage, type BrowserSession, CACHE_FORMAT, CANDIDATE_LIMIT, CLASSIFICATION_PROMPT_VERSION, type CacheEntry, type CacheLookup, type CacheMissReason, type CacheStore, type CachedClassification, type Candidate, type CandidatePage, ClassificationBatchError, type ClassificationCache, type ClassificationDiagnostic, type ClassificationDiagnosticCode, type ClassificationInput, type ClassificationMetrics, type ClassificationProvider, type ClassificationResult, type ClassifiedFlowDefinition, type ClassifiedFlowSentence, type ClassifiedFlowStep, type ClassifiedModuleStep, type ClassifiedStep, type ClassifyFlowOptions, type ClickOptions, type ClickResult, type ControlStateResult, DEFAULT_BAND, DEFAULT_CONTRADICTION_CUTOFF, DEFAULT_MIN_P, DEFAULT_PROVIDER_CONCURRENCY, DEFAULT_VISION_MODEL, DIGEST_LIMIT, DataResolutionError, DeclaredDataValue, type DigestResult, type DiscoveryProblem, type DiscoveryProblemCode, FileClassificationCache, type FillResult, type FillTarget, type FlowClassificationDiagnostic, type FlowClassificationResult, FlowDefinition, FlowDiagnostic, type FlowRunResult, type FlowRunnerDependencies, FlowScalar, FlowSource, FlowToken, FlowValidationResult, FullValidationCoverage, GOAL_NO_MATCH, GateAborted, GateWaitExceeded, type GoalAction, type GoalChoice, type GoalDecision, type GoalOptions, type GoalPlanner, type GoalResult, type GoalState, type GoalValueState, type HelperCall, type HistoryMove, type ImportBinding, type InvalidListEntry, type ItemVerdict, type Judge, type JudgeDecision, type JudgePageDigest, type LineRange, type ListedDiagnostic, type ListedTest, type LoadedScriptFile, LocatorCacheConflict, type LocatorCacheDiagnostic, type LocatorCacheLookup, type LocatorCacheSeed, type LocatorDiagnostic, type LocatorFailure, type LocatorOptionDiagnostic, type LocatorOptions, type LocatorResult, MATCHER_VERSION, MAX_COOLDOWN_MS, MAX_PROVIDER_CONCURRENCY, MIN_MODEL_MARGIN, MIN_MODEL_PROBABILITY, MODEL_CHOICES, type MatchResult, type MeasureResult, type ModelChoice, type ModelClassification, ModuleBinding, ModuleBindingResolutionError, ModuleStep, NAME_LIMIT, NOT_CHECKED_OFFLINE_CODE, type NavigationOptions, type NavigationResult, NoopCacheStore, NoopClassificationCache, OPERATIONS, OPERATION_SET_VERSION, OpenRouterVisionResolver, type Operation, PAGE_PROTOCOL, PEER_LIMIT, type PageBridge, PageScriptError, type PageVersion, type ParseFlowOptions, ParsedFlowResult, ParsedModuleResult, PlaywrightBrowserDriver, type ProjectFileValidation, type ProjectFiles, type ProjectValidationCounts, type ProjectValidationOptions, type ProjectValidationResult, type ProviderCall, type ProviderCallOptions, ProviderError, type ProviderErrorCode, ProviderGate, type ProviderGateOptions, type ProviderRate, type ProviderTokenUsage, RATE_LIMIT_BUDGET_MS, type ReadTargetResult, type RejectionOwner, RejectionRouter, type RelevanceProvider, type RelevanceTest, type RepeatedMemberPolicy, type ReportPrivacy, type ResolveFlowModulesOptions, type ResolvedDataEntry, type ResolvedFlowResult, ResolvedModuleCall, ResolvedStepTarget, type Resolver, type ResolverCandidate, type ResolverCandidates, type ResolverDecision, type ResolverItem, type ResolverOption, type ResultAttempt, ResultAttemptSchema, type ResultCall, ResultCallSchema, ResultErrorSchema, type ResultExecution, ResultExecutionSchema, type ResultFrame, ResultFrameSchema, ResultJudgementSchema, ResultLocatorSchema, ResultObservationSchema, type ResultPage, ResultPageSchema, type ResultProblem, ResultProblemSchema, type ResultSink, ResultSourceSchema, type ResultStep, ResultStepSchema, type ResultTest, ResultTestSchema, ResultTotalsSchema, ReusableBrowserDriver, RunRecorder, type RunResult, RunResultSchema, type RunningTest, RuntimeUrl, RuntimeValue, SCRIPT_TEST_SUFFIX, ScriptRegistration, type ScriptSentence, type ScriptSentenceScan, type ScriptTest, ScriptUsageError, type SentenceClassification, type SentencePresentation, SentenceStep, type SettleOptions, type SettleResult, type StepCommand, StepExecutionError, type StepExecutionOptions, type StepExecutionResult, type StepFailureCode, type StepFailurePhase, type StepOperation, type StepOperationKind, type StepOutcome, type StepSource, type StepTokenization, type StrayReason, TEST_SUFFIXES, TestBody, type TestListing, TestRecording, type TestStartInput, type UnattributedRejection, VISION_PROMPT, ValidationInput, type VerifyDecision, type VerifyFlag, type VerifyOptions, type VerifyPolicy, type VerifyResult, type VisionFailure, type VisionKeyProbe, type VisionObservation, VisionRequestError, type VisionResolver, WAIT_UNTIL, attributeRejection, backoffDelay, callExtent, canonicalSentence, captureVisionObservation, checkRegistrations, classificationKey, classifyParsedFlow, classifySentenceSteps, classifySteps, clearPageRefs, clickTarget, closeQuietly, codePoints, collectCandidates, compareDiagnostics, controlState, cooldownDelay, dedupeDiagnostics, describeRejection, discoverFlowFiles, discoverProjectFiles, displayPath, evaluateModelAnswer, evaluateVerifyScores, executeSentence, executeStep, findBrowserExecutable, findIdentityCollisions, firstDiagnostic, goalChoiceAccepted, goalFailureArtifacts, goalOperations, inlineValues, installChromium, isClaimSentence, isFlowScalar, isRunWideProviderError, isSafeRole, isScriptTestFile, isWeakPeer, keyedDigest, listTests, liveCandidates, loadFlowFile, loadListingEntries, loadScriptFile, matchEntry, matchLiveEntry, measure, navigationWhy, nextConcurrency, normalizeSignal, opaqueMatches, pageDigest, pageKey, pageVersion, parseDataTemplate, parseFlow, parseModule, parseRetryAfter, patternOperation, preflightSentence, probeOpenRouterKey, projectCandidates, projectDigest, quietPage, readTarget, recordGoalAction, redactOpaqueText, reportPage, resolveData, resolveEntryUrl, resolveFlowModules, resolveModuleBindings, resolveTarget, resolveTypeOperand, resultCall, resultTotals, runFlow, runGoal, runResultJsonSchema, runScriptTest, runtimeFailure, safeSource, safeText, safeUrl, sameVisualVersion, scanImportBindings, scanLocalImports, scanScriptSentences, scriptListingEntries, stageEntry, tokenize, tokenizeStep, unknownCostCall, unsupported, validateFlows, validateOperand, validateProject, validateRunResult, validateTypeOperand, valueEntries, verify, visibleText, visualCandidates, walkSuiteFiles };