effect-browser 0.3.0-beta.15 → 0.3.0-beta.16
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 +6 -2
- package/dist/{Browser-BBSySyjT.mjs → Browser-DRPthkNO.mjs} +4 -4
- package/dist/Browser-DRPthkNO.mjs.map +1 -0
- package/dist/Browser.d.mts +2 -2
- package/dist/Browser.mjs +1 -1
- package/dist/{BrowserEvent-BRu2juEz.d.mts → BrowserEvent-dq6FRT8w.d.mts} +9 -9
- package/dist/BrowserEvent.d.mts +1 -1
- package/dist/BrowserEvent.mjs +7 -12
- package/dist/BrowserEvent.mjs.map +1 -1
- package/dist/Cdp.mjs +2 -2
- package/dist/{Change-iMlcuzVD.d.mts → Change-DqING3tr.d.mts} +2 -2
- package/dist/Change.d.mts +1 -1
- package/dist/Chromium.mjs +2 -2
- package/dist/Expect.d.mts +1 -1
- package/dist/Expect.mjs +2 -2
- package/dist/Moment.d.mts +1 -1
- package/dist/Moment.mjs +1 -1
- package/dist/Motion-DND6I-64.d.mts +40 -0
- package/dist/Motion.d.mts +2 -40
- package/dist/Motion.mjs +1 -2
- package/dist/Motion.mjs.map +1 -1
- package/dist/{Page-B5cjaUp5.mjs → Page-C_VkBVwI.mjs} +5 -9
- package/dist/Page-C_VkBVwI.mjs.map +1 -0
- package/dist/{Page-DL9eylp3.d.mts → Page-jHmSJeOS.d.mts} +6 -13
- package/dist/Page.d.mts +1 -1
- package/dist/Page.mjs +1 -1
- package/dist/{Plan-6As6vcwT.d.mts → Plan-DLtRksuu.d.mts} +3 -3
- package/dist/{Plan-CXA2BW-G.mjs → Plan-X-JkACAB.mjs} +6 -9
- package/dist/Plan-X-JkACAB.mjs.map +1 -0
- package/dist/Plan.d.mts +1 -1
- package/dist/Plan.mjs +1 -1
- package/dist/Policy.d.mts +1 -1
- package/dist/Policy.mjs +1 -1
- package/dist/Presentation.d.mts +2 -2
- package/dist/Presentation.mjs +3 -2
- package/dist/Presentation.mjs.map +1 -1
- package/dist/Stage.d.mts +1 -1
- package/dist/Stage.mjs +3 -3
- package/dist/Stage.mjs.map +1 -1
- package/dist/{Supervisor-DaGlQVjv.mjs → Supervisor-BgWP8o9t.mjs} +41 -17
- package/dist/Supervisor-BgWP8o9t.mjs.map +1 -0
- package/dist/{Supervisor-5tZ47hR5.d.mts → Supervisor-mVPeEUp8.d.mts} +12 -5
- package/dist/Supervisor.d.mts +1 -1
- package/dist/Supervisor.mjs +1 -1
- package/dist/{context-BAjRj7Xo.mjs → context-rYTk-3Cv.mjs} +68 -3
- package/dist/context-rYTk-3Cv.mjs.map +1 -0
- package/dist/index.d.mts +6 -6
- package/dist/index.mjs +4 -4
- package/dist/match.inpage-xOe9LNO0.mjs.map +1 -1
- package/dist/{page-B92QnRfT.mjs → page-ClEMFnBG.mjs} +48 -110
- package/dist/page-ClEMFnBG.mjs.map +1 -0
- package/package.json +1 -1
- package/src/Browser.ts +1 -1
- package/src/BrowserEvent.ts +7 -12
- package/src/Motion.ts +1 -2
- package/src/Page.ts +5 -9
- package/src/Plan.ts +1 -2
- package/src/Presentation.ts +2 -1
- package/src/Stage.ts +2 -1
- package/src/Supervisor.ts +3 -2
- package/src/internal/input/actions.ts +25 -33
- package/src/internal/input/dispatch.ts +3 -4
- package/src/internal/input/edit.inpage.ts +3 -9
- package/src/internal/input/evidence.inpage.ts +2 -20
- package/src/internal/input/guard.inpage.ts +9 -29
- package/src/internal/input/guard.ts +12 -1
- package/src/internal/input/targets.inpage.ts +4 -8
- package/src/internal/input/targets.ts +8 -11
- package/src/internal/page/context.ts +2 -2
- package/src/internal/pictures/capture.ts +4 -4
- package/src/internal/pictures/clock.ts +8 -3
- package/src/internal/pictures/pictures.ts +2 -1
- package/src/internal/reading/controls.inpage.ts +8 -1
- package/src/internal/reading/match.inpage.ts +2 -1
- package/src/internal/reading/outline.inpage.ts +7 -4
- package/src/internal/reading/reading.ts +5 -16
- package/src/internal/supervisor/lifecycle.ts +56 -13
- package/dist/Browser-BBSySyjT.mjs.map +0 -1
- package/dist/Page-B5cjaUp5.mjs.map +0 -1
- package/dist/Plan-CXA2BW-G.mjs.map +0 -1
- package/dist/Supervisor-DaGlQVjv.mjs.map +0 -1
- package/dist/context-BAjRj7Xo.mjs.map +0 -1
- package/dist/page-B92QnRfT.mjs.map +0 -1
package/dist/Motion.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Motion.mjs","names":[],"sources":["../src/Motion.ts"],"sourcesContent":["/**\n * Pointer motion as a complete, bounded schedule, independent of browser input and transport. A\n * presenter takes a planner as a value: `lognormal` here, or another, such as recorded strokes.\n *\n * @since 0.3.0\n */\nimport { Effect, Random, Schema } from \"effect\";\n\nexport const maximumSamples = 2048;\nexport const maximumDurationMillis = 5000;\n\nexport const Point = Schema.Struct({ x: Schema.Finite, y: Schema.Finite });\nexport type Point = typeof Point.Type;\n\nexport const Sample = Schema.Struct({\n x: Schema.Finite,\n y: Schema.Finite,\n afterMillis: Schema.Finite.check(\n Schema.isGreaterThanOrEqualTo(0),\n Schema.isLessThanOrEqualTo(maximumDurationMillis),\n ),\n});\n\nexport type Sample = typeof Sample.Type;\n\n/** A complete glide: 1 to 2,048 samples whose offsets never decrease. */\nexport const Plan = Schema.Array(Sample).check(\n Schema.isBetweenLength(1, maximumSamples),\n Schema.makeFilter(\n (samples) =>\n samples.every(\n (sample, index) => sample.afterMillis >= (samples[index - 1]?.afterMillis ?? 0),\n ),\n { expected: \"nondecreasing sample offsets\" },\n ),\n);\n\nexport type Plan = typeof Plan.Type;\n\nexport interface Service {\n /**\n * Offsets start when the performer publishes the plan, before its first input. The browser\n * decodes the result as a `Plan` whose last sample must be exactly `to`. Glide time has a budget\n * of its own, outside the browser's `actionTimeout`, so a drag may glide twice for 5 seconds.\n */\n readonly plan: (from: Point, to: Point) => Effect.Effect<ReadonlyArray<Sample>>;\n}\n\n// These are the research's tuned two-stroke parameters. Width scaling was not evaluated, so the\n// model keeps its 40px reference width rather than implying measured target-size behavior.\nconst tuning = {\n intercept: 115.8,\n slope: 291.8,\n durationSigma: 0.407,\n amplitude: 0.989,\n amplitudeSigma: 0.138,\n lateral: 0.0934,\n primaryDuration: 0.512,\n correctionDuration: 0.586,\n overlap: 0.452,\n sigmaLow: 0.155,\n sigmaHigh: 0.53,\n} as const;\n\nconst sampleMillis = 16.7;\n\nconst normal = Effect.gen(function* () {\n const radius = Math.sqrt(-2 * Math.log(1 - (yield* Random.next)));\n\n return radius * Math.cos(2 * Math.PI * (yield* Random.next));\n});\n\n// Abramowitz-Stegun 7.1.26 supplies erf without another runtime dependency (error < 1.5e-7).\nconst erf = (value: number) => {\n const x = Math.abs(value);\n const t = 1 / (1 + 0.3275911 * x);\n\n const polynomial =\n ((((1.061405429 * t - 1.453152027) * t + 1.421413741) * t - 0.284496736) * t + 0.254829592) * t;\n\n return Math.sign(value) * (1 - polynomial * Math.exp(-x * x));\n};\n\nconst cumulative = (time: number, onset: number, mu: number, sigma: number) =>\n time <= onset ? 0 : (1 + erf((Math.log(time - onset) - mu) / (sigma * Math.SQRT2))) / 2;\n\nconst plan: Service[\"plan\"] = Effect.fnUntraced(function* (from, to) {\n // Work in normalized coordinates so finite extreme inputs cannot overflow the displacement.\n const scale = Math.max(1, Math.abs(from.x), Math.abs(from.y), Math.abs(to.x), Math.abs(to.y));\n const startX = from.x / scale;\n const startY = from.y / scale;\n const deltaX = to.x / scale - startX;\n const deltaY = to.y / scale - startY;\n const distance = Math.hypot(deltaX, deltaY);\n\n if (distance * scale < 2) return [{ ...to, afterMillis: 0 }];\n const unitX = deltaX / distance;\n const unitY = deltaY / distance;\n\n const drawnDuration =\n (tuning.intercept + tuning.slope * Math.log2(1 + distance * (scale / 40))) *\n Math.exp((yield* normal) * tuning.durationSigma);\n\n const endFactor = Math.max(\n tuning.primaryDuration,\n tuning.overlap * tuning.primaryDuration + tuning.correctionDuration,\n );\n\n // Bound the duration before evaluating either stroke: dropping a sampled tail would remove\n // its homing correction. The last regular 16.7ms sample remains inside the public time bound.\n const lastRegularSample = Math.floor(maximumDurationMillis / sampleMillis) * sampleMillis;\n const duration = Math.min(drawnDuration, lastRegularSample / endFactor);\n const amplitude = distance * (tuning.amplitude + (yield* normal) * tuning.amplitudeSigma);\n const angle = ((yield* normal) * Math.PI) / 60;\n const primaryX = amplitude * (unitX * Math.cos(angle) - unitY * Math.sin(angle));\n const primaryY = amplitude * (unitY * Math.cos(angle) + unitX * Math.sin(angle));\n const sigma1 = yield* Random.nextBetween(tuning.sigmaLow, tuning.sigmaHigh);\n const primaryDuration = tuning.primaryDuration * duration;\n const mu1 = Math.log(primaryDuration / (Math.exp(3 * sigma1) - Math.exp(-3 * sigma1)));\n const onset1 = -Math.exp(mu1 - 3 * sigma1);\n const sigma2 = yield* Random.nextBetween(tuning.sigmaLow, tuning.sigmaHigh);\n const correctionDuration = tuning.correctionDuration * duration;\n const mu2 = Math.log(correctionDuration / (Math.exp(3 * sigma2) - Math.exp(-3 * sigma2)));\n const onset2 = tuning.overlap * primaryDuration - Math.exp(mu2 - 3 * sigma2);\n const end = Math.max(primaryDuration, onset2 + Math.exp(mu2 + 3 * sigma2));\n const centered = Math.max(Number.EPSILON, yield* Random.next) - 0.5;\n\n const lateral =\n -tuning.lateral * Math.sign(centered) * Math.log(1 - 2 * Math.abs(centered)) * distance;\n\n const count = Math.min(\n Math.ceil(end / sampleMillis),\n Math.floor(lastRegularSample / sampleMillis),\n );\n\n const samples: Array<Sample> = [];\n let last: Point = from;\n\n const coordinate = (value: number) =>\n Math.round(Math.max(-Number.MAX_VALUE, Math.min(Number.MAX_VALUE, value * scale)));\n\n for (let index = 0; index < count; index++) {\n const afterMillis = index * sampleMillis;\n const first = cumulative(afterMillis, onset1, mu1, sigma1);\n const second = cumulative(afterMillis, onset2, mu2, sigma2);\n const bend = lateral * Math.sin(Math.PI * first);\n const x = coordinate(startX + primaryX * first + (deltaX - primaryX) * second - unitY * bend);\n const y = coordinate(startY + primaryY * first + (deltaY - primaryY) * second + unitX * bend);\n\n // A pointer that stays on its pixel reports nothing; the model's timing is unchanged.\n if (x === last.x && y === last.y) continue;\n last = { x, y };\n samples.push({ x, y, afterMillis });\n }\n\n // The exact destination always lands at the model's end, even if a dwell precedes it.\n samples.push({ ...to, afterMillis: count * sampleMillis });\n\n return samples;\n});\n\n/**\n * The research's tuned two-stroke sigma-lognormal model: a fast stroke toward the target and a\n * slower one that homes in on it, with a little bend, drawn from `Random`.\n */\nexport const lognormal: Service = { plan };\n"],"mappings":";;;;;;;;;;;;;;;;;AAQA,MAAa,iBAAiB;AAC9B,MAAa,wBAAwB;AAErC,MAAa,QAAQ,OAAO,OAAO;CAAE,GAAG,OAAO;CAAQ,GAAG,OAAO;AAAO,CAAC;AAGzE,MAAa,SAAS,OAAO,OAAO;CAClC,GAAG,OAAO;CACV,GAAG,OAAO;CACV,aAAa,OAAO,OAAO,MACzB,OAAO,uBAAuB,CAAC,GAC/B,OAAO,oBAAoB,qBAAqB,CAClD;AACF,CAAC;;AAKD,MAAa,OAAO,OAAO,MAAM,MAAM,CAAC,CAAC,MACvC,OAAO,gBAAgB,GAAG,cAAc,GACxC,OAAO,YACJ,YACC,QAAQ,OACL,QAAQ,UAAU,OAAO,gBAAgB,QAAQ,QAAQ,EAAE,EAAE,eAAe,EAC/E,GACF,EAAE,UAAU,+BAA+B,CAC7C,CACF;AAeA,MAAM,SAAS;CACb,WAAW;CACX,OAAO;CACP,eAAe;CACf,WAAW;CACX,gBAAgB;CAChB,SAAS;CACT,iBAAiB;CACjB,oBAAoB;CACpB,SAAS;CACT,UAAU;CACV,WAAW;AACb;AAEA,MAAM,eAAe;AAErB,MAAM,SAAS,OAAO,IAAI,aAAa;CAGrC,OAFe,KAAK,KAAK,KAAK,KAAK,IAAI,KAAK,OAAO,OAAO,KAAK,CAEnD,IAAI,KAAK,IAAI,IAAI,KAAK,MAAM,OAAO,OAAO,KAAK;AAC7D,CAAC;AAGD,MAAM,OAAO,UAAkB;CAC7B,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,KAAK,IAAI,OAAO,WAAW,QAAQ,KAAK,CAAC,CAAC;CAEnF,KAAK,IAAI,QAAQ,GAAG,QAAQ,OAAO,SAAS;EAC1C,MAAM,cAAc,QAAQ;EAC5B,MAAM,QAAQ,WAAW,aAAa,QAAQ,KAAK,MAAM;EACzD,MAAM,SAAS,WAAW,aAAa,QAAQ,KAAK,MAAM;EAC1D,MAAM,OAAO,UAAU,KAAK,IAAI,KAAK,KAAK,KAAK;EAC/C,MAAM,IAAI,WAAW,SAAS,WAAW,SAAS,SAAS,YAAY,SAAS,QAAQ,IAAI;EAC5F,MAAM,IAAI,WAAW,SAAS,WAAW,SAAS,SAAS,YAAY,SAAS,QAAQ,IAAI;EAG5F,IAAI,MAAM,KAAK,KAAK,MAAM,KAAK,GAAG;EAClC,OAAO;GAAE;GAAG;EAAE;EACd,QAAQ,KAAK;GAAE;GAAG;GAAG;EAAY,CAAC;CACpC;CAGA,QAAQ,KAAK;EAAE,GAAG;EAAI,aAAa,QAAQ;CAAa,CAAC;CAEzD,OAAO;AACT,CAMoC,EAAK"}
|
|
1
|
+
{"version":3,"file":"Motion.mjs","names":[],"sources":["../src/Motion.ts"],"sourcesContent":["/**\n * Pointer motion as a complete, bounded schedule, independent of browser input and transport. A\n * presenter takes a planner as a value: `lognormal` here, or another, such as recorded strokes.\n *\n * @since 0.3.0\n */\nimport { Effect, Random, Schema } from \"effect\";\n\nexport const maximumSamples = 2048;\nexport const maximumDurationMillis = 5000;\n\nexport const Point = Schema.Struct({ x: Schema.Finite, y: Schema.Finite });\nexport type Point = typeof Point.Type;\n\nexport const Sample = Schema.Struct({\n ...Point.fields,\n afterMillis: Schema.Finite.check(\n Schema.isGreaterThanOrEqualTo(0),\n Schema.isLessThanOrEqualTo(maximumDurationMillis),\n ),\n});\n\nexport type Sample = typeof Sample.Type;\n\n/** A complete glide: 1 to 2,048 samples whose offsets never decrease. */\nexport const Plan = Schema.Array(Sample).check(\n Schema.isBetweenLength(1, maximumSamples),\n Schema.makeFilter(\n (samples) =>\n samples.every(\n (sample, index) => sample.afterMillis >= (samples[index - 1]?.afterMillis ?? 0),\n ),\n { expected: \"nondecreasing sample offsets\" },\n ),\n);\n\nexport type Plan = typeof Plan.Type;\n\nexport interface Service {\n /**\n * Offsets start when the performer publishes the plan, before its first input. The browser\n * decodes the result as a `Plan` whose last sample must be exactly `to`. Glide time has a budget\n * of its own, outside the browser's `actionTimeout`, so a drag may glide twice for 5 seconds.\n */\n readonly plan: (from: Point, to: Point) => Effect.Effect<ReadonlyArray<Sample>>;\n}\n\n// These are the research's tuned two-stroke parameters. Width scaling was not evaluated, so the\n// model keeps its 40px reference width rather than implying measured target-size behavior.\nconst tuning = {\n intercept: 115.8,\n slope: 291.8,\n durationSigma: 0.407,\n amplitude: 0.989,\n amplitudeSigma: 0.138,\n lateral: 0.0934,\n primaryDuration: 0.512,\n correctionDuration: 0.586,\n overlap: 0.452,\n sigmaLow: 0.155,\n sigmaHigh: 0.53,\n} as const;\n\nconst sampleMillis = 16.7;\n\nconst normal = Effect.gen(function* () {\n const radius = Math.sqrt(-2 * Math.log(1 - (yield* Random.next)));\n\n return radius * Math.cos(2 * Math.PI * (yield* Random.next));\n});\n\n// Abramowitz-Stegun 7.1.26 supplies erf without another runtime dependency (error < 1.5e-7).\nconst erf = (value: number) => {\n const x = Math.abs(value);\n const t = 1 / (1 + 0.3275911 * x);\n\n const polynomial =\n ((((1.061405429 * t - 1.453152027) * t + 1.421413741) * t - 0.284496736) * t + 0.254829592) * t;\n\n return Math.sign(value) * (1 - polynomial * Math.exp(-x * x));\n};\n\nconst cumulative = (time: number, onset: number, mu: number, sigma: number) =>\n time <= onset ? 0 : (1 + erf((Math.log(time - onset) - mu) / (sigma * Math.SQRT2))) / 2;\n\nconst plan: Service[\"plan\"] = Effect.fnUntraced(function* (from, to) {\n // Work in normalized coordinates so finite extreme inputs cannot overflow the displacement.\n const scale = Math.max(1, Math.abs(from.x), Math.abs(from.y), Math.abs(to.x), Math.abs(to.y));\n const startX = from.x / scale;\n const startY = from.y / scale;\n const deltaX = to.x / scale - startX;\n const deltaY = to.y / scale - startY;\n const distance = Math.hypot(deltaX, deltaY);\n\n if (distance * scale < 2) return [{ ...to, afterMillis: 0 }];\n const unitX = deltaX / distance;\n const unitY = deltaY / distance;\n\n const drawnDuration =\n (tuning.intercept + tuning.slope * Math.log2(1 + distance * (scale / 40))) *\n Math.exp((yield* normal) * tuning.durationSigma);\n\n const endFactor = Math.max(\n tuning.primaryDuration,\n tuning.overlap * tuning.primaryDuration + tuning.correctionDuration,\n );\n\n // Bound the duration before evaluating either stroke: dropping a sampled tail would remove\n // its homing correction. The last regular 16.7ms sample remains inside the public time bound.\n const lastRegularSample = Math.floor(maximumDurationMillis / sampleMillis) * sampleMillis;\n const duration = Math.min(drawnDuration, lastRegularSample / endFactor);\n const amplitude = distance * (tuning.amplitude + (yield* normal) * tuning.amplitudeSigma);\n const angle = ((yield* normal) * Math.PI) / 60;\n const primaryX = amplitude * (unitX * Math.cos(angle) - unitY * Math.sin(angle));\n const primaryY = amplitude * (unitY * Math.cos(angle) + unitX * Math.sin(angle));\n const sigma1 = yield* Random.nextBetween(tuning.sigmaLow, tuning.sigmaHigh);\n const primaryDuration = tuning.primaryDuration * duration;\n const mu1 = Math.log(primaryDuration / (Math.exp(3 * sigma1) - Math.exp(-3 * sigma1)));\n const onset1 = -Math.exp(mu1 - 3 * sigma1);\n const sigma2 = yield* Random.nextBetween(tuning.sigmaLow, tuning.sigmaHigh);\n const correctionDuration = tuning.correctionDuration * duration;\n const mu2 = Math.log(correctionDuration / (Math.exp(3 * sigma2) - Math.exp(-3 * sigma2)));\n const onset2 = tuning.overlap * primaryDuration - Math.exp(mu2 - 3 * sigma2);\n const end = Math.max(primaryDuration, onset2 + Math.exp(mu2 + 3 * sigma2));\n const centered = Math.max(Number.EPSILON, yield* Random.next) - 0.5;\n\n const lateral =\n -tuning.lateral * Math.sign(centered) * Math.log(1 - 2 * Math.abs(centered)) * distance;\n\n const count = Math.min(\n Math.ceil(end / sampleMillis),\n Math.floor(lastRegularSample / sampleMillis),\n );\n\n const samples: Array<Sample> = [];\n let last: Point = from;\n\n const coordinate = (value: number) =>\n Math.round(Math.max(-Number.MAX_VALUE, Math.min(Number.MAX_VALUE, value * scale)));\n\n for (let index = 0; index < count; index++) {\n const afterMillis = index * sampleMillis;\n const first = cumulative(afterMillis, onset1, mu1, sigma1);\n const second = cumulative(afterMillis, onset2, mu2, sigma2);\n const bend = lateral * Math.sin(Math.PI * first);\n const x = coordinate(startX + primaryX * first + (deltaX - primaryX) * second - unitY * bend);\n const y = coordinate(startY + primaryY * first + (deltaY - primaryY) * second + unitX * bend);\n\n // A pointer that stays on its pixel reports nothing; the model's timing is unchanged.\n if (x === last.x && y === last.y) continue;\n last = { x, y };\n samples.push({ x, y, afterMillis });\n }\n\n // The exact destination always lands at the model's end, even if a dwell precedes it.\n samples.push({ ...to, afterMillis: count * sampleMillis });\n\n return samples;\n});\n\n/**\n * The research's tuned two-stroke sigma-lognormal model: a fast stroke toward the target and a\n * slower one that homes in on it, with a little bend, drawn from `Random`.\n */\nexport const lognormal: Service = { plan };\n"],"mappings":";;;;;;;;;;;;;;;;;AAQA,MAAa,iBAAiB;AAC9B,MAAa,wBAAwB;AAErC,MAAa,QAAQ,OAAO,OAAO;CAAE,GAAG,OAAO;CAAQ,GAAG,OAAO;AAAO,CAAC;AAGzE,MAAa,SAAS,OAAO,OAAO;CAClC,GAAG,MAAM;CACT,aAAa,OAAO,OAAO,MACzB,OAAO,uBAAuB,CAAC,GAC/B,OAAO,oBAAoB,qBAAqB,CAClD;AACF,CAAC;;AAKD,MAAa,OAAO,OAAO,MAAM,MAAM,CAAC,CAAC,MACvC,OAAO,gBAAgB,GAAG,cAAc,GACxC,OAAO,YACJ,YACC,QAAQ,OACL,QAAQ,UAAU,OAAO,gBAAgB,QAAQ,QAAQ,EAAE,EAAE,eAAe,EAC/E,GACF,EAAE,UAAU,+BAA+B,CAC7C,CACF;AAeA,M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ast, o as withheld, s as Correlation } from "./url-Cd04Okid.mjs";
|
|
4
5
|
import { Frame, Image } from "./Frame.mjs";
|
|
@@ -402,6 +403,7 @@ const PreparedInputResultSchema = Schema.Union([Schema.Struct({
|
|
|
402
403
|
name: Schema.String,
|
|
403
404
|
cursor: Schema.String,
|
|
404
405
|
href: Schema.optional(Schema.String),
|
|
406
|
+
/** A field the DOM marks as holding a password, a one-time code or a card's details. */
|
|
405
407
|
secret: Schema.Boolean,
|
|
406
408
|
fingerprint: Schema.String
|
|
407
409
|
}))),
|
|
@@ -458,10 +460,7 @@ var Zoom = class extends Schema.Class("effect-browser/Zoom")({
|
|
|
458
460
|
}) {};
|
|
459
461
|
/** The target as it read before input. Point coordinates are never snapped to another position. */
|
|
460
462
|
var ResolvedTarget = class extends Schema.Class("effect-browser/ResolvedTarget")({
|
|
461
|
-
point:
|
|
462
|
-
x: Schema.Finite,
|
|
463
|
-
y: Schema.Finite
|
|
464
|
-
}),
|
|
463
|
+
point: Point,
|
|
465
464
|
element: Schema.String,
|
|
466
465
|
/** The element's lowercase tag name. */
|
|
467
466
|
tag: Schema.String,
|
|
@@ -568,10 +567,7 @@ var InputRequest = class extends Schema.Class("effect-browser/InputRequest")({
|
|
|
568
567
|
target: Schema.optional(Schema.String),
|
|
569
568
|
element: Schema.optional(Schema.String),
|
|
570
569
|
/** Literal pixel targets only; ref coordinates are resolved after the policy allows them. */
|
|
571
|
-
point: Schema.optional(
|
|
572
|
-
x: Schema.Finite,
|
|
573
|
-
y: Schema.Finite
|
|
574
|
-
})),
|
|
570
|
+
point: Schema.optional(Point),
|
|
575
571
|
text: Schema.optional(Schema.String),
|
|
576
572
|
role: Schema.optional(Schema.NullOr(Schema.String)),
|
|
577
573
|
name: Schema.optional(Schema.String),
|
|
@@ -615,4 +611,4 @@ const correlate = (id) => (effect) => Effect.provideService(effect, Correlation,
|
|
|
615
611
|
//#endregion
|
|
616
612
|
export { evidence as _, Page_exports as a, State as c, correlate as d, failFast as f, guard as g, ValidatedInputResultSchema as h, InputRequest as i, Text as l, PreparedInputResultSchema as m, Fact as n, Region as o, redacted as p, Found as r, ResolvedTarget as s, ElementState as t, Zoom as u };
|
|
617
613
|
|
|
618
|
-
//# sourceMappingURL=Page-
|
|
614
|
+
//# sourceMappingURL=Page-C_VkBVwI.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Page-C_VkBVwI.mjs","names":["Fact","Motion.Point","Guard.Fact","Url.withheld"],"sources":["../src/internal/input/evidence.inpage.ts","../src/internal/input/guard.inpage.ts","../src/Page.ts"],"sourcesContent":["/**\n * In the page: what the page says about an input's first target, for a judge, and which fields a\n * form would send. It never reads what a field holds. See `reading/names.inpage.ts` for what a page-side part may use.\n */\nimport { Schema } from \"effect\";\n\nimport type { ContextReader } from \"../reading/context.inpage.ts\";\nimport type { Names } from \"../reading/names.inpage.ts\";\n\nexport type FormField = typeof FormFieldSchema.Encoded;\n\n/** Page text about the first target. It never includes what a field holds. */\nexport type Evidence = typeof EvidenceSchema.Encoded;\n\ntype Field = HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement;\n\nexport const evidence = (names: Names, placing: ContextReader) => {\n const { clean, isDocument, isInput, isSelect, isTextArea, nameOf, parentOf, roleOf, textOf } =\n names;\n\n const { groups, headingBefore, textBeside, treeOf } = placing;\n\n /** A field a submission would send. */\n const isField = (element: Element): element is Field =>\n ((isInput(element) && ![\"button\", \"submit\", \"reset\", \"image\"].includes(element.type)) ||\n isSelect(element) ||\n isTextArea(element)) &&\n !element.matches(\":disabled\");\n\n const isFilled = (field: Field): boolean =>\n isInput(field) && (field.type === \"checkbox\" || field.type === \"radio\")\n ? field.checked\n : isInput(field) && field.type === \"file\"\n ? (field.files?.length ?? 0) > 0\n : field.value !== \"\";\n\n const dialogOf = (element: Element): Element | undefined => {\n for (let node: Element | null = element; node !== null; node = parentOf(node))\n if (node.tagName === \"DIALOG\" || /^(?:alert)?dialog$/.test(node.getAttribute(\"role\") ?? \"\"))\n return node;\n\n return undefined;\n };\n\n /** What the page says about an input's first target, for a judge. Never a field's value. */\n const evidenceOf = (\n element: Element,\n form: HTMLFormElement | null,\n method: string | undefined,\n action: string | undefined,\n ): Evidence => {\n const name = nameOf(element, roleOf(element));\n const ids = element.getAttribute(\"aria-describedby\");\n\n const description = clean(\n ids === null\n ? (element.getAttribute(\"aria-description\") ?? element.getAttribute(\"title\"))\n : ids\n .split(/\\s+/)\n .map((id) => element.ownerDocument.getElementById(id)?.textContent ?? \"\")\n .join(\" \"),\n 120,\n );\n\n const dialog = dialogOf(element);\n\n const title = dialog?.querySelector(\"h1,h2,h3,h4,h5,h6,[role=heading]\");\n\n const dialogName =\n dialog === undefined\n ? \"\"\n : clean(nameOf(dialog, \"dialog\"), 120) ||\n (title === null || title === undefined ? \"\" : clean(textOf(title), 120));\n\n // Each scope stays in the target's own tree: a walker cannot leave a shadow root.\n const root = element.getRootNode();\n const top = isDocument(root) ? (root.body ?? root) : root;\n const inTree = element.closest(\"dialog,[role=dialog],[role=alertdialog]\");\n let nearby = \"\";\n\n for (const scope of new Set([element.closest(groups), inTree, top]))\n if (scope !== null && nearby === \"\")\n nearby = textBeside(element, scope, true) || textBeside(element, scope, false);\n\n const heading = headingBefore(element, treeOf(element));\n\n const fields =\n form === null\n ? []\n : Array.from(form.elements)\n .filter(isField)\n .slice(0, 16)\n .map((field) => {\n const autocomplete = clean(field.getAttribute(\"autocomplete\"), 40);\n\n return {\n type: isInput(field) ? field.type : field.tagName.toLowerCase(),\n name: clean(\n isInput(field) && field.type === \"hidden\"\n ? field.getAttribute(\"name\")\n : nameOf(field, roleOf(field)),\n 40,\n ),\n ...(autocomplete === \"\" ? {} : { autocomplete }),\n filled: isFilled(field),\n };\n });\n\n return {\n title: clean(document.title, 120),\n ...(description === \"\" || description === name ? {} : { description }),\n ...(dialogName === \"\" ? {} : { dialog: dialogName }),\n ...(heading === undefined ? {} : { heading }),\n ...(nearby === \"\" ? {} : { nearby }),\n ...(form === null\n ? {}\n : { form: { method: method ?? form.method, action: action ?? form.action, fields } }),\n };\n };\n\n return { evidenceOf, isField, isFilled };\n};\n\nexport type EvidenceReader = ReturnType<typeof evidence>;\n\nexport const FormFieldSchema = Schema.Struct({\n type: Schema.String,\n name: Schema.String,\n autocomplete: Schema.optional(Schema.String),\n filled: Schema.Boolean,\n});\n\nexport const EvidenceSchema = Schema.Struct({\n title: Schema.String,\n description: Schema.optional(Schema.String),\n dialog: Schema.optional(Schema.String),\n heading: Schema.optional(Schema.String),\n nearby: Schema.optional(Schema.String),\n form: Schema.optional(\n Schema.Struct({\n method: Schema.String,\n action: Schema.String,\n fields: Schema.Array(FormFieldSchema),\n }),\n ),\n});\n","/**\n * In the page: what the input guard decides on. It inspects an input's targets for the facts a\n * policy weighs, such as a form submission or a secret field, binds an approval to them, and\n * checks before each press that the approved target would still receive it. See `reading/names.inpage.ts` for what a page-side part may use.\n */\nimport { Schema } from \"effect\";\n\nimport type { Point } from \"../../Motion.ts\";\nimport type { Names } from \"../reading/names.inpage.ts\";\nimport { type Evidence, type EvidenceReader, EvidenceSchema } from \"./evidence.inpage.ts\";\nimport type { Targets } from \"./targets.inpage.ts\";\n\nexport const Fact = Schema.Literals([\n \"form-submit\",\n \"cross-origin\",\n \"download\",\n \"upload\",\n \"secret\",\n \"scripted\",\n \"opaque\",\n]);\n\nexport type Fact = typeof Fact.Type;\n\nexport interface InputPlan {\n readonly action: string;\n readonly targets: ReadonlyArray<string | Point | null>;\n readonly submit: boolean;\n readonly keys: string | null;\n readonly destination: string | null;\n}\n\nexport type InspectedTarget = NonNullable<PreparedInput[\"targets\"][number]>;\n\nexport type PreparedInput = Exclude<PreparedInputResult, InputFailure>;\n\n/** A refusal; a stale target is named by its index in the plan. */\nexport type InputFailure = typeof InputPreparationError.Encoded;\n\nexport type PreparedInputResult = typeof PreparedInputResultSchema.Encoded;\n\nexport type ValidatedInputResult = typeof ValidatedInputResultSchema.Encoded;\n\n/** A point where a target, by its index in the plan, is about to receive a press. */\nexport interface Press extends Point {\n readonly index: number;\n}\n\nexport interface ValidationOptions {\n /** Require focus on the first target. */\n readonly focused?: boolean;\n /** After the pointer's own events have run, each target must still receive its press. */\n readonly presses?: ReadonlyArray<Press>;\n}\n\nexport const guard = (names: Names, targets: Targets, evidence: EvidenceReader) => {\n const {\n activeElement,\n clean,\n describe,\n inCurrentDocument,\n interactiveRoles,\n isButton,\n isDisabled,\n isHtml,\n isInput,\n isLabel,\n isRoot,\n isSecret,\n isSelect,\n isTextArea,\n lookup,\n parentOf,\n refFor,\n roleOf,\n } = names;\n\n const { controlOf, details, hitAt, hrefAttribute, linkOf, receives, within } = targets;\n const { evidenceOf, isField, isFilled } = evidence;\n\n /**\n * The element whose activation behaviour a click or key on `element` runs, as the browser\n * resolves it along the composed path: a link, button, input, summary or a label's control.\n */\n const activationTarget = (element: Element): Element | undefined => {\n for (let node: Element | null = element; node !== null; node = parentOf(node)) {\n if (\n hrefAttribute(node) !== null ||\n node.tagName === \"BUTTON\" ||\n node.tagName === \"SUMMARY\" ||\n (isInput(node) && node.type !== \"hidden\")\n )\n return node;\n if (isLabel(node) && node.control !== null) return node.control;\n }\n\n return undefined;\n };\n\n /**\n * A control between a press's hit and the approved target that is not the target's own\n * activation, such as a link or button a hover handler nested into it. The approval inspected\n * the target, so that control would act unapproved.\n */\n const nestedControl = (element: Element, hit: Element): Element | undefined => {\n // A container of the target is covered by the target's own facts.\n if (!within(element, hit)) return undefined;\n const own = activationTarget(element);\n\n for (\n let node: Element | null = hit;\n node !== null && node !== element;\n node = parentOf(node) ?? node.ownerDocument.defaultView?.frameElement ?? null\n )\n if (\n node !== own &&\n (hrefAttribute(node) !== null ||\n node.tagName === \"BUTTON\" ||\n node.tagName === \"SUMMARY\" ||\n (isInput(node) && node.type !== \"hidden\") ||\n isSelect(node) ||\n isTextArea(node) ||\n (isLabel(node) && node.control !== null && node.control !== own) ||\n activatingRoles.has(roleOf(node) ?? \"\"))\n )\n return node;\n\n return undefined;\n };\n\n const textEntry = (element: Element): boolean =>\n (isInput(element) &&\n ![\n \"button\",\n \"reset\",\n \"submit\",\n \"image\",\n \"checkbox\",\n \"radio\",\n \"file\",\n \"range\",\n \"color\",\n \"hidden\",\n ].includes(element.type)) ||\n isTextArea(element) ||\n (isHtml(element) && element.isContentEditable);\n\n const activatingRoles = new Set([\n \"button\",\n \"link\",\n \"checkbox\",\n \"radio\",\n \"switch\",\n \"tab\",\n \"menuitem\",\n \"menuitemcheckbox\",\n \"menuitemradio\",\n \"option\",\n \"treeitem\",\n ]);\n\n // Typed text goes wherever focus is, and a typed space or letter can press a focused button,\n // toggle a box, follow a link or change a select. Only fields, or elements that are none of\n // these (a page or a canvas game), may receive text.\n const typingRefusal = (element: Element, explicit: boolean): string | undefined =>\n textEntry(element)\n ? undefined\n : explicit\n ? `${describe(element)} is not a text field`\n : activationTarget(element) !== undefined ||\n isSelect(element) ||\n activatingRoles.has(roleOf(element) ?? \"\")\n ? `focus is on ${describe(element)}, which typed text could activate or change; type into a text field by ref, or use press for keys`\n : undefined;\n\n const isSubmitter = (element: Element): element is HTMLButtonElement | HTMLInputElement =>\n (isButton(element) && element.type === \"submit\") ||\n (isInput(element) && (element.type === \"submit\" || element.type === \"image\"));\n\n // form.elements omits image submitters. Walk the whole root in tree order so an Enter\n // submission uses the real default button, including controls associated from outside the form.\n const defaultSubmitter = (form: HTMLFormElement) => {\n const root = form.getRootNode();\n\n return isRoot(root)\n ? Array.from(root.querySelectorAll(\"button,input\")).find(\n (candidate): candidate is HTMLButtonElement | HTMLInputElement =>\n isSubmitter(candidate) && candidate.form === form,\n )\n : undefined;\n };\n\n // Attributes that say what a field is for. They bind an approval.\n const purpose = (control: Element, form: HTMLFormElement | null) => [\n control.getAttribute(\"id\"),\n control.getAttribute(\"name\"),\n control.getAttribute(\"inputmode\"),\n control.getAttribute(\"autocomplete\"),\n control.getAttribute(\"aria-label\"),\n form?.getAttribute(\"id\"),\n form?.getAttribute(\"name\"),\n form?.getAttribute(\"aria-label\"),\n ];\n\n // What an approval binds of a URL. A fragment that names a place on the page, which scroll-spy\n // and feed pages rewrite as they scroll, is left out. A hash route (#/… or #!…) stays: it\n // selects what the page's controls act on.\n const boundUrl = (url: string): string => {\n const hash = url.indexOf(\"#\");\n\n return hash === -1 || /^#[/!]/.test(url.slice(hash)) ? url : url.slice(0, hash);\n };\n\n const inspectInput = (element: Element, plan: InputPlan) => {\n const metadata = details(element, element, 0, 0);\n // Facts are about what the input activates, such as the submit button around a painted label.\n const control = activationTarget(element) ?? element;\n\n const form =\n isInput(control) || isButton(control) || isTextArea(control) || isSelect(control)\n ? control.form\n : null;\n\n // The chord's last key, which may be the plus key itself: Control++.\n const key = plan.keys === null ? undefined : /(?:^|\\+)(\\+|[^+]+)$/.exec(plan.keys)?.[1];\n const enter = key === \"Enter\";\n\n const activation =\n plan.action === \"click\" || (plan.action === \"press\" && (enter || key === \"Space\"));\n\n // Enter submits a form from any input but buttons, file and color pickers, including\n // checkboxes, radios and ranges.\n const fieldEnter =\n isInput(control) &&\n ![\"button\", \"reset\", \"submit\", \"image\", \"file\", \"color\", \"hidden\"].includes(control.type) &&\n ((plan.action === \"press\" && enter) || (plan.action === \"type\" && plan.submit));\n\n const submits = form !== null && ((activation && isSubmitter(control)) || fieldEnter);\n\n const submitter = isSubmitter(control)\n ? control\n : form === null\n ? undefined\n : defaultSubmitter(form);\n\n const formDestination =\n form === null\n ? undefined\n : submitter?.hasAttribute(\"formaction\") === true\n ? submitter.formAction\n : form.action;\n\n const formMethod =\n form === null\n ? undefined\n : submitter?.hasAttribute(\"formmethod\") === true\n ? submitter.formMethod\n : form.method;\n\n const formTarget =\n form === null\n ? undefined\n : submitter?.hasAttribute(\"formtarget\") === true\n ? submitter.formTarget\n : form.target;\n\n const link = linkOf(element);\n const href = link === undefined ? null : hrefAttribute(link);\n // A dialog form only closes its dialog; the page's script decides what that means.\n const sends = submits && formMethod !== \"dialog\";\n // Only activation follows a link or opens a file chooser; hovering or scrolling over a\n // control does neither.\n const destination = sends ? formDestination : activation ? metadata.href : undefined;\n const acts = plan.action !== \"hover\" && plan.action !== \"scroll\";\n\n // What the browser itself does on activation: follow a link, submit or reset a form, choose\n // a file or a value, toggle a box or a disclosure, or focus a field. Anything else is the\n // page's script.\n const builtIn =\n sends ||\n (href !== null && !/^\\s*(?:#\\s*|javascript:[^]*)$/i.test(href)) ||\n (isInput(control) && ![\"button\", \"submit\", \"image\", \"reset\"].includes(control.type)) ||\n ((isInput(control) || isButton(control)) && control.type === \"reset\" && form !== null) ||\n control.tagName === \"SUMMARY\" ||\n control.closest(\"select\") !== null ||\n textEntry(control);\n\n const facts: Array<Fact> = [];\n\n // Facts come from structure only. What a name or the text around it says is evidence for a\n // judge, never a fact: words change meaning with context and language.\n if (sends) facts.push(\"form-submit\");\n if (activation && link?.hasAttribute(\"download\") === true) facts.push(\"download\");\n if (activation && isInput(control) && control.type === \"file\") facts.push(\"upload\");\n if (\n (plan.action === \"type\" && isSecret(control)) ||\n (sends &&\n form !== null &&\n Array.from(form.elements).some(\n (field) => isField(field) && isSecret(field) && isFilled(field),\n ))\n )\n facts.push(\"secret\");\n if (activation && !builtIn) facts.push(\"scripted\");\n if (acts && (metadata.role === \"canvas\" || metadata.role === \"iframe\" || metadata.name === \"\"))\n facts.push(\"opaque\");\n\n // Bind what decides the consequence and the control's identity. Names bind interactive\n // controls only: other text, such as a live price or a page's own text, may change freely.\n const role = metadata.role;\n\n const boundName =\n role !== null &&\n (interactiveRoles.has(role) || role === \"canvas\" || role === \"iframe\") &&\n !(isHtml(element) && element.isContentEditable)\n ? metadata.name\n : null;\n\n // A focus or scroll handler changing these attributes must not leave an old permission behind.\n const fingerprint = JSON.stringify([\n purpose(control, form),\n element.tagName,\n element.id,\n role,\n boundName,\n metadata.href,\n control === element ? null : refFor(control),\n isInput(control) || isButton(control) ? control.type : control.tagName,\n control.matches(\":disabled\") || isDisabled(control),\n control.getAttribute(\"readonly\"),\n control.getAttribute(\"aria-readonly\"),\n isHtml(control) && control.isContentEditable,\n control.getAttribute(\"name\"),\n control.getAttribute(\"accept\"),\n control.hasAttribute(\"multiple\"),\n link?.getAttribute(\"download\"),\n form === null ? null : refFor(form),\n form === null ? null : boundUrl(form.action),\n form?.method,\n form?.target,\n submitter === undefined ? null : refFor(submitter),\n formDestination === undefined ? undefined : boundUrl(formDestination),\n formMethod,\n formTarget,\n submitter?.formNoValidate,\n form?.noValidate,\n ]);\n\n const inspected: InspectedTarget = {\n ref: refFor(element),\n element: metadata.element,\n role: metadata.role,\n name: metadata.name,\n cursor: metadata.cursor,\n ...(metadata.href === undefined ? {} : { href: metadata.href }),\n secret: isSecret(control),\n fingerprint,\n };\n\n return {\n inspected,\n facts,\n destination,\n explain: () => evidenceOf(element, form, formMethod, formDestination),\n };\n };\n\n // Approval preparation only reads the DOM. In particular, an offscreen ref must not scroll\n // before the policy has had a chance to deny it.\n const inspect = (\n plan: InputPlan,\n ): (Omit<PreparedInput, \"evidence\"> & { readonly explain: () => Evidence }) | InputFailure => {\n const targets: Array<InspectedTarget | null> = [];\n const facts = new Set<Fact>();\n let destination = plan.destination ?? undefined;\n let explain = (): Evidence => ({ title: clean(document.title, 120) });\n\n for (const [index, target] of plan.targets.entries()) {\n let element: Element | null | undefined;\n\n if (target === null) {\n element = activeElement();\n } else if (typeof target === \"string\") {\n element = lookup(target);\n if (element === undefined)\n return { error: \"stale\", detail: target + \" is not on the page any more\", index };\n } else {\n if (\n !Number.isFinite(target.x) ||\n !Number.isFinite(target.y) ||\n target.x < 0 ||\n target.y < 0 ||\n target.x >= window.innerWidth ||\n target.y >= window.innerHeight\n )\n return { error: \"outside\", detail: \"the point is outside the viewport\" };\n const hit = hitAt(document, target.x, target.y);\n\n element = hit === null ? null : controlOf(hit);\n if (element === null)\n return { error: \"offscreen\", detail: \"nothing is painted at the point\" };\n }\n\n if (element === null) {\n targets.push(null);\n continue;\n }\n if (!inCurrentDocument(element))\n return { error: \"stale\", detail: \"the input target belongs to a replaced document\", index };\n const refusal = plan.action === \"type\" ? typingRefusal(element, target !== null) : undefined;\n\n if (refusal !== undefined) return { error: \"untypeable\", detail: refusal };\n const inspected = inspectInput(element, plan);\n\n if (index === 0) explain = inspected.explain;\n targets.push(inspected.inspected);\n for (const fact of inspected.facts) facts.add(fact);\n destination ??= inspected.destination;\n if (inspected.destination !== undefined) {\n try {\n if (new URL(inspected.destination, location.href).origin !== location.origin)\n facts.add(\"cross-origin\");\n } catch {\n return { error: \"outside\", detail: \"the input destination is not a valid URL\" };\n }\n }\n }\n\n if (destination !== undefined) {\n try {\n destination = new URL(destination, location.href).href;\n if (new URL(destination).origin !== location.origin) facts.add(\"cross-origin\");\n } catch {\n return { error: \"outside\", detail: \"the input destination is not a valid URL\" };\n }\n }\n\n return {\n url: boundUrl(location.href),\n targets,\n facts: [...facts],\n ...(destination === undefined ? {} : { destination }),\n explain,\n };\n };\n\n // Evidence is read once, for the policy. Validation binds the facts and the targets, not the\n // text around them, which live pages change freely.\n const prepareInput = (plan: InputPlan): PreparedInputResult => {\n const inspected = inspect(plan);\n\n if (\"error\" in inspected) return inspected;\n const { explain, ...prepared } = inspected;\n\n return { ...prepared, evidence: explain() };\n };\n\n const validate = (\n plan: InputPlan,\n prepared: PreparedInput,\n options: ValidationOptions,\n ): ValidatedInputResult => {\n const current = inspect(plan);\n\n if (\"error\" in current)\n return current.error === \"stale\" ? current : { error: \"changed\", detail: current.detail };\n if (\n current.url !== prepared.url ||\n (current.destination === undefined || prepared.destination === undefined\n ? current.destination !== prepared.destination\n : boundUrl(current.destination) !== boundUrl(prepared.destination)) ||\n JSON.stringify(current.facts) !== JSON.stringify(prepared.facts) ||\n current.targets.length !== prepared.targets.length ||\n current.targets.some((target, index) => {\n const previous = prepared.targets[index];\n\n return target === null\n ? previous !== null\n : previous === null ||\n previous === undefined ||\n target.ref !== previous.ref ||\n target.fingerprint !== previous.fingerprint;\n })\n )\n return {\n error: \"changed\",\n detail: \"the page or input target changed while the policy was deciding\",\n };\n\n if (options.focused === true) {\n const active = activeElement();\n const expected = prepared.targets[0];\n\n if (\n active === null ||\n expected === null ||\n expected === undefined ||\n refFor(active) !== expected.ref\n )\n return { error: \"changed\", detail: \"focus moved away from the approved element\" };\n }\n\n for (const press of options.presses ?? []) {\n const expected = prepared.targets[press.index];\n\n const element =\n expected === null || expected === undefined ? undefined : lookup(expected.ref);\n\n const hit = hitAt(document, press.x, press.y);\n\n if (element === undefined || hit === null || !receives(element, hit))\n return {\n error: \"changed\",\n detail: `the approved target is no longer under the pointer at (${press.x}, ${press.y})`,\n };\n\n const nested = nestedControl(element, hit);\n\n if (nested !== undefined)\n return {\n error: \"changed\",\n detail: `${describe(nested)} inside the approved target would receive the press at (${press.x}, ${press.y})`,\n };\n }\n\n return { ok: true };\n };\n\n // Chromium delivers pointer moves with the next frame. A press check waits until the frame\n // after it, so it sees what the page did when the pointer arrived, such as a menu opened over\n // the target. A hidden document draws no frames, and its moves wait for the press instead.\n const validateInput = (\n plan: InputPlan,\n prepared: PreparedInput,\n options: ValidationOptions = {},\n ): ValidatedInputResult | Promise<ValidatedInputResult> => {\n if ((options.presses ?? []).length === 0) return validate(plan, prepared, options);\n const { promise, resolve } = Promise.withResolvers<void>();\n\n if (document.visibilityState === \"hidden\") resolve();\n else requestAnimationFrame(() => requestAnimationFrame(() => resolve()));\n\n return promise.then(() => validate(plan, prepared, options));\n };\n\n return { prepareInput, textEntry, typingRefusal, validateInput };\n};\n\nexport type Guard = ReturnType<typeof guard>;\n\nconst InputPreparationError = Schema.Struct({\n error: Schema.String,\n detail: Schema.String,\n index: Schema.optional(Schema.Finite),\n});\n\nexport const PreparedInputResultSchema = Schema.Union([\n Schema.Struct({\n url: Schema.String,\n targets: Schema.Array(\n Schema.NullOr(\n Schema.Struct({\n ref: Schema.String,\n element: Schema.String,\n role: Schema.NullOr(Schema.String),\n name: Schema.String,\n cursor: Schema.String,\n href: Schema.optional(Schema.String),\n /** A field the DOM marks as holding a password, a one-time code or a card's details. */\n secret: Schema.Boolean,\n fingerprint: Schema.String,\n }),\n ),\n ),\n facts: Schema.Array(Fact),\n destination: Schema.optional(Schema.String),\n evidence: EvidenceSchema,\n }),\n InputPreparationError,\n]);\n\nexport const ValidatedInputResultSchema = Schema.Union([\n Schema.Struct({ ok: Schema.Literal(true) }),\n InputPreparationError,\n]);\n","/**\n * One browser tab: navigation, snapshots, pictures and input.\n *\n * A page waits only for itself: its operations take turns in one lane of its own. An action, which\n * sends input or navigates, has the page to itself, in the order actions were asked; reads share\n * it, after the action in flight and every action asked before them, so a read describes the page\n * an action left. A wait for a turn ends at the operation's deadline as `Busy`, never `Timeout`,\n * and a full deadline then bounds the operation itself; `failFast` fails it at once instead.\n * Identical reads asked between the same actions share one call to the page, and one whose\n * callers gave up finishes for the next caller to ask it. A policy holds outside the lane while\n * other operations continue; its target is revalidated before dispatch. Element targets are refs\n * from a snapshot; point targets are viewport coordinates in CSS pixels, the same coordinates as a\n * screenshot's pixels. Mouse and keyboard input share a bounded pipeline, so pacing does not wait\n * for each protocol reply. Target lookup happens before the input is sent.\n *\n * @since 0.3.0\n */\nimport { type Duration, Effect, Schema, type Stream } from \"effect\";\nimport type { Page as PlaywrightPage } from \"playwright-core\";\n\nimport { type BrowserError, type PolicyDenied } from \"./BrowserError.ts\";\nimport { Box, type BrowserEvent, PageLoaded, Subject, SubjectContext } from \"./BrowserEvent.ts\";\nimport type { Changes } from \"./Change.ts\";\nimport { type CaptureStats, Frame, Image, type ScreencastOptions } from \"./Frame.ts\";\nimport { FormFieldSchema } from \"./internal/input/evidence.inpage.ts\";\nimport * as Guard from \"./internal/input/guard.inpage.ts\";\nimport { Correlation, FailFast } from \"./internal/page/lane.ts\";\nimport * as Url from \"./internal/page/url.ts\";\nimport type { Window } from \"./Moment.ts\";\nimport * as Motion from \"./Motion.ts\";\nimport { type Snapshot, type SnapshotOptions } from \"./Snapshot.ts\";\n\nexport type Point = Motion.Point;\n\n/** A ref from a snapshot, such as `\"e12\"`, or a viewport point. */\nexport type Target = string | Point;\n\n/** An integer rectangle in viewport CSS pixels. */\nexport class Region extends Schema.Class<Region>(\"effect-browser/Region\")({\n x: Schema.Int.check(Schema.isGreaterThanOrEqualTo(0)),\n y: Schema.Int.check(Schema.isGreaterThanOrEqualTo(0)),\n width: Schema.Int.check(Schema.isGreaterThan(0)),\n height: Schema.Int.check(Schema.isGreaterThan(0)),\n}) {}\n\n/** A crop and its viewport origin: add that origin to a point read from the crop. */\nexport class Zoom extends Schema.Class<Zoom>(\"effect-browser/Zoom\")({\n page: Schema.String,\n region: Region,\n image: Image,\n}) {}\n\n/** The target as it read before input. Point coordinates are never snapped to another position. */\nexport class ResolvedTarget extends Schema.Class<ResolvedTarget>(\"effect-browser/ResolvedTarget\")({\n point: Motion.Point,\n element: Schema.String,\n /** The element's lowercase tag name. */\n tag: Schema.String,\n role: Schema.NullOr(Schema.String),\n name: Schema.String,\n context: SubjectContext,\n /** For a point target, the box of what it found there. */\n box: Schema.optional(Box),\n cursor: Schema.String,\n href: Schema.optional(Schema.String),\n}) {}\n\nexport interface ClickOptions {\n readonly button?: \"left\" | \"right\" | \"middle\" | undefined;\n /** 2 for a double click. */\n readonly clickCount?: number | undefined;\n /** Hold the button down this long before releasing it. */\n readonly holdMillis?: number | undefined;\n}\n\nexport interface TypeOptions {\n /** Type into this text field: it is focused first, and its content replaced unless `replace` is false. */\n readonly into?: string | undefined;\n readonly replace?: boolean | undefined;\n /** Press Enter afterwards. */\n readonly submit?: boolean | undefined;\n /**\n * The text is a secret: type it only into a field the page marks secret, such as a password,\n * and otherwise refuse with `NotActionable` before any input. A replayed password asks this.\n */\n readonly secret?: boolean | undefined;\n}\n\nexport interface PressOptions {\n /**\n * Focus this element, by ref, before the first press: a link, a button or a field. The keys go to\n * whatever has focus otherwise.\n */\n readonly on?: string | undefined;\n /** Press the keys this many times. */\n readonly times?: number | undefined;\n /** Hold the keys down this long before releasing them, as a game control might need. */\n readonly holdMillis?: number | undefined;\n}\n\nexport interface ScrollOptions {\n readonly dx?: number | undefined;\n /** Pixels to scroll down; negative scrolls up. Defaults to most of a viewport. */\n readonly dy?: number | undefined;\n /** Scroll whatever is under this point or element. Defaults to the middle of the viewport. */\n readonly at?: Target | undefined;\n}\n\n/**\n * How current a picture must be. The newest screencast frame serves when it qualifies, at no cost;\n * otherwise a new screenshot is taken.\n */\nexport interface FrameOptions {\n /**\n * The oldest a reused frame may be, from its paint, at the earliest its timing allows, to now.\n * Defaults to 250 milliseconds; 0 always takes a new screenshot.\n */\n readonly maxAge?: Duration.Input | undefined;\n /**\n * `\"input\"`: reuse only a frame painted after this page's latest input, including input of an\n * interrupted action, and never while an action is changing the page. For a caller that has\n * just acted on the page.\n */\n readonly after?: \"input\" | undefined;\n}\n\n/** A screenshot reuses only a frame painted after the page's latest input, as `after: \"input\"`. */\nexport interface ScreenshotOptions {\n /** The oldest a reused frame may be, as for `frame`. Defaults to 250 milliseconds. */\n readonly maxAge?: Duration.Input | undefined;\n /** A region of the viewport, captured in CSS pixels at the viewport's own scale; always new. */\n readonly clip?: Box | undefined;\n /** JPEG quality, 0 to 100. Defaults to 80. */\n readonly quality?: number | undefined;\n /** `\"jpeg\"`, the default, or `\"png\"`, which is always a new picture. */\n readonly format?: \"jpeg\" | \"png\" | undefined;\n}\n\n/**\n * What `find` looks for. Every rule given must hold; with none, it finds every element in scope\n * that has a role or is a control.\n */\nexport interface FindQuery {\n /** An ARIA role, such as `\"button\"` or `\"heading\"`, ignoring case. */\n readonly role?: string | undefined;\n /**\n * The accessible name: a string that reads the same once spaces are collapsed and case folded,\n * or a pattern found in it.\n */\n readonly name?: string | RegExp | undefined;\n /**\n * Text it shows, ignoring case and spacing, or a pattern. Text inside a control or a heading is\n * that control's or heading's, and only the smallest element showing it matches, not every\n * element around it.\n */\n readonly text?: string | RegExp | undefined;\n /** Whole words in its context (row, column, label or heading), ignoring case and spacing. */\n readonly near?: string | undefined;\n /** Only what a point action at this viewport point would reach: the control there, or else what is painted there. */\n readonly at?: Point | undefined;\n /** The viewport (the default), or the whole document. */\n readonly scope?: \"viewport\" | \"document\" | undefined;\n}\n\n/**\n * An element's state as its markup gives it: `checked` for what can be checked, `expanded`,\n * `selected` and `pressed` where the page says either way, and `level` for headings.\n */\nexport const ElementState = Schema.Struct({\n disabled: Schema.Boolean,\n focused: Schema.Boolean,\n checked: Schema.optional(Schema.Boolean),\n expanded: Schema.optional(Schema.Boolean),\n selected: Schema.optional(Schema.Boolean),\n pressed: Schema.optional(Schema.Boolean),\n level: Schema.optional(Schema.Int),\n});\n\nexport type ElementState = typeof ElementState.Type;\n\n/** An element `find` found: a ref for the actions, what it is, where it is and its state. */\nexport class Found extends Schema.Class<Found>(\"effect-browser/Found\")({\n ref: Schema.String,\n subject: Subject,\n /** Its box, rounded. Reading the document, it may be out of view. */\n box: Box,\n inViewport: Schema.Boolean,\n state: ElementState,\n}) {}\n\nexport interface TextOptions {\n /** `\"viewport\"` (the default) reads what the viewport shows; a ref reads that element whole. */\n readonly scope?: string | undefined;\n /** Bound on the text's length, cut at a line. Defaults to 12,000 characters. */\n readonly maxChars?: number | undefined;\n /** Show what fields hold; a secret field still reads `••••`. Defaults to false. */\n readonly unmask?: boolean | undefined;\n}\n\n/** What a page showed as text: a line per block, with table cells apart by tabs. */\nexport class Text extends Schema.Class<Text>(\"effect-browser/Text\")({\n url: Schema.String,\n title: Schema.String,\n text: Schema.String,\n /** True when `text` was cut at `maxChars`. */\n truncated: Schema.Boolean,\n /** Host monotonic milliseconds from the browser's captured Effect Clock. */\n at: Schema.Finite,\n}) {}\n\n/** What `waitFor` waits for. */\nexport interface WaitCondition {\n /** A CSS selector for what to watch; the document's body without one. */\n readonly selector?: string | undefined;\n /**\n * `\"visible\"` (the default): something it matches shows; `\"hidden\"`: nothing it matches shows;\n * `\"enabled\"`: something it matches shows and is not disabled.\n */\n readonly state?: \"visible\" | \"hidden\" | \"enabled\" | undefined;\n /** Only what shows this text counts, case and all, with runs of spaces read as one. */\n readonly text?: string | undefined;\n}\n\nexport interface ReadyOptions {\n /** What must stay still during quietMillis: screen paint (default), or recorded content. */\n readonly still?: \"screen\" | \"content\" | undefined;\n /** How long the selected evidence must stay still; screen paint by default. */\n readonly quietMillis?: number | undefined;\n readonly timeout?: Duration.Input | undefined;\n}\n\n/** The window `changes` reads, and whether to show what fields hold. */\nexport interface ChangesOptions {\n /**\n * Where the window starts: the changes a previous read returned, to continue exactly where they\n * ended; a frame, at its paint; or host monotonic milliseconds, which mapped to the page's clock\n * may miss or repeat changes near the start if the browser's clock mapping changed since. Defaults\n * to the start of the record.\n */\n readonly since?: Changes | Frame | number | undefined;\n /**\n * Where it ends: a frame, at its paint, so a delayed frame's window holds nothing it does not\n * show; or host monotonic milliseconds. Defaults to now, and is never later.\n */\n readonly until?: Frame | number | undefined;\n /** Show what fields hold; a secret field still reads `••••`. Defaults to false. */\n readonly unmask?: boolean | undefined;\n}\n\n/** The window `window` reads, and whether to show what fields hold. */\nexport interface WindowOptions {\n /**\n * Where the window starts: a previous window, to continue exactly where it ended; a frame, at its\n * paint; host monotonic milliseconds; or a `Duration` back from `until`. A start after `until`\n * leaves the window empty there.\n */\n readonly since: Window | Frame | Duration.Duration | number;\n /**\n * Where it ends: a frame, at its paint, such as one a delayed consumer airs now; or host\n * monotonic milliseconds. Defaults to now, and is never later.\n */\n readonly until?: Frame | number | undefined;\n /** Show what fields hold in its changes; a secret field still reads `••••`. Defaults to false. */\n readonly unmask?: boolean | undefined;\n}\n\n/**\n * What the library knows of a page now, without asking it, each part with when it learned it, in\n * host monotonic milliseconds: a part's age is `at` less its time. Text read before the current\n * document began is left out, since it tells of a document that has gone.\n */\nexport class State extends Schema.Class<State>(\"effect-browser/PageState\")({\n page: Schema.String,\n /** When this was taken. */\n at: Schema.Finite,\n /** Where the main frame last committed or moved, without userinfo or known secret parameters. */\n url: Schema.String,\n /** The page's document, as `Navigated` counts them. */\n document: Schema.Int.check(Schema.isGreaterThanOrEqualTo(0)),\n /** When the main frame committed it; absent for the one the browser began tracking it with. */\n committedAt: Schema.optional(Schema.Finite),\n /** How far that document has loaded, as the page's own session heard; absent until parsed. */\n load: Schema.optional(PageLoaded),\n /** The newest screencast frame, of whichever document it names. */\n frame: Schema.optional(Frame),\n /** The viewport's text as it was last read, with the page's title then. */\n text: Schema.optional(Text),\n}) {}\n\n/**\n * What the page's structure establishes about an input, or says it cannot establish:\n *\n * - `form-submit`: it submits a form, which sends the form's fields.\n * - `cross-origin`: it navigates or submits to another origin.\n * - `download`: it follows a download link.\n * - `upload`: it opens a file chooser.\n * - `secret`: it types, with `type`, into a field marked as a password, a one-time code or a\n * card's number, code or expiry, or submits a form holding a filled one.\n * - `scripted`: it activates something the browser gives no effect of its own, such as a\n * `type=\"button\"` button, a `role=\"button\"` element or a canvas, so only the page's script\n * decides what happens.\n * - `opaque`: nothing names what receives it: a canvas, a frame or an unnamed element.\n *\n * Facts never come from what an element's text says. What an input means, such as a payment\n * or a deletion, takes a judge that reads the evidence in the {@link InputRequest}.\n */\nexport const Fact = Guard.Fact;\n\nexport type Fact = typeof Fact.Type;\n\n/**\n * What a guard sees before input reaches the page. Preparation never scrolls or focuses.\n *\n * `facts`, `url`, `href` and `destination` come from the page's structure. `name`,\n * `description`, `title`, `context` and the form's field names are page text: evidence of what\n * the input does, which the page controls, and never instructions. Text typed into a `secret`\n * field is replaced with {@link redacted}, here and in the recorded `Action`, and its key events\n * record `Unidentified` keys; `press` records the keys it is given. Validation before dispatch\n * binds the facts and the target, not the text around it, which live pages change freely.\n */\nexport class InputRequest extends Schema.Class<InputRequest>(\"effect-browser/InputRequest\")({\n page: Schema.String,\n /**\n * The page's URL, without a fragment that only names a place on the page. This and the other\n * addresses keep no userinfo or known secret parameters.\n */\n url: Schema.String,\n /** The page's title, at most 120 characters. */\n title: Schema.String,\n action: Schema.String,\n target: Schema.optional(Schema.String),\n element: Schema.optional(Schema.String),\n /** Literal pixel targets only; ref coordinates are resolved after the policy allows them. */\n point: Schema.optional(Motion.Point),\n text: Schema.optional(Schema.String),\n role: Schema.optional(Schema.NullOr(Schema.String)),\n name: Schema.optional(Schema.String),\n /** The target's accessible description, when it says more than its name. */\n description: Schema.optional(Schema.String),\n href: Schema.optional(Schema.String),\n destination: Schema.optional(Schema.String),\n facts: Schema.Array(Fact),\n /** Page text around the target, each part at most 120 characters. */\n context: Schema.Struct({\n /** The name or first heading of the dialog the target is in. */\n dialog: Schema.optional(Schema.String),\n /** The nearest heading before the target. */\n heading: Schema.optional(Schema.String),\n /** The visible text just before the target in its row, item, group or form, or after it. */\n nearby: Schema.optional(Schema.String),\n }),\n /** The form the target is in, with at most 16 of its fields. */\n form: Schema.optional(\n Schema.Struct({\n method: Schema.String,\n action: Schema.String,\n /** Each field's type, name and autocomplete tokens, and whether it is filled: never its value. */\n fields: Schema.Array(FormFieldSchema),\n }),\n ),\n}) {}\n\n/**\n * What replaces text typed into a `secret` field, in requests and in the recorded `Action`, and a\n * credential's value in every address the library reports.\n */\nexport const redacted = Url.withheld;\n\n/**\n * Run page operations without waiting their turn: on a page busy with other operations, each fails\n * `Busy` at once, and `Browser.newPage` on a browser with `maxPages` open fails `Limit` at once.\n */\nexport const failFast = <A, E, R>(effect: Effect.Effect<A, E, R>): Effect.Effect<A, E, R> =>\n Effect.provideService(effect, FailFast, true);\n\n/**\n * Give every action `effect` performs a caller's id, such as a model's tool call id, which its\n * recorded `Action` carries as `correlation`.\n */\nexport const correlate =\n (id: string) =>\n <A, E, R>(effect: Effect.Effect<A, E, R>): Effect.Effect<A, E, R> =>\n Effect.provideService(effect, Correlation, id);\n\n/** Succeed to allow, fail to deny, or await an external signal to hold the input. */\nexport type InputGuard = (request: InputRequest) => Effect.Effect<void, PolicyDenied>;\n\nexport interface Page {\n /** The page's CDP target id: the same page has it again after a reconnect to its browser. */\n readonly id: string;\n /** The Playwright page, for anything this API does not cover. Never give it to a model. */\n readonly playwright: PlaywrightPage;\n /** The page's address, without its userinfo or known secret parameters. */\n readonly url: Effect.Effect<string>;\n /**\n * The document's title as the page last set it, empty for an untitled page. The browser answers\n * it, in one call, so a page busy with a script cannot hold it up.\n */\n readonly title: Effect.Effect<string, BrowserError>;\n\n readonly goto: (url: string) => Effect.Effect<void, BrowserError>;\n /** The previous history entry, including one only a frame created; `NotFound` when none. */\n readonly back: Effect.Effect<void, BrowserError>;\n readonly reload: Effect.Effect<void, BrowserError>;\n /** Make this the visible tab. Background tabs paint rarely and send few screencast frames. */\n readonly bringToFront: Effect.Effect<void, BrowserError>;\n /** Close the tab, succeeding once it has closed, or at once when it already had. */\n readonly close: Effect.Effect<void, BrowserError>;\n\n readonly snapshot: (options?: SnapshotOptions) => Effect.Effect<Snapshot, BrowserError>;\n /**\n * A picture of the viewport, in CSS pixels: a screencast frame painted since the page's latest\n * input, if one qualifies, or a new one. A caller that has just acted sees what its action did.\n */\n readonly screenshot: (options?: ScreenshotOptions) => Effect.Effect<Image, BrowserError>;\n /**\n * The viewport with its timing: the newest screencast frame if it qualifies, else a new\n * screenshot timed by the host interval in which it was taken.\n */\n readonly frame: (options?: FrameOptions) => Effect.Effect<Frame, BrowserError>;\n /** A crop in CSS pixels, unmagnified, with the origin that keeps later input in viewport pixels. */\n readonly zoom: (region: Region) => Effect.Effect<Zoom, BrowserError>;\n /**\n * The viewport's size in CSS pixels, the space of points, crops and page scrolls. Over CDP the\n * page reports it, within the action timeout.\n */\n readonly viewport: Effect.Effect<\n { readonly width: number; readonly height: number },\n BrowserError\n >;\n /**\n * The elements that match a query, in tree order, with refs the actions take, in one call to the\n * page. All that match are returned, so a caller tells them apart by their context; none is an\n * empty result, not a failure.\n */\n readonly find: (query?: FindQuery) => Effect.Effect<ReadonlyArray<Found>, BrowserError>;\n /**\n * The text the viewport shows, or one element whole, in one call to the page. Field values read\n * `••••` unless `unmask`, and a secret field's always do, as does one that was secret when the\n * library saw it.\n */\n readonly text: (options?: TextOptions) => Effect.Effect<Text, BrowserError>;\n /**\n * What visibly changed over a window, in one call to the page. The first read starts the page's\n * record, so it finds none; from then the page records, and from the start of each later\n * document, until nobody has read it for two minutes. See `Change`.\n */\n readonly changes: (options?: ChangesOptions) => Effect.Effect<Changes, BrowserError>;\n /**\n * The page's events, changes and frames over a window: the frames and events it keeps, at no\n * call, and its changes, in one call, the first starting its record as `changes` does. A part\n * that cannot be read is missing, with why; the window fails only for bounds that are not finite.\n */\n readonly window: (options: WindowOptions) => Effect.Effect<Window, BrowserError>;\n /**\n * What the library knows of the page now, at no call and with no wait for its turn: where it is,\n * its document and how far it has loaded, its newest frame, and its text and title as last read.\n */\n readonly state: Effect.Effect<State>;\n\n readonly click: (\n target: Target,\n options?: ClickOptions,\n ) => Effect.Effect<ResolvedTarget, BrowserError>;\n readonly hover: (target: Target) => Effect.Effect<void, BrowserError>;\n readonly drag: (from: Target, to: Target) => Effect.Effect<void, BrowserError>;\n /** Type into a text field, or to whatever has focus unless a typed key could activate it. */\n readonly type: (text: string, options?: TypeOptions) => Effect.Effect<void, BrowserError>;\n /** Keys such as `\"Enter\"`, `\"Space\"`, `\"ArrowLeft\"` or `\"Control+A\"`. */\n readonly press: (keys: string, options?: PressOptions) => Effect.Effect<void, BrowserError>;\n readonly scroll: (options?: ScrollOptions) => Effect.Effect<void, BrowserError>;\n /**\n * Choose options of a `<select>` by value or label; returns the chosen labels. A refusal, such\n * as no matching option, is undispatched.\n */\n readonly select: (\n ref: string,\n values: ReadonlyArray<string>,\n ) => Effect.Effect<string, BrowserError>;\n\n /**\n * Wait until a condition holds, in one call that the page answers as it comes, looking every\n * 100 ms, or `Timeout` after `timeout`, 10 seconds by default. A selector that is not CSS is an\n * `InvalidRequest`.\n */\n readonly waitFor: (\n condition: WaitCondition,\n timeout?: Duration.Input,\n ) => Effect.Effect<void, BrowserError>;\n /**\n * Wait until the page is ready to be shown, asking the page every 100 ms: its document is parsed\n * and has painted since, nothing that ends is animating in view, its fonts and the images in\n * view have loaded, and the viewport shows something. With `quietMillis`, the screen must then\n * also stay still that long: nothing in view changed, where the page's changes are recorded, and\n * no frame comes, counted from the first frame of a capture the wait starts itself. A canvas\n * that keeps drawing, such as a live chart, is never still, and a page\n * is never ready without a painted frame, as a hidden tab may be. `Timeout` after `timeout`,\n * 15 seconds by default.\n */\n readonly ready: (options?: ReadyOptions) => Effect.Effect<void, BrowserError>;\n\n /**\n * Screencast frames for as long as the stream runs. Concurrent streams share one screencast and\n * its settings; explicit options that differ from a running screencast's fail with InvalidRequest.\n */\n readonly screencast: (options?: ScreencastOptions) => Stream.Stream<Frame, BrowserError>;\n /**\n * What this page's captures received, delivered and dropped, over its life or the latest\n * `window`, which reaches back at most a minute; a longer one is an `InvalidRequest`.\n */\n readonly captureStats: (options?: {\n readonly window?: Duration.Input | undefined;\n }) => Effect.Effect<CaptureStats, BrowserError>;\n /** Screencast frames painted within `frameHistory` of the newest, oldest first. */\n readonly recentFrames: Effect.Effect<ReadonlyArray<Frame>>;\n /** This page's events among the browser's latest `eventHistory`, oldest first. */\n readonly recentEvents: Effect.Effect<ReadonlyArray<BrowserEvent>>;\n}\n"],"mappings":";;;;;;;;;;;AAgBA,MAAa,YAAY,OAAc,YAA2B;CAChE,MAAM,EAAE,OAAO,YAAY,SAAS,UAAU,YAAY,QAAQ,UAAU,QAAQ,WAClF;CAEF,MAAM,EAAE,QAAQ,eAAe,YAAY,WAAW;;CAGtD,MAAM,WAAW,aACb,QAAQ,OAAO,KAAK,CAAC;EAAC;EAAU;EAAU;EAAS;CAAO,CAAC,CAAC,SAAS,QAAQ,IAAI,KACjF,SAAS,OAAO,KAChB,WAAW,OAAO,MACpB,CAAC,QAAQ,QAAQ,WAAW;CAE9B,MAAM,YAAY,UAChB,QAAQ,KAAK,MAAM,MAAM,SAAS,cAAc,MAAM,SAAS,WAC3D,MAAM,UACN,QAAQ,KAAK,KAAK,MAAM,SAAS,UAC9B,MAAM,OAAO,UAAU,KAAK,IAC7B,MAAM,UAAU;CAExB,MAAM,YAAY,YAA0C;EAC1D,KAAK,IAAI,OAAuB,SAAS,SAAS,MAAM,OAAO,SAAS,IAAI,GAC1E,IAAI,KAAK,YAAY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;CAExB,SAAS,OAAO,OAAO;;EAErB,QAAQ,OAAO,SAAS,OAAO,MAAM;;EAErC,SAAS,OAAO,SAAS,OAAO,MAAM;;EAEtC,QAAQ,OAAO,SAAS,OAAO,MAAM;CACvC,CAAC;;CAED,MAAM,OAAO,SACX,OAAO,OAAO;EACZ,QAAQ,OAAO;EACf,QAAQ,OAAO;;EAEf,QAAQ,OAAO,MAAM,eAAe;CACtC,CAAC,CACH;AACF,CAAC,CAAC,CAAC,CAAC;;;;;AAMJ,MAAa,WAAWE;;;;;AAMxB,MAAa,YAAqB,WAChC,OAAO,eAAe,QAAQ,UAAU,IAAI;;;;;AAM9C,MAAa,aACV,QACS,WACR,OAAO,eAAe,QAAQ,aAAa,EAAE"}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { p as PolicyDenied, t as BrowserError } from "./BrowserError-Coy7EW1N.mjs";
|
|
2
|
-
import { E as WheelScrolled, S as TextInserted, T as TrackPlanned, _ as PointerReleased, b as Subject, d as Navigated, f as PageClosed, g as PointerPressed, h as PageUntracked, i as BrowserEvent, l as Disconnected, m as PageOpened, o as CursorChanged, p as PageLoaded, s as DialogShown, t as Action, u as KeyChanged, w as TrackPerformed, y as SessionEnding } from "./BrowserEvent-
|
|
3
|
-
import { r as Changes, t as Change } from "./Change-
|
|
2
|
+
import { E as WheelScrolled, S as TextInserted, T as TrackPlanned, _ as PointerReleased, b as Subject, d as Navigated, f as PageClosed, g as PointerPressed, h as PageUntracked, i as BrowserEvent, l as Disconnected, m as PageOpened, o as CursorChanged, p as PageLoaded, r as Box, s as DialogShown, t as Action, u as KeyChanged, w as TrackPerformed, y as SessionEnding } from "./BrowserEvent-dq6FRT8w.mjs";
|
|
3
|
+
import { r as Changes, t as Change } from "./Change-DqING3tr.mjs";
|
|
4
4
|
import { a as Image, n as CaptureStats, o as ScreencastOptions, r as Frame } from "./Frame-DkNdjjjr.mjs";
|
|
5
5
|
import { n as Snapshot, r as SnapshotOptions } from "./Snapshot-B34hZ4Jl.mjs";
|
|
6
|
+
import { r as Point$1, t as Motion_d_exports } from "./Motion-DND6I-64.mjs";
|
|
6
7
|
import { Duration, Effect, Schema, Stream } from "effect";
|
|
7
8
|
import { Prompt } from "effect/ai";
|
|
8
9
|
import { Page } from "playwright-core";
|
|
@@ -104,10 +105,7 @@ declare const toPrompt: (moment: Moment) => Prompt.Prompt;
|
|
|
104
105
|
declare namespace Page_d_exports {
|
|
105
106
|
export { ChangesOptions, ClickOptions, ElementState, Fact, FindQuery, Found, FrameOptions, InputGuard, InputRequest, Page$1 as Page, Point, PressOptions, ReadyOptions, Region, ResolvedTarget, ScreenshotOptions, ScrollOptions, State, Target, Text, TextOptions, TypeOptions, WaitCondition, WindowOptions, Zoom, correlate, failFast, redacted };
|
|
106
107
|
}
|
|
107
|
-
|
|
108
|
-
readonly x: number;
|
|
109
|
-
readonly y: number;
|
|
110
|
-
}
|
|
108
|
+
type Point = Point$1;
|
|
111
109
|
/** A ref from a snapshot, such as `"e12"`, or a viewport point. */
|
|
112
110
|
type Target = string | Point;
|
|
113
111
|
declare const Region_base: Schema.Class<Region, Schema.Struct<{
|
|
@@ -212,12 +210,7 @@ interface ScreenshotOptions {
|
|
|
212
210
|
/** The oldest a reused frame may be, as for `frame`. Defaults to 250 milliseconds. */
|
|
213
211
|
readonly maxAge?: Duration.Input | undefined;
|
|
214
212
|
/** A region of the viewport, captured in CSS pixels at the viewport's own scale; always new. */
|
|
215
|
-
readonly clip?:
|
|
216
|
-
readonly x: number;
|
|
217
|
-
readonly y: number;
|
|
218
|
-
readonly width: number;
|
|
219
|
-
readonly height: number;
|
|
220
|
-
} | undefined;
|
|
213
|
+
readonly clip?: Box | undefined;
|
|
221
214
|
/** JPEG quality, 0 to 100. Defaults to 80. */
|
|
222
215
|
readonly quality?: number | undefined;
|
|
223
216
|
/** `"jpeg"`, the default, or `"png"`, which is always a new picture. */
|
|
@@ -592,4 +585,4 @@ interface Page$1 {
|
|
|
592
585
|
}
|
|
593
586
|
//#endregion
|
|
594
587
|
export { Account as A, TypeOptions as C, correlate as D, Zoom as E, account as F, capture as I, toPrompt as L, Moment as M, Moment_d_exports as N, failFast as O, Window as P, TextOptions as S, WindowOptions as T, ScreenshotOptions as _, FindQuery as a, Target as b, InputGuard as c, Page_d_exports as d, Point as f, ResolvedTarget as g, Region as h, Fact as i, CaptureOptions as j, redacted as k, InputRequest as l, ReadyOptions as m, ClickOptions as n, Found as o, PressOptions as p, ElementState as r, FrameOptions as s, ChangesOptions as t, Page$1 as u, ScrollOptions as v, WaitCondition as w, Text as x, State as y };
|
|
595
|
-
//# sourceMappingURL=Page-
|
|
588
|
+
//# sourceMappingURL=Page-jHmSJeOS.d.mts.map
|
package/dist/Page.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { C as TypeOptions, D as correlate, E as Zoom, O as failFast, S as TextOptions, T as WindowOptions, _ as ScreenshotOptions, a as FindQuery, b as Target, c as InputGuard, f as Point, g as ResolvedTarget, h as Region, i as Fact, k as redacted, l as InputRequest, m as ReadyOptions, n as ClickOptions, o as Found, p as PressOptions, r as ElementState, s as FrameOptions, t as ChangesOptions, u as Page, v as ScrollOptions, w as WaitCondition, x as Text, y as State } from "./Page-
|
|
1
|
+
import { C as TypeOptions, D as correlate, E as Zoom, O as failFast, S as TextOptions, T as WindowOptions, _ as ScreenshotOptions, a as FindQuery, b as Target, c as InputGuard, f as Point, g as ResolvedTarget, h as Region, i as Fact, k as redacted, l as InputRequest, m as ReadyOptions, n as ClickOptions, o as Found, p as PressOptions, r as ElementState, s as FrameOptions, t as ChangesOptions, u as Page, v as ScrollOptions, w as WaitCondition, x as Text, y as State } from "./Page-jHmSJeOS.mjs";
|
|
2
2
|
export { ChangesOptions, ClickOptions, ElementState, Fact, FindQuery, Found, FrameOptions, InputGuard, InputRequest, Page, Point, PressOptions, ReadyOptions, Region, ResolvedTarget, ScreenshotOptions, ScrollOptions, State, Target, Text, TextOptions, TypeOptions, WaitCondition, WindowOptions, Zoom, correlate, failFast, redacted };
|
package/dist/Page.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { c as State, d as correlate, f as failFast, i as InputRequest, l as Text, n as Fact, o as Region, p as redacted, r as Found, s as ResolvedTarget, t as ElementState, u as Zoom } from "./Page-
|
|
1
|
+
import { c as State, d as correlate, f as failFast, i as InputRequest, l as Text, n as Fact, o as Region, p as redacted, r as Found, s as ResolvedTarget, t as ElementState, u as Zoom } from "./Page-C_VkBVwI.mjs";
|
|
2
2
|
export { ElementState, Fact, Found, InputRequest, Region, ResolvedTarget, State, Text, Zoom, correlate, failFast, redacted };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { t as BrowserError } from "./BrowserError-Coy7EW1N.mjs";
|
|
2
|
-
import { b as Subject, i as BrowserEvent } from "./BrowserEvent-
|
|
3
|
-
import { m as ReadyOptions, o as Found, u as Page } from "./Page-
|
|
2
|
+
import { b as Subject, i as BrowserEvent } from "./BrowserEvent-dq6FRT8w.mjs";
|
|
3
|
+
import { m as ReadyOptions, o as Found, u as Page } from "./Page-jHmSJeOS.mjs";
|
|
4
4
|
import { Duration, Effect, Schema } from "effect";
|
|
5
5
|
//#region src/internal/reading/choose.d.ts
|
|
6
6
|
declare const Missing_base: Schema.Class<Missing, Schema.TaggedStruct<"Missing", {}>, import("effect/Cause").YieldableError>;
|
|
@@ -213,4 +213,4 @@ declare const restore: (page: Page, plan: Plan, options?: TakeOptions & {
|
|
|
213
213
|
}) => Effect.Effect<Receipt[], ReplayError, never>;
|
|
214
214
|
//#endregion
|
|
215
215
|
export { take as _, ReplayError as a, Missing as b, StepAction as c, Uncertain as d, fromEvents as f, restore as g, replay as h, Receipt as i, Stopped as l, repeatable as m, Plan as n, ReplayOptions as o, locate as p, Plan_d_exports as r, Step as s, Expected as t, TakeOptions as u, Ambiguous as v, Drifted as y };
|
|
216
|
-
//# sourceMappingURL=Plan-
|
|
216
|
+
//# sourceMappingURL=Plan-DLtRksuu.d.mts.map
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-D7D4PA-g.mjs";
|
|
2
|
+
import { Point } from "./Motion.mjs";
|
|
2
3
|
import { ActionOptions, Box, Subject } from "./BrowserEvent.mjs";
|
|
3
4
|
import { BrowserError, InvalidRequest } from "./BrowserError.mjs";
|
|
4
|
-
import { s as undispatched } from "./context-
|
|
5
|
-
import { p as redacted } from "./Page-
|
|
5
|
+
import { s as undispatched } from "./context-rYTk-3Cv.mjs";
|
|
6
|
+
import { p as redacted } from "./Page-C_VkBVwI.mjs";
|
|
6
7
|
import { t as match } from "./match.inpage-xOe9LNO0.mjs";
|
|
7
8
|
import { Duration, Effect, Exit, Option, Schedule, Schema } from "effect";
|
|
8
9
|
//#region src/internal/reading/choose.ts
|
|
@@ -120,10 +121,6 @@ var Plan_exports = /* @__PURE__ */ __exportAll({
|
|
|
120
121
|
restore: () => restore,
|
|
121
122
|
take: () => take
|
|
122
123
|
});
|
|
123
|
-
const ViewportPoint = Schema.Struct({
|
|
124
|
-
x: Schema.Finite,
|
|
125
|
-
y: Schema.Finite
|
|
126
|
-
});
|
|
127
124
|
const StepAction = Schema.Literals([
|
|
128
125
|
"navigate",
|
|
129
126
|
"back",
|
|
@@ -180,8 +177,8 @@ var Step = class extends Schema.Class("effect-browser/Plan/Step")({
|
|
|
180
177
|
/** Where a drag ended. */
|
|
181
178
|
to: Schema.optional(Subject),
|
|
182
179
|
/** The viewport point a step aimed at, when it aimed at a point, and a drag's end point. */
|
|
183
|
-
point: Schema.optional(
|
|
184
|
-
toPoint: Schema.optional(
|
|
180
|
+
point: Schema.optional(Point),
|
|
181
|
+
toPoint: Schema.optional(Point),
|
|
185
182
|
/** The box of what a step aimed at by point found there, so replay aims at the same place in it. */
|
|
186
183
|
box: Schema.optional(Box),
|
|
187
184
|
/**
|
|
@@ -512,4 +509,4 @@ const restore = (page, plan, options = {}) => run(page, plan, options, 0, option
|
|
|
512
509
|
//#endregion
|
|
513
510
|
export { Drifted as _, ReplayError as a, Stopped as c, locate as d, repeatable as f, Ambiguous as g, take as h, Receipt as i, Uncertain as l, restore as m, Plan as n, Step as o, replay as p, Plan_exports as r, StepAction as s, Expected as t, fromEvents as u, Missing as v };
|
|
514
511
|
|
|
515
|
-
//# sourceMappingURL=Plan-
|
|
512
|
+
//# sourceMappingURL=Plan-X-JkACAB.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Plan-X-JkACAB.mjs","names":["ViewportPoint"],"sources":["../src/internal/reading/choose.ts","../src/Plan.ts"],"sourcesContent":["/**\n * Choosing the one element a recorded subject names, among those `find` gives for its role and\n * name. Context tells them apart, and an element that does not repeat every part of the recorded\n * context is another subject, so a sole element left once its own has gone, such as Alice's\n * \"Remove\" after Bob has left, drifts rather than stands in:\n *\n * - a row is read whole: a row named \"Wrapped BTC\" is not the row \"BTC\". Laid out again without\n * rows, as cards, one of the element's fields must start with the row's words;\n * - a column counts where the element is under one;\n * - a label or heading must read the same, or its words appear, whole and in order, in one of the\n * element's fields, as `near` reads them.\n *\n * The rest are ranked by how much of the recorded context they read the same. There is no\n * ordinal, so a tie stays a tie.\n */\nimport { Effect, Schema } from \"effect\";\n\nimport type { Subject, SubjectContext } from \"../../BrowserEvent.ts\";\nimport type { Found } from \"../../Page.ts\";\nimport { match } from \"./match.inpage.ts\";\n\n/** Nothing on the page has the step's role and name. */\nexport class Missing extends Schema.TaggedError<Missing>()(\"Missing\", {}) {\n override get message() {\n return \"nothing on the page has the recorded role and name\";\n }\n}\n\n/** Several elements match the step's subject equally well, and nothing tells them apart. */\nexport class Ambiguous extends Schema.TaggedError<Ambiguous>()(\"Ambiguous\", {\n count: Schema.Int,\n}) {\n override get message() {\n return `${this.count} elements match the recorded subject equally well`;\n }\n}\n\n/** The page is not where the recording was: another site, or no element with its context. */\nexport class Drifted extends Schema.TaggedError<Drifted>()(\"Drifted\", {\n detail: Schema.String,\n}) {\n override get message() {\n return this.detail;\n }\n}\n\nconst { holds, normalize } = match();\nconst fields = [\"row\", \"column\", \"label\", \"heading\"] as const;\n\nconst said = (context: SubjectContext) =>\n Object.values(context).filter((value) => typeof value === \"string\");\n\n/** How an element repeats one recorded field: 2 read the same, 1 found as words, 0 not at all. */\nconst repeats = (field: (typeof fields)[number], value: string, context: SubjectContext) => {\n const own = context[field];\n\n if (own !== undefined && normalize(own) === normalize(value)) return 2;\n if (field === \"column\") return own === undefined ? 1 : 0;\n if (field === \"row\")\n return own === undefined &&\n said(context).some((other) => `${normalize(other)} `.startsWith(`${normalize(value)} `))\n ? 1\n : 0;\n\n return said(context).some((other) => holds(other, value)) ? 1 : 0;\n};\n\nexport const choose = (\n subject: Subject,\n found: ReadonlyArray<Found>,\n): Effect.Effect<Found, Missing | Ambiguous | Drifted> => {\n // `find` matched the role; a subject without one only matches elements without one.\n const named = found.filter((one) => subject.role !== null || one.subject.role === null);\n\n const kept = named.flatMap((one) => {\n let score = 0;\n\n for (const field of fields) {\n const value = subject.context[field];\n const repeated = value === undefined ? 0 : repeats(field, value, one.subject.context);\n\n if (value !== undefined && repeated === 0) return [];\n score += repeated;\n }\n\n return [{ one, score }];\n });\n\n const best = Math.max(...kept.map(({ score }) => score));\n const top = kept.filter(({ score }) => score === best);\n const [only] = top;\n\n if (named.length === 0) return Effect.fail(new Missing());\n if (kept.length === 0)\n return Effect.fail(new Drifted({ detail: \"no element named so repeats the recorded context\" }));\n\n return top.length === 1 && only !== undefined\n ? Effect.succeed(only.one)\n : Effect.fail(new Ambiguous({ count: top.length }));\n};\n","/**\n * A walk recorded once from a page's events and replayed later, on a fresh page, with no model\n * call.\n *\n * `fromEvents` keeps one page's completed actions with their subjects and the options they were\n * given, its navigations with both the address asked for and the one reached, and what was typed\n * as a named input slot, never the text itself. A navigation to an address whose credentials the\n * events withheld is an input slot too, so replay goes where the caller says, or nowhere, and\n * never to the address without them. `replay` takes the steps in turn. Before a step\n * except an opening navigate, back or reload, it waits for `Page.ready`; then it finds the element its\n * subject names, by role and name among those that repeat all its recorded context, and acts on\n * it. Text typed into focus was typed into the focused field, which replay finds the same way, and\n * text typed into a secret field goes into nothing else. An element step never falls back to\n * coordinates, and a step recorded at a point acts there only while the element found for it still\n * covers that point. `take` and `replay` return receipts; failure preserves a stopping point and\n * earlier receipts. Unknown consequential input is never resent. Only a positive durable read-back\n * can reconcile it; restoration follows the same rule. The consumer journals begun steps before\n * calling, treating interruption or a missing receipt as unknown. Plain recordings use version 1;\n * authored expected effects use version 2. Old 0.2 plans and unknown versions do not decode.\n *\n * @since 0.3.0\n */\nimport { Duration, Effect, Exit, Option, Schedule, Schema } from \"effect\";\n\nimport { BrowserError, InvalidRequest } from \"./BrowserError.ts\";\nimport {\n type Action,\n ActionOptions,\n Box,\n type BrowserEvent,\n type Navigated,\n Subject,\n} from \"./BrowserEvent.ts\";\nimport { undispatched } from \"./internal/page/context.ts\";\nimport { Ambiguous, choose, Drifted, Missing } from \"./internal/reading/choose.ts\";\nimport { Point as ViewportPoint } from \"./Motion.ts\";\nimport {\n type Found,\n type Page,\n type Point,\n type ReadyOptions,\n redacted,\n type Target,\n} from \"./Page.ts\";\n\nexport { Ambiguous, Drifted, Missing } from \"./internal/reading/choose.ts\";\n\nexport const StepAction = Schema.Literals([\n \"navigate\",\n \"back\",\n \"reload\",\n \"click\",\n \"hover\",\n \"drag\",\n \"type\",\n \"press\",\n \"scroll\",\n \"select\",\n]);\n\nexport type StepAction = typeof StepAction.Type;\n\nconst Query = Schema.Struct({\n role: Schema.optional(Schema.String),\n name: Schema.optional(Schema.String),\n text: Schema.optional(Schema.String),\n});\n\n/**\n * What a step leaves. `durable` asserts an author-chosen, lasting read-back of this operation,\n * such as its uniquely named saved receipt or exact operation URL. Only Appeared and an exact\n * Navigated URL allow it; a toast, absence or relative navigation cannot establish recovery.\n * Relative navigation measures observed change from dispatch, without asserting causality.\n */\nexport const Expected = Schema.Union([\n Schema.TaggedStruct(\"Checked\", { checked: Schema.Boolean }),\n Schema.TaggedStruct(\"Appeared\", {\n query: Query,\n durable: Schema.optional(Schema.Literal(true)),\n }),\n Schema.TaggedStruct(\"Gone\", {\n query: Query,\n durable: Schema.optional(Schema.Never),\n }),\n Schema.TaggedStruct(\"Navigated\", {\n url: Schema.String,\n durable: Schema.optional(Schema.Literal(true)),\n }),\n Schema.TaggedStruct(\"Navigated\", {\n url: Schema.optional(Schema.Never),\n durable: Schema.optional(Schema.Never),\n }),\n]);\n\nexport type Expected = typeof Expected.Type;\n\n/** One recorded step: the action, what it acted on, and what else it was asked. */\nexport class Step extends Schema.Class<Step>(\"effect-browser/Plan/Step\")({\n action: StepAction,\n /**\n * The ending address, or a later recorded navigation before the next action began. Empty when\n * unknown; a delayed navigation can be stronger arrival evidence than the action's ending URL.\n */\n url: Schema.String,\n /** A navigation's requested address, or the keys a press pressed. */\n target: Schema.optional(Schema.String),\n subject: Schema.optional(Subject),\n /** Where a drag ended. */\n to: Schema.optional(Subject),\n /** The viewport point a step aimed at, when it aimed at a point, and a drag's end point. */\n point: Schema.optional(ViewportPoint),\n toPoint: Schema.optional(ViewportPoint),\n /** The box of what a step aimed at by point found there, so replay aims at the same place in it. */\n box: Schema.optional(Box),\n /**\n * The input slot whose text a `type` step types, or whose address a `navigate` step goes to, as\n * its recorded address had a credential withheld.\n */\n input: Schema.optional(Schema.String),\n /** The slot's text went into a secret field, so replay types it into nothing else. */\n secret: Schema.optional(Schema.Literal(true)),\n options: Schema.optional(ActionOptions),\n expect: Schema.optional(Expected),\n}) {}\n\nconst PlanData = Schema.Struct({\n version: Schema.Literals([1, 2]),\n steps: Schema.Array(Step),\n}).check(\n Schema.makeFilter((plan) =>\n plan.version === (plan.steps.some((step) => step.expect !== undefined) ? 2 : 1)\n ? undefined\n : \"only plans with expected effects use version 2\",\n ),\n);\n\nexport class Plan extends Schema.Class<Plan>(\"effect-browser/Plan\")(PlanData) {\n /** Choose the encoding version from the steps; simple recordings remain version 1. */\n static new(steps: ReadonlyArray<Step>): Plan {\n return new Plan({ version: steps.some((step) => step.expect !== undefined) ? 2 : 1, steps });\n }\n\n /** The input slots its steps type, in order; replay needs text for each. */\n get inputs(): ReadonlyArray<string> {\n return this.steps.flatMap((step) => (step.input === undefined ? [] : [step.input]));\n }\n}\n\n/** One completed step, on the page's host clock. `verified` means its expected effect was seen. */\nexport class Receipt extends Schema.Class<Receipt>(\"effect-browser/Plan/Receipt\")({\n step: Schema.Int.check(Schema.isGreaterThanOrEqualTo(0)),\n outcome: Schema.Literals([\"taken\", \"verified\", \"skipped\"]),\n startedAt: Schema.Finite,\n at: Schema.Finite,\n}) {}\n\n/** Durable stopping data. A begun step without a receipt must be restored as `unknown`. */\nexport class Stopped extends Schema.Class<Stopped>(\"effect-browser/Plan/Stopped\")({\n step: Schema.Int.check(Schema.isGreaterThanOrEqualTo(0)),\n input: Schema.Literals([\"unsent\", \"unknown\"]),\n}) {}\n\n/** Repeating this step could repeat an unresolved effect; the consumer must reconcile it. */\nexport class Uncertain extends Schema.TaggedError<Uncertain>()(\"Uncertain\", {\n detail: Schema.String,\n}) {\n override get message() {\n return this.detail;\n }\n}\n\n/** Where replay stopped, counting steps from 0, why, and the steps that completed before it. */\nexport class ReplayError extends Schema.TaggedError<ReplayError>()(\"ReplayError\", {\n step: Schema.Int,\n reason: Schema.Union([Missing, Ambiguous, Drifted, BrowserError, Uncertain]),\n input: Schema.Literals([\"unsent\", \"unknown\"]),\n receipts: Schema.Array(Receipt),\n}) {\n get stopped(): Stopped {\n return new Stopped({ step: this.step, input: this.input });\n }\n\n override get message() {\n return `step ${this.step} failed: ${this.reason.message}`;\n }\n}\n\nconst isStep = (event: BrowserEvent): event is Action & { readonly name: StepAction } =>\n event._tag === \"Action\" &&\n event.ok &&\n (StepAction.literals as ReadonlyArray<string>).includes(event.name);\n\n// A point target reads `x,y`, as `{\"x\":…,\"y\":…}` inside a drag's; a ref reads like e12.\nconst pointIn = (target: string | undefined): Point | undefined => {\n const parsed = /^\\{?(?:\"x\":)?(-?[\\d.]+),(?:\"y\":)?(-?[\\d.]+)\\}?$/.exec(target ?? \"\");\n\n return parsed === null ? undefined : { x: Number(parsed[1]), y: Number(parsed[2]) };\n};\n\n/** A slot named for the field it fills, such as `email`, unique within the plan. */\nconst slotFor = (taken: Set<string>, field: string | undefined) => {\n const base =\n field\n ?.toLowerCase()\n .match(/[\\p{L}\\p{N}]+/gu)\n ?.join(\"-\") ?? \"input\";\n\n let slot = base;\n\n for (let count = 2; taken.has(slot); count++) slot = `${base}-${count}`;\n taken.add(slot);\n\n return slot;\n};\n\n/**\n * The walk one page's events record: the completed actions of the page that acted first, in\n * order. `page.recentEvents` gives them, or `browser.events()` read until the walk ends.\n */\nexport const fromEvents = (events: Iterable<BrowserEvent>): Plan => {\n const all = Array.from(events);\n const page = all.find((event) => event._tag === \"Action\")?.page;\n const mine = all.filter((event) => \"page\" in event && event.page === page);\n const steps = mine.filter(isStep);\n const opened = mine.find((event) => event._tag === \"PageOpened\")?.url ?? \"\";\n const moves = mine.filter((event): event is Navigated => event._tag === \"Navigated\");\n const taken = new Set<string>();\n\n // Where the page was just before a time: the last address it reached by then.\n const before = (time: number) => moves.findLast((move) => move.at <= time)?.url ?? opened;\n\n return new Plan({\n version: 1,\n steps: steps.map((action, index) => {\n const drag = action.name === \"drag\" ? (action.target ?? \"\").split(\" -> \") : undefined;\n const point = pointIn(drag === undefined ? action.target : drag[0]);\n const until = steps[index + 1]?.startedAt ?? Number.POSITIVE_INFINITY;\n const arrival = moves.findLast((move) => move.at > action.at && move.at <= until);\n\n // Only a navigation and a press keep their target: an address, or keys.\n return new Step({\n action: action.name,\n url: arrival?.url ?? action.url ?? before(until),\n target: action.name === \"navigate\" || action.name === \"press\" ? action.target : undefined,\n subject: action.subject,\n to: action.to,\n point,\n toPoint: pointIn(drag?.[1]),\n box: point === undefined ? undefined : action.box,\n input:\n action.name === \"type\"\n ? slotFor(taken, action.subject?.name)\n : action.name === \"navigate\" && action.target?.includes(redacted) === true\n ? slotFor(taken, \"address\")\n : undefined,\n secret: action.name === \"type\" && action.text === redacted ? true : undefined,\n options: action.options,\n });\n }),\n });\n};\n\n/**\n * The one element on the page that a subject names, by role, name and context (see `Plan`),\n * looking again for two seconds while the page may still be drawing it.\n */\nexport const locate = (page: Page, subject: Subject) =>\n page\n .find({\n name: subject.name,\n scope: \"document\",\n ...(subject.role === null ? {} : { role: subject.role }),\n })\n .pipe(\n Effect.flatMap((found) => choose(subject, found)),\n Effect.retry({\n schedule: Schedule.spaced(Duration.millis(250)),\n times: 8,\n while: (error) => error._tag !== \"BrowserError\",\n }),\n Effect.withSpan(\"Plan.locate\", { attributes: { role: subject.role ?? \"\" } }),\n );\n\nconst invalid = (detail: string) => undispatched(\"replay\", new InvalidRequest({ detail }));\n\n/**\n * Where the step acts: the element its subject names, or, for a step recorded at a point, the same\n * place within that element, as long as a press there reaches that element and not one over it.\n * An element out of view is first brought into it, by hovering it, as a press by ref would be.\n */\nconst aim = (page: Page, subject: Subject | undefined, point?: Point, recorded?: Box) => {\n if (subject === undefined) return Effect.fail(invalid(\"the step names no element\"));\n if (point === undefined) return Effect.map(locate(page, subject), ({ ref }): Target => ref);\n\n const reach = ({ ref, box }: Found) => {\n const at =\n recorded === undefined || recorded.width <= 0 || recorded.height <= 0\n ? point\n : {\n x: box.x + ((point.x - recorded.x) / recorded.width) * box.width,\n y: box.y + ((point.y - recorded.y) / recorded.height) * box.height,\n };\n\n return Effect.map(page.find({ at }), ([reached]) => (reached?.ref === ref ? at : undefined));\n };\n\n const missed = new Drifted({ detail: \"a press at the subject's point reaches another element\" });\n\n return locate(page, subject).pipe(\n Effect.flatMap((found) =>\n Effect.flatMap(reach(found), (at) =>\n at !== undefined\n ? Effect.succeed<Target>(at)\n : page.hover(found.ref).pipe(\n Effect.andThen(locate(page, subject)),\n Effect.flatMap(reach),\n Effect.flatMap((again) =>\n again === undefined ? Effect.fail(missed) : Effect.succeed<Target>(again),\n ),\n ),\n ),\n ),\n );\n};\n\nconst dispatch = (\n page: Page,\n step: Step,\n text: string,\n): Effect.Effect<void, Missing | Ambiguous | Drifted | BrowserError> => {\n const options = step.options ?? {};\n\n switch (step.action) {\n case \"navigate\":\n return page.goto(step.input === undefined ? (step.target ?? step.url) : text);\n case \"back\":\n return page.back;\n case \"reload\":\n return page.reload;\n case \"press\":\n return step.subject === undefined\n ? page.press(step.target ?? \"\", options)\n : Effect.flatMap(locate(page, step.subject), ({ ref }) =>\n page.press(step.target ?? \"\", { ...options, on: ref }),\n );\n case \"click\":\n return aim(page, step.subject, step.point, step.box).pipe(\n Effect.flatMap((at) => page.click(at, options)),\n Effect.asVoid,\n );\n case \"hover\":\n return Effect.flatMap(aim(page, step.subject, step.point, step.box), page.hover);\n case \"drag\":\n return Effect.all([\n aim(page, step.subject, step.point),\n aim(page, step.to, step.toPoint),\n ]).pipe(Effect.flatMap(([from, to]) => page.drag(from, to)));\n case \"select\":\n return aim(page, step.subject).pipe(\n Effect.flatMap((at) => page.select(typeof at === \"string\" ? at : \"\", options.values ?? [])),\n Effect.asVoid,\n );\n // A scroll or a typing step may name no element: the page, or whatever has focus.\n case \"scroll\":\n return step.subject === undefined\n ? page.scroll(options)\n : Effect.flatMap(aim(page, step.subject, step.point, step.box), (at) =>\n page.scroll({ ...options, at }),\n );\n case \"type\":\n return step.subject === undefined\n ? page.type(text, { ...options, secret: step.secret })\n : Effect.flatMap(aim(page, step.subject), (into) =>\n page.type(text, {\n ...options,\n into: typeof into === \"string\" ? into : undefined,\n secret: step.secret,\n }),\n );\n }\n};\n\nexport interface TakeOptions {\n /** How each step waits first, except an opening navigation, or false. No final-step wait. */\n readonly settle?: ReadyOptions | false | undefined;\n readonly inputs?: Readonly<Record<string, string>> | undefined;\n /**\n * Bound for recorded arrival and expected effect, each. Defaults to 5 seconds. Zero makes one\n * read without polling; that read retains the page operation's timeout.\n */\n readonly arrival?: Duration.Input | undefined;\n}\n\nexport interface ReplayOptions extends TakeOptions {\n readonly from?: number | Stopped | undefined;\n}\n\n/**\n * Input that can be repeated without repeating a commitment. `take` also validates a Checked\n * target's boolean state before input. Back/reload can resubmit a form.\n */\nexport const repeatable = (step: Step): boolean =>\n [\"navigate\", \"hover\", \"scroll\", \"select\"].includes(step.action) ||\n (step.action === \"type\" &&\n step.subject !== undefined &&\n step.options?.replace !== false &&\n step.options?.submit !== true) ||\n (step.action === \"click\" && step.expect?._tag === \"Checked\");\n\ntype StepError = Missing | Ambiguous | Drifted | BrowserError | Uncertain;\n\n// Zero waits make one read; positive waits bound all reads and never repeat input.\nconst within = (check: Effect.Effect<boolean, StepError>, millis: number) =>\n millis === 0\n ? check\n : check.pipe(\n Effect.repeat({ until: (held) => held, schedule: Schedule.spaced(Duration.millis(25)) }),\n Effect.timeoutOrElse({\n duration: Duration.millis(millis),\n orElse: () => Effect.succeed(false),\n }),\n );\n\nconst sameSite = (url: string, recorded: string) => {\n const origin = URL.parse(recorded)?.origin;\n\n return (\n recorded === \"\" ||\n (origin === undefined || origin === \"null\"\n ? url === recorded\n : URL.parse(url)?.origin === origin)\n );\n};\n\nconst arrived = (page: Page, urls: ReadonlyArray<string>, millis: number) =>\n within(\n Effect.map(page.url, (url) => urls.some((recorded) => sameSite(url, recorded))),\n millis,\n ).pipe(\n Effect.filterOrFail(\n (held) => held,\n () =>\n new Drifted({ detail: \"the page did not reach the recorded site within the arrival wait\" }),\n ),\n Effect.asVoid,\n );\n\nconst checkEffect = (\n page: Page,\n step: Step,\n first?: { readonly url: string; readonly document: number },\n) => {\n const expected = step.expect;\n\n if (expected === undefined) return Effect.succeed(false);\n switch (expected._tag) {\n case \"Checked\":\n return step.subject === undefined\n ? Effect.fail(invalid(\"a checked effect needs a subject\"))\n : Effect.flatMap(locate(page, step.subject), (found) =>\n found.state.checked === undefined\n ? Effect.fail(invalid(\"a checked effect needs a checkable subject\"))\n : Effect.succeed(found.state.checked === expected.checked),\n );\n case \"Navigated\":\n if (expected.url === undefined && first === undefined) return Effect.succeed(false);\n\n return Effect.map(page.state, (now) =>\n expected.url === undefined\n ? now.url !== first?.url || now.document !== first?.document\n : now.url === expected.url,\n );\n case \"Appeared\":\n case \"Gone\":\n return Effect.map(page.find({ ...expected.query, scope: \"document\" }), (found) =>\n expected._tag === \"Appeared\" ? found.length > 0 : found.length === 0,\n );\n }\n};\n\n/**\n * Take one step. Unknown non-repeatable input is never resent: only positive durable read-back\n * can skip it. An interrupted call remains interrupted; persist begun-before-call in the consumer\n * and treat a missing receipt as Stopped{input: \"unknown\"}, including after process restart.\n */\nexport const take = Effect.fn(\"Plan.take\")(function* (\n page: Page,\n plan: Plan,\n at: number | Stopped,\n options: TakeOptions = {},\n): Effect.fn.Return<Receipt, ReplayError> {\n const index = typeof at === \"number\" ? at : at.step;\n let input: Stopped[\"input\"] = typeof at === \"number\" ? \"unsent\" : at.input;\n\n const work = Effect.gen(function* (): Effect.fn.Return<Receipt, StepError> {\n const step = plan.steps[index];\n\n if (!Number.isInteger(index) || index < 0 || step === undefined)\n return yield* invalid(\"the step index is outside the plan\");\n const duration = Duration.fromInput(options.arrival ?? Duration.seconds(5));\n\n if (\n Option.isNone(duration) ||\n Duration.isNegative(duration.value) ||\n !Duration.isFinite(duration.value)\n )\n return yield* invalid(\"arrival must be a finite nonnegative duration\");\n const millis = Duration.toMillis(duration.value);\n const first = yield* page.state;\n\n const uncertain = new Uncertain({\n detail: \"the step may have been sent; reconcile its durable effect before continuing\",\n });\n\n const unresolved = input === \"unknown\" && !repeatable(step);\n const expected = step.expect;\n\n const durable =\n expected !== undefined &&\n (expected._tag === \"Appeared\" ||\n (expected._tag === \"Navigated\" && typeof expected.url === \"string\")) &&\n expected.durable === true;\n\n if (\n !durable &&\n (unresolved || (expected !== undefined && \"durable\" in expected && expected.durable === true))\n )\n return yield* uncertain;\n if (\n options.settle !== false &&\n (index > 0 || ![\"navigate\", \"back\", \"reload\"].includes(step.action))\n )\n yield* page.ready(options.settle);\n const before = plan.steps[index - 1]?.url;\n\n if (before !== undefined)\n yield* arrived(page, unresolved ? [before, step.url] : [before], millis);\n const check = checkEffect(page, step);\n\n const read =\n millis === 0\n ? check\n : check.pipe(\n Effect.timeoutOrElse({\n duration: Duration.millis(millis),\n orElse: () =>\n Effect.fail(new Drifted({ detail: \"the expected-effect read timed out\" })),\n }),\n );\n\n const held = yield* read.pipe(Effect.mapError((error) => (unresolved ? uncertain : error)));\n\n const receipt = (outcome: Receipt[\"outcome\"]) =>\n Effect.gen(function* () {\n yield* arrived(page, [step.url], millis);\n const now = yield* page.state;\n\n return new Receipt({ step: index, outcome, startedAt: first.at, at: now.at });\n });\n\n if (held) return yield* receipt(\"skipped\");\n if (unresolved) return yield* uncertain;\n const text = step.input === undefined ? \"\" : options.inputs?.[step.input];\n\n if (text === undefined) return yield* invalid(`no text for the input \"${step.input ?? \"\"}\"`);\n const verify = checkEffect(page, step, yield* page.state);\n const acted = yield* Effect.exit(dispatch(page, step, text));\n\n if (Exit.isFailure(acted)) {\n const error = Exit.findErrorOption(acted);\n\n if (Option.isSome(error) && error.value._tag === \"BrowserError\" && error.value.dispatched) {\n input = \"unknown\";\n if (expected !== undefined && (repeatable(step) || durable)) {\n const observed = yield* Effect.exit(within(verify, millis));\n\n if (Exit.isSuccess(observed) && observed.value) return yield* receipt(\"verified\");\n }\n }\n\n return yield* Effect.failCause(acted.cause);\n }\n input = \"unknown\";\n if (expected !== undefined && !(yield* within(verify, millis)))\n return yield* new Drifted({ detail: \"the step's expected effect did not arrive\" });\n\n return yield* receipt(expected === undefined ? \"taken\" : \"verified\");\n });\n\n return yield* work.pipe(\n Effect.mapError(\n (reason) =>\n new ReplayError({\n step: index,\n reason,\n input,\n receipts: [],\n }),\n ),\n );\n});\n\nconst run = Effect.fnUntraced(function* (\n page: Page,\n plan: Plan,\n options: TakeOptions,\n from: number | Stopped,\n until: number,\n restoring: boolean,\n) {\n const receipts: Array<Receipt> = [];\n const start = typeof from === \"number\" ? from : from.step;\n\n if (\n !Number.isInteger(start) ||\n start < 0 ||\n start > plan.steps.length ||\n !Number.isInteger(until) ||\n until < start ||\n until > plan.steps.length\n )\n return yield* new ReplayError({\n step: start,\n input: \"unsent\",\n receipts,\n reason: invalid(\"the run bounds are outside the plan\"),\n });\n // Fresh runs still ask for all input slots before changing the page. Restoration checks first.\n if (!restoring && typeof from === \"number\") {\n const unfilled = plan.steps.findIndex(\n (step, index) =>\n index >= start && step.input !== undefined && options.inputs?.[step.input] === undefined,\n );\n\n if (unfilled !== -1)\n return yield* new ReplayError({\n step: start,\n input: \"unsent\",\n receipts,\n reason: invalid(`no text for the input \"${plan.steps[unfilled]?.input ?? \"\"}\"`),\n });\n }\n for (let index = start; index < until; index++) {\n const at = restoring\n ? new Stopped({ step: index, input: \"unknown\" })\n : index === start\n ? from\n : index;\n\n const receipt = yield* take(page, plan, at, options).pipe(\n Effect.mapError((error) => new ReplayError({ ...error, receipts: [...receipts] })),\n );\n\n receipts.push(receipt);\n }\n\n return receipts;\n});\n\n/** Take a plan's steps from a fresh index or durable stopping point, returning completed receipts. */\nexport const replay = (page: Page, plan: Plan, options: ReplayOptions = {}) =>\n run(page, plan, options, options.from ?? 0, plan.steps.length, false).pipe(\n Effect.withSpan(\"Plan.replay\"),\n );\n\n/** Restore prior steps on a fresh page; unresolved commitments require positive durable evidence. */\nexport const restore = (\n page: Page,\n plan: Plan,\n options: TakeOptions & { readonly upTo?: number | undefined } = {},\n) =>\n run(page, plan, options, 0, options.upTo ?? plan.steps.length, true).pipe(\n Effect.withSpan(\"Plan.restore\"),\n );\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAsBA,IAAa,UAAb,cAA6B,OAAO,YAAqB,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC;CACxE,IAAa,UAAU;EACrB,OAAO;CACT;AACF;;AAGA,IAAa,YAAb,cAA+B,OAAO,YAAuB,CAAC,CAAC,aAAa,EAC1E,OAAO,OAAO,IAChB,CAAC,CAAC,CAAC;CACD,IAAa,UAAU;EACrB,OAAO,GAAG,KAAK,MAAM;CACvB;AACF;;AAGA,IAAa,UA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BAA0B,KAAK,MAAM,SAAS,EAAE,SAAS,GAAG,EAAE;EAChF,CAAC;CACL;CACA,KAAK,IAAI,QAAQ,OAAO,QAAQ,OAAO,SAAS;EAC9C,MAAM,KAAK,YACP,IAAI,QAAQ;GAAE,MAAM;GAAO,OAAO;EAAU,CAAC,IAC7C,UAAU,QACR,OACA;EAEN,MAAM,UAAU,OAAO,KAAK,MAAM,MAAM,IAAI,OAAO,CAAC,CAAC,KACnD,OAAO,UAAU,UAAU,IAAI,YAAY;GAAE,GAAG;GAAO,UAAU,CAAC,GAAG,QAAQ;EAAE,CAAC,CAAC,CACnF;EAEA,SAAS,KAAK,OAAO;CACvB;CAEA,OAAO;AACT,CAAC;;AAGD,MAAa,UAAU,MAAY,MAAY,UAAyB,CAAC,MACvE,IAAI,MAAM,MAAM,SAAS,QAAQ,QAAQ,GAAG,KAAK,MAAM,QAAQ,KAAK,CAAC,CAAC,KACpE,OAAO,SAAS,aAAa,CAC/B;;AAGF,MAAa,WACX,MACA,MACA,UAAgE,CAAC,MAEjE,IAAI,MAAM,MAAM,SAAS,GAAG,QAAQ,QAAQ,KAAK,MAAM,QAAQ,IAAI,CAAC,CAAC,KACnE,OAAO,SAAS,cAAc,CAChC"}
|
package/dist/Plan.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { _ as take, a as ReplayError, b as Missing, c as StepAction, d as Uncertain, f as fromEvents, g as restore, h as replay, i as Receipt, l as Stopped, m as repeatable, n as Plan, o as ReplayOptions, p as locate, s as Step, t as Expected, u as TakeOptions, v as Ambiguous, y as Drifted } from "./Plan-
|
|
1
|
+
import { _ as take, a as ReplayError, b as Missing, c as StepAction, d as Uncertain, f as fromEvents, g as restore, h as replay, i as Receipt, l as Stopped, m as repeatable, n as Plan, o as ReplayOptions, p as locate, s as Step, t as Expected, u as TakeOptions, v as Ambiguous, y as Drifted } from "./Plan-DLtRksuu.mjs";
|
|
2
2
|
export { Ambiguous, Drifted, Expected, Missing, Plan, Receipt, ReplayError, ReplayOptions, Step, StepAction, Stopped, TakeOptions, Uncertain, fromEvents, locate, repeatable, replay, restore, take };
|
package/dist/Plan.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { _ as Drifted, a as ReplayError, c as Stopped, d as locate, f as repeatable, g as Ambiguous, h as take, i as Receipt, l as Uncertain, m as restore, n as Plan, o as Step, p as replay, s as StepAction, t as Expected, u as fromEvents, v as Missing } from "./Plan-
|
|
1
|
+
import { _ as Drifted, a as ReplayError, c as Stopped, d as locate, f as repeatable, g as Ambiguous, h as take, i as Receipt, l as Uncertain, m as restore, n as Plan, o as Step, p as replay, s as StepAction, t as Expected, u as fromEvents, v as Missing } from "./Plan-X-JkACAB.mjs";
|
|
2
2
|
export { Ambiguous, Drifted, Expected, Missing, Plan, Receipt, ReplayError, Step, StepAction, Stopped, Uncertain, fromEvents, locate, repeatable, replay, restore, take };
|
package/dist/Policy.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { c as InputGuard, i as Fact, l as InputRequest } from "./Page-
|
|
1
|
+
import { c as InputGuard, i as Fact, l as InputRequest } from "./Page-jHmSJeOS.mjs";
|
|
2
2
|
import { Context, Duration, Effect, Schema } from "effect";
|
|
3
3
|
import { AiError, DecisionModel, LanguageModel } from "effect/ai";
|
|
4
4
|
declare namespace Policy_d_exports {
|
package/dist/Policy.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-D7D4PA-g.mjs";
|
|
2
2
|
import { PolicyDenied } from "./BrowserError.mjs";
|
|
3
|
-
import { i as InputRequest, n as Fact } from "./Page-
|
|
3
|
+
import { i as InputRequest, n as Fact } from "./Page-C_VkBVwI.mjs";
|
|
4
4
|
import { Cause, Context, Duration, Effect, Record, Result, Schema } from "effect";
|
|
5
5
|
import { Decision, DecisionModel, LanguageModel, Prompt } from "effect/ai";
|
|
6
6
|
//#region src/Policy.ts
|
package/dist/Presentation.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { b as Target, u as Page } from "./Page-
|
|
2
|
-
import { Service, t as Motion_d_exports } from "./Motion.mjs";
|
|
1
|
+
import { b as Target, u as Page } from "./Page-jHmSJeOS.mjs";
|
|
2
|
+
import { a as Service, t as Motion_d_exports } from "./Motion-DND6I-64.mjs";
|
|
3
3
|
import { Duration, Effect } from "effect";
|
|
4
4
|
declare namespace Presentation_d_exports {
|
|
5
5
|
export { Options, Pacing, Presenter, View, human, make };
|
package/dist/Presentation.mjs
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-D7D4PA-g.mjs";
|
|
2
2
|
import { lognormal } from "./Motion.mjs";
|
|
3
|
-
import {
|
|
3
|
+
import { u as monotonicMillis } from "./context-rYTk-3Cv.mjs";
|
|
4
|
+
import { a as performed, i as pause, r as viewOf, t as internalsOf } from "./page-ClEMFnBG.mjs";
|
|
4
5
|
import { Clock, Duration, Effect, Fiber, MutableRef, Option, Semaphore } from "effect";
|
|
5
6
|
//#region src/Presentation.ts
|
|
6
7
|
/**
|
|
@@ -45,7 +46,7 @@ const make = Effect.fn("Presentation.make")(function* (options = {}) {
|
|
|
45
46
|
const pacing = options.pacing ?? human;
|
|
46
47
|
const clock = yield* Clock.Clock;
|
|
47
48
|
const scope = yield* Effect.scope;
|
|
48
|
-
const now = () =>
|
|
49
|
+
const now = () => monotonicMillis(clock);
|
|
49
50
|
const pointer = MutableRef.make(Option.none());
|
|
50
51
|
const hand = yield* Semaphore.make(1);
|
|
51
52
|
const style = performed({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Presentation.mjs","names":["Style.performed","Motion.lognormal","Style.pause"],"sources":["../src/Presentation.ts"],"sourcesContent":["/**\n * Input performed for viewers. A presenter owns one drawn pointer and a pace; `view(page)` is the\n * page with its actions performed: each waits as long as a person reacts, the pointer glides from\n * where viewers last saw it, on whichever page, a field is clicked before typing, keys go at the\n * pace's words a minute and the wheel turns in bursts, out to a target out of view. One view acts at\n * a time, as one hand moves one pointer, and its presentation time is outside `actionTimeout`. The\n * page itself stays plain, and plain input never waits for a view.\n *\n * ```ts\n * const presenter = yield* Presentation.make({ motion: yield* HumanStrokes.motion })\n * const performed = presenter.view(page)\n * yield* performed.aim(\"e12\") // as the target appears in a streamed tool call\n * yield* performed.click(\"e12\") // completes the glide, then clicks\n * ```\n *\n * @since 0.3.0\n */\nimport { Clock, Duration, Effect, Fiber, MutableRef, Option, Semaphore } from \"effect\";\n\nimport type { BrowserError } from \"./BrowserError.ts\";\nimport * as Style from \"./internal/input/style.ts\";\nimport { type Internals, internalsOf, viewOf } from \"./internal/page/page.ts\";\nimport * as Motion from \"./Motion.ts\";\nimport type { Page, Point, Target } from \"./Page.ts\";\n\n/** How long a person waits before acting, and how fast they type. */\nexport interface Pacing {\n /** The usual wait before an action that follows an expected change, as the next field of a form. */\n readonly expected: Duration.Input;\n /** The usual wait after the page moved to a new document. */\n readonly surprise: Duration.Input;\n /** The usual wait before a page's first action, or one after an action on another page. */\n readonly unrelated: Duration.Input;\n /** Typing speed, a word being five characters. */\n readonly wordsPerMinute: number;\n}\n\n/**\n * The research's medians: 280 ms to react to an expected change, 600 ms to a surprise and 1 second\n * between unrelated actions, each drawn around its median, and typing at 70 words per minute.\n */\nexport const human: Pacing = {\n expected: \"280 millis\",\n surprise: \"600 millis\",\n unrelated: \"1 second\",\n wordsPerMinute: 70,\n};\n\nexport interface Options {\n /** Defaults to `human`. */\n readonly pacing?: Pacing | undefined;\n /** The pointer's paths. Defaults to `Motion.lognormal`. */\n readonly motion?: Motion.Service | undefined;\n}\n\n/** A page whose actions are performed, which can also start the pointer toward a target early. */\nexport interface View extends Page {\n /**\n * Start the glide toward `target` as soon as it is known, as in a model's streamed tool call. The\n * next action waits for it when it acts on the same target, and otherwise stops it where it is.\n * An aim presses nothing and records no action; under an input guard it does nothing.\n */\n readonly aim: (target: Target) => Effect.Effect<void>;\n}\n\nexport interface Presenter {\n /** `page`, a page a `Browser` opened, with its actions performed: the same view for the same page. */\n readonly view: (page: Page) => View;\n}\n\n// Reactions spread as the research measured them: an expected change least.\nconst spread = { expected: 0.3, surprise: 0.4, unrelated: 0.4 };\n\nconst sameTarget = (left: Target, right: Target | undefined) =>\n typeof left === \"string\" || typeof right !== \"object\"\n ? left === right\n : left.x === right.x && left.y === right.y;\n\n/** A presenter, for the scope: its pointer, its pace and the aims it has started. */\nexport const make = Effect.fn(\"Presentation.make\")(function* (options: Options = {}) {\n const pacing = options.pacing ?? human;\n const clock = yield* Clock.Clock;\n const scope = yield* Effect.scope;\n const now = () => Number(clock.monotonicTimeNanosUnsafe()) / 1e6;\n const pointer = MutableRef.make(Option.none<Point>());\n const hand = yield* Semaphore.make(1);\n\n const style = Style.performed({\n pointer,\n motion: options.motion ?? Motion.lognormal,\n wordsPerMinute: pacing.wordsPerMinute,\n });\n\n const medians = {\n expected: Duration.toMillis(Duration.fromInputUnsafe(pacing.expected)),\n surprise: Duration.toMillis(Duration.fromInputUnsafe(pacing.surprise)),\n unrelated: Duration.toMillis(Duration.fromInputUnsafe(pacing.unrelated)),\n };\n\n // The latest performed action: its page, the document it began in, and when it ended.\n let last: { readonly page: string; readonly document: number; readonly at: number } | undefined;\n\n // A person reacts to what the last action left: an expected change, a new document, as a link\n // opens, or another page altogether. Time already spent since it ended counts toward the wait.\n const react = (page: Page, internals: Internals) =>\n Effect.gen(function* () {\n const kind =\n last === undefined || last.page !== page.id\n ? \"unrelated\"\n : last.document === internals.document()\n ? \"expected\"\n : \"surprise\";\n\n const left = (last?.at ?? now()) + (yield* Style.pause(medians[kind], spread[kind])) - now();\n\n if (left > 0) yield* Effect.sleep(Duration.millis(left));\n }).pipe(Effect.provideService(Clock.Clock, clock));\n\n const views = new WeakMap<Page, View>();\n\n const view = (page: Page): View => {\n const known = views.get(page);\n\n if (known !== undefined) return known;\n const internals = internalsOf(page);\n\n if (internals === undefined)\n throw new TypeError(\"only a page that a Browser opened can be presented\");\n const { input } = internals;\n\n let aiming:\n | { readonly target: Target; readonly fiber: Fiber.Fiber<void, BrowserError> }\n | undefined;\n\n // An aim at the action's own target is completed; any other is stopped where it is.\n const completeAim = (target: Target | undefined) =>\n Effect.suspend(() => {\n const current = aiming;\n\n aiming = undefined;\n if (current === undefined) return Effect.void;\n\n return sameTarget(current.target, target)\n ? Effect.asVoid(Fiber.await(current.fiber))\n : Fiber.interrupt(current.fiber);\n });\n\n const perform =\n (target: Target | undefined) =>\n <A, E>(action: Effect.Effect<A, E>): Effect.Effect<A, E> =>\n completeAim(target).pipe(\n Effect.andThen(\n hand.withPermits(1)(\n Effect.gen(function* () {\n yield* react(page, internals);\n const document = internals.document();\n\n return yield* action.pipe(\n Effect.ensuring(\n Effect.sync(() => {\n last = { page: page.id, document, at: now() };\n }),\n ),\n );\n }),\n ),\n ),\n );\n\n const performed: View = viewOf(page, {\n ...page,\n click: (target, clickOptions) => perform(target)(input.click(target, clickOptions, style)),\n hover: (target) => perform(target)(input.hover(target, style)),\n drag: (from, to) => perform(from)(input.drag(from, to, style)),\n type: (text, typeOptions) => perform(typeOptions?.into)(input.type(text, typeOptions, style)),\n press: (keys, pressOptions) => perform(undefined)(input.press(keys, pressOptions, style)),\n scroll: (scrollOptions) => perform(scrollOptions?.at)(input.scroll(scrollOptions, style)),\n select: (ref, values) => perform(ref)(input.select(ref, values)),\n aim: (target) =>\n Effect.gen(function* () {\n yield* completeAim(undefined);\n aiming = {\n target,\n fiber: yield* hand.withPermits(1)(input.aim(target, style)).pipe(Effect.forkIn(scope)),\n };\n }),\n });\n\n views.set(page, performed);\n\n return performed;\n };\n\n return { view } satisfies Presenter;\n});\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyCA,MAAa,QAAgB;CAC3B,UAAU;CACV,UAAU;CACV,WAAW;CACX,gBAAgB;AAClB;AAyBA,MAAM,SAAS;CAAE,UAAU;CAAK,UAAU;CAAK,WAAW;AAA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kBAAkB,QAAQ,eAAe,EAAE,CAAC,CAAC,MAAM,OAAO,eAAe,KAAK,CAAC;GACxF,SAAS,KAAK,WAAW,QAAQ,GAAG,CAAC,CAAC,MAAM,OAAO,KAAK,MAAM,CAAC;GAC/D,MAAM,WACJ,OAAO,IAAI,aAAa;IACtB,OAAO,YAAY,KAAA,CAAS;IAC5B,SAAS;KACP;KACA,OAAO,OAAO,KAAK,YAAY,CAAC,CAAC,CAAC,MAAM,IAAI,QAAQ,KAAK,CAAC,CAAC,CAAC,KAAK,OAAO,OAAO,KAAK,CAAC;IACvF;GACF,CAAC;EACL,CAAC;EAED,MAAM,IAAI,MAAM,SAAS;EAEzB,OAAO;CACT;CAEA,OAAO,EAAE,KAAK;AAChB,CAAC"}
|
|
1
|
+
{"version":3,"file":"Presentation.mjs","names":["Style.performed","Motion.lognormal","Style.pause"],"sources":["../src/Presentation.ts"],"sourcesContent":["/**\n * Input performed for viewers. A presenter owns one drawn pointer and a pace; `view(page)` is the\n * page with its actions performed: each waits as long as a person reacts, the pointer glides from\n * where viewers last saw it, on whichever page, a field is clicked before typing, keys go at the\n * pace's words a minute and the wheel turns in bursts, out to a target out of view. One view acts at\n * a time, as one hand moves one pointer, and its presentation time is outside `actionTimeout`. The\n * page itself stays plain, and plain input never waits for a view.\n *\n * ```ts\n * const presenter = yield* Presentation.make({ motion: yield* HumanStrokes.motion })\n * const performed = presenter.view(page)\n * yield* performed.aim(\"e12\") // as the target appears in a streamed tool call\n * yield* performed.click(\"e12\") // completes the glide, then clicks\n * ```\n *\n * @since 0.3.0\n */\nimport { Clock, Duration, Effect, Fiber, MutableRef, Option, Semaphore } from \"effect\";\n\nimport type { BrowserError } from \"./BrowserError.ts\";\nimport * as Style from \"./internal/input/style.ts\";\nimport { type Internals, internalsOf, viewOf } from \"./internal/page/page.ts\";\nimport { monotonicMillis } from \"./internal/pictures/clock.ts\";\nimport * as Motion from \"./Motion.ts\";\nimport type { Page, Point, Target } from \"./Page.ts\";\n\n/** How long a person waits before acting, and how fast they type. */\nexport interface Pacing {\n /** The usual wait before an action that follows an expected change, as the next field of a form. */\n readonly expected: Duration.Input;\n /** The usual wait after the page moved to a new document. */\n readonly surprise: Duration.Input;\n /** The usual wait before a page's first action, or one after an action on another page. */\n readonly unrelated: Duration.Input;\n /** Typing speed, a word being five characters. */\n readonly wordsPerMinute: number;\n}\n\n/**\n * The research's medians: 280 ms to react to an expected change, 600 ms to a surprise and 1 second\n * between unrelated actions, each drawn around its median, and typing at 70 words per minute.\n */\nexport const human: Pacing = {\n expected: \"280 millis\",\n surprise: \"600 millis\",\n unrelated: \"1 second\",\n wordsPerMinute: 70,\n};\n\nexport interface Options {\n /** Defaults to `human`. */\n readonly pacing?: Pacing | undefined;\n /** The pointer's paths. Defaults to `Motion.lognormal`. */\n readonly motion?: Motion.Service | undefined;\n}\n\n/** A page whose actions are performed, which can also start the pointer toward a target early. */\nexport interface View extends Page {\n /**\n * Start the glide toward `target` as soon as it is known, as in a model's streamed tool call. The\n * next action waits for it when it acts on the same target, and otherwise stops it where it is.\n * An aim presses nothing and records no action; under an input guard it does nothing.\n */\n readonly aim: (target: Target) => Effect.Effect<void>;\n}\n\nexport interface Presenter {\n /** `page`, a page a `Browser` opened, with its actions performed: the same view for the same page. */\n readonly view: (page: Page) => View;\n}\n\n// Reactions spread as the research measured them: an expected change least.\nconst spread = { expected: 0.3, surprise: 0.4, unrelated: 0.4 };\n\nconst sameTarget = (left: Target, right: Target | undefined) =>\n typeof left === \"string\" || typeof right !== \"object\"\n ? left === right\n : left.x === right.x && left.y === right.y;\n\n/** A presenter, for the scope: its pointer, its pace and the aims it has started. */\nexport const make = Effect.fn(\"Presentation.make\")(function* (options: Options = {}) {\n const pacing = options.pacing ?? human;\n const clock = yield* Clock.Clock;\n const scope = yield* Effect.scope;\n const now = () => monotonicMillis(clock);\n const pointer = MutableRef.make(Option.none<Point>());\n const hand = yield* Semaphore.make(1);\n\n const style = Style.performed({\n pointer,\n motion: options.motion ?? Motion.lognormal,\n wordsPerMinute: pacing.wordsPerMinute,\n });\n\n const medians = {\n expected: Duration.toMillis(Duration.fromInputUnsafe(pacing.expected)),\n surprise: Duration.toMillis(Duration.fromInputUnsafe(pacing.surprise)),\n unrelated: Duration.toMillis(Duration.fromInputUnsafe(pacing.unrelated)),\n };\n\n // The latest performed action: its page, the document it began in, and when it ended.\n let last: { readonly page: string; readonly document: number; readonly at: number } | undefined;\n\n // A person reacts to what the last action left: an expected change, a new document, as a link\n // opens, or another page altogether. Time already spent since it ended counts toward the wait.\n const react = (page: Page, internals: Internals) =>\n Effect.gen(function* () {\n const kind =\n last === undefined || last.page !== page.id\n ? \"unrelated\"\n : last.document === internals.document()\n ? \"expected\"\n : \"surprise\";\n\n const left = (last?.at ?? now()) + (yield* Style.pause(medians[kind], spread[kind])) - now();\n\n if (left > 0) yield* Effect.sleep(Duration.millis(left));\n }).pipe(Effect.provideService(Clock.Clock, clock));\n\n const views = new WeakMap<Page, View>();\n\n const view = (page: Page): View => {\n const known = views.get(page);\n\n if (known !== undefined) return known;\n const internals = internalsOf(page);\n\n if (internals === undefined)\n throw new TypeError(\"only a page that a Browser opened can be presented\");\n const { input } = internals;\n\n let aiming:\n | { readonly target: Target; readonly fiber: Fiber.Fiber<void, BrowserError> }\n | undefined;\n\n // An aim at the action's own target is completed; any other is stopped where it is.\n const completeAim = (target: Target | undefined) =>\n Effect.suspend(() => {\n const current = aiming;\n\n aiming = undefined;\n if (current === undefined) return Effect.void;\n\n return sameTarget(current.target, target)\n ? Effect.asVoid(Fiber.await(current.fiber))\n : Fiber.interrupt(current.fiber);\n });\n\n const perform =\n (target: Target | undefined) =>\n <A, E>(action: Effect.Effect<A, E>): Effect.Effect<A, E> =>\n completeAim(target).pipe(\n Effect.andThen(\n hand.withPermits(1)(\n Effect.gen(function* () {\n yield* react(page, internals);\n const document = internals.document();\n\n return yield* action.pipe(\n Effect.ensuring(\n Effect.sync(() => {\n last = { page: page.id, document, at: now() };\n }),\n ),\n );\n }),\n ),\n ),\n );\n\n const performed: View = viewOf(page, {\n ...page,\n click: (target, clickOptions) => perform(target)(input.click(target, clickOptions, style)),\n hover: (target) => perform(target)(input.hover(target, style)),\n drag: (from, to) => perform(from)(input.drag(from, to, style)),\n type: (text, typeOptions) => perform(typeOptions?.into)(input.type(text, typeOptions, style)),\n press: (keys, pressOptions) => perform(undefined)(input.press(keys, pressOptions, style)),\n scroll: (scrollOptions) => perform(scrollOptions?.at)(input.scroll(scrollOptions, style)),\n select: (ref, values) => perform(ref)(input.select(ref, values)),\n aim: (target) =>\n Effect.gen(function* () {\n yield* completeAim(undefined);\n aiming = {\n target,\n fiber: yield* hand.withPermits(1)(input.aim(target, style)).pipe(Effect.forkIn(scope)),\n };\n }),\n });\n\n views.set(page, performed);\n\n return performed;\n };\n\n return { view } satisfies Presenter;\n});\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0CA,MAAa,QAAgB;CAC3B,UAAU;CACV,UAAU;CACV,WAAW;CACX,gBAAgB;AAClB;AAyBA,MAAM,SAAS;CAAE,UAAU;CAAK,UAAU;CAAK,WAAW;AAAI;AAE9D,MAAM,cAAc,MAAc,UAChC,OAAO,SAAS,YAAY,OAAO,UAAU,WACzC,SAAS,QACT,KAAK,MAAM,MAAM,KAAK,KAAK,MAAM,MAAM;;AAG7C,MAAa,OAAO,OAAO,GAAG,mBAAmB,CAAC,CAAC,WAAW,UAAmB,CAAC,GAAG;CACnF,MAAM,SAAS,QAAQ,UAAU;CACjC,MAAM,QAAQ,OAAO,MAAM;CAC3B,MAAM,QAAQ,OAAO,OAAO;CAC5B,MAAM,YAAY,gBAAgB,KAAK;CACvC,MAAM,UAAU,WAAW,KAAK,OAAO,KAAY,CAAC;CACpD,MAAM,OAAO,OAAO,UAAU,KAAK,CAAC;CAEpC,MAAM,QAAQA,UAAgB;EAC5B;EACA,QAAQ,QAAQ,UAAUC;EAC1B,gBAAgB,OAAO;CACzB,CAAC;CAED,MAAM,UAAU;EACd,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