niceeval 0.13.0 → 0.13.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.cjs +10 -1
- package/dist/cli.cjs.map +1 -1
- package/dist/report/execution/machine.cjs +1 -1
- package/dist/report/execution/machine.cjs.map +1 -1
- package/dist/report/host/execute.cjs +14 -4
- package/dist/report/host/execute.cjs.map +1 -1
- package/dist/report/host/execute.d.cts +5 -0
- package/dist/report/host/execute.d.mts +5 -0
- package/dist/report/host/execute.d.ts +5 -0
- package/dist/report/host/from-record.cjs +6 -1
- package/dist/report/host/from-record.cjs.map +1 -1
- package/dist/report/host/from-record.d.cts +5 -0
- package/dist/report/host/from-record.d.mts +5 -0
- package/dist/report/host/from-record.d.ts +5 -0
- package/dist/report/runtime/resolved-page.cjs +16 -6
- package/dist/report/runtime/resolved-page.cjs.map +1 -1
- package/dist/report/runtime/resolved-page.d.cts +3 -0
- package/dist/report/runtime/resolved-page.d.mts +3 -0
- package/dist/report/runtime/resolved-page.d.ts +3 -0
- package/dist/report/runtime/text.cjs +1 -0
- package/dist/report/runtime/text.cjs.map +1 -1
- package/dist/report/runtime/text.d.cts +4 -0
- package/dist/report/runtime/text.d.mts +4 -0
- package/dist/report/runtime/text.d.ts +4 -0
- package/docs-site/zh/explanation/runner.mdx +2 -2
- package/docs-site/zh/index.mdx +2 -2
- package/docs-site/zh/reference/cli.mdx +14 -14
- package/docs-site/zh/reference/events.mdx +1 -1
- package/docs-site/zh/troubleshooting/debugging.mdx +2 -2
- package/docs-site/zh/tutorials/agent-feedback-loop.mdx +2 -2
- package/docs-site/zh/tutorials/ci-integration.mdx +1 -1
- package/docs-site/zh/tutorials/connect-your-agent.mdx +2 -2
- package/docs-site/zh/tutorials/custom-reports.mdx +4 -4
- package/docs-site/zh/tutorials/deploy-report-site.mdx +3 -3
- package/docs-site/zh/tutorials/experiments.mdx +2 -2
- package/docs-site/zh/tutorials/handle-execution-failures.mdx +1 -1
- package/docs-site/zh/tutorials/install-custom-sandbox-agent.mdx +1 -1
- package/docs-site/zh/tutorials/publish-report.mdx +4 -4
- package/docs-site/zh/tutorials/reporters.mdx +1 -1
- package/docs-site/zh/tutorials/viewing-results.mdx +9 -9
- package/package.json +1 -1
|
@@ -4,6 +4,7 @@ import { type AnalysisRequestError, type Sample, type SampleClosedError } from "
|
|
|
4
4
|
import { type ReportDefinition } from "../definition/report.cjs";
|
|
5
5
|
import { type ReportBuildBudgetExceeded } from "../execution/model.cjs";
|
|
6
6
|
import type { ReportProblem } from "../execution/machine.cjs";
|
|
7
|
+
import type { PanelMode } from "../model/panel.cjs";
|
|
7
8
|
import { type ResolvedPage, type ResolvedPageClosureError } from "../runtime/resolved-page.cjs";
|
|
8
9
|
import type { ThemeDefinition } from "../theme.cjs";
|
|
9
10
|
import { type ShowTargetError } from "./show-target.cjs";
|
|
@@ -52,6 +53,10 @@ export declare function executeReportTarget(input: {
|
|
|
52
53
|
readonly sample: Sample;
|
|
53
54
|
readonly report: ReportDefinition;
|
|
54
55
|
readonly route?: string;
|
|
56
|
+
readonly textProjection?: {
|
|
57
|
+
readonly width: number;
|
|
58
|
+
readonly panelMode: PanelMode;
|
|
59
|
+
};
|
|
55
60
|
}): Effect.Effect<ClosedTargetExecution, ReportExecutionError, Scope.Scope>;
|
|
56
61
|
/** Enumerates and closes every page instance exactly once for view/static. */
|
|
57
62
|
export declare function executeReportSite(input: {
|
|
@@ -4,6 +4,7 @@ import { type AnalysisRequestError, type Sample, type SampleClosedError } from "
|
|
|
4
4
|
import { type ReportDefinition } from "../definition/report.mjs";
|
|
5
5
|
import { type ReportBuildBudgetExceeded } from "../execution/model.mjs";
|
|
6
6
|
import type { ReportProblem } from "../execution/machine.mjs";
|
|
7
|
+
import type { PanelMode } from "../model/panel.mjs";
|
|
7
8
|
import { type ResolvedPage, type ResolvedPageClosureError } from "../runtime/resolved-page.mjs";
|
|
8
9
|
import type { ThemeDefinition } from "../theme.mjs";
|
|
9
10
|
import { type ShowTargetError } from "./show-target.mjs";
|
|
@@ -52,6 +53,10 @@ export declare function executeReportTarget(input: {
|
|
|
52
53
|
readonly sample: Sample;
|
|
53
54
|
readonly report: ReportDefinition;
|
|
54
55
|
readonly route?: string;
|
|
56
|
+
readonly textProjection?: {
|
|
57
|
+
readonly width: number;
|
|
58
|
+
readonly panelMode: PanelMode;
|
|
59
|
+
};
|
|
55
60
|
}): Effect.Effect<ClosedTargetExecution, ReportExecutionError, Scope.Scope>;
|
|
56
61
|
/** Enumerates and closes every page instance exactly once for view/static. */
|
|
57
62
|
export declare function executeReportSite(input: {
|
|
@@ -4,6 +4,7 @@ import { type AnalysisRequestError, type Sample, type SampleClosedError } from "
|
|
|
4
4
|
import { type ReportDefinition } from "../definition/report.js";
|
|
5
5
|
import { type ReportBuildBudgetExceeded } from "../execution/model.js";
|
|
6
6
|
import type { ReportProblem } from "../execution/machine.js";
|
|
7
|
+
import type { PanelMode } from "../model/panel.js";
|
|
7
8
|
import { type ResolvedPage, type ResolvedPageClosureError } from "../runtime/resolved-page.js";
|
|
8
9
|
import type { ThemeDefinition } from "../theme.js";
|
|
9
10
|
import { type ShowTargetError } from "./show-target.js";
|
|
@@ -52,6 +53,10 @@ export declare function executeReportTarget(input: {
|
|
|
52
53
|
readonly sample: Sample;
|
|
53
54
|
readonly report: ReportDefinition;
|
|
54
55
|
readonly route?: string;
|
|
56
|
+
readonly textProjection?: {
|
|
57
|
+
readonly width: number;
|
|
58
|
+
readonly panelMode: PanelMode;
|
|
59
|
+
};
|
|
55
60
|
}): Effect.Effect<ClosedTargetExecution, ReportExecutionError, Scope.Scope>;
|
|
56
61
|
/** Enumerates and closes every page instance exactly once for view/static. */
|
|
57
62
|
export declare function executeReportSite(input: {
|
|
@@ -74,6 +74,7 @@ function showSelectionFromRecord(input) {
|
|
|
74
74
|
report,
|
|
75
75
|
selection,
|
|
76
76
|
...(input.route === undefined ? {} : { route: input.route }),
|
|
77
|
+
...(input.textProjection === undefined ? {} : { textProjection: input.textProjection }),
|
|
77
78
|
format: input.format ?? "text",
|
|
78
79
|
});
|
|
79
80
|
}));
|
|
@@ -92,6 +93,7 @@ function showAttemptFromRecord(input) {
|
|
|
92
93
|
report,
|
|
93
94
|
selection,
|
|
94
95
|
...(input.route === undefined ? {} : { route: input.route }),
|
|
96
|
+
...(input.textProjection === undefined ? {} : { textProjection: input.textProjection }),
|
|
95
97
|
format: input.format ?? "text",
|
|
96
98
|
});
|
|
97
99
|
}));
|
|
@@ -121,6 +123,7 @@ function presentShowTarget(input) {
|
|
|
121
123
|
sample: input.sample,
|
|
122
124
|
report: input.report,
|
|
123
125
|
...(input.route === undefined ? {} : { route: input.route }),
|
|
126
|
+
...(input.textProjection === undefined ? {} : { textProjection: input.textProjection }),
|
|
124
127
|
}));
|
|
125
128
|
return yield* presentTarget({
|
|
126
129
|
sample: input.sample,
|
|
@@ -128,6 +131,7 @@ function presentShowTarget(input) {
|
|
|
128
131
|
execution,
|
|
129
132
|
selection: input.selection,
|
|
130
133
|
format: input.format,
|
|
134
|
+
...(input.textProjection === undefined ? {} : { textProjection: input.textProjection }),
|
|
131
135
|
});
|
|
132
136
|
});
|
|
133
137
|
}
|
|
@@ -322,7 +326,8 @@ function presentTarget(input) {
|
|
|
322
326
|
return effect_1.Effect.try({
|
|
323
327
|
try: () => withTrailingNewline((0, text_ts_1.renderResolvedPageText)(input.execution.page, {
|
|
324
328
|
locale: "en",
|
|
325
|
-
width: SHOW_TEXT_WIDTH,
|
|
329
|
+
width: input.textProjection?.width ?? SHOW_TEXT_WIDTH,
|
|
330
|
+
panelMode: input.textProjection?.panelMode ?? "plain",
|
|
326
331
|
})),
|
|
327
332
|
catch: (cause) => presentationFailure("text", cause),
|
|
328
333
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"from-record.js","sourceRoot":"","sources":["from-record.ts"],"names":[],"mappings":";;AAmEA,oDAIC;AAMD,8DAKC;AAED,8DAOC;AAOD,4EAIC;AAtGD,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,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IACnE,OAAO,MAAM,CAAC,MAAM,CAAC;QACjB,IAAI,EAAE,iCAA0C;QAChD,SAAS;QACT,MAAM,EAAE,GAAG,CAAC,OAAO,CAAC,+BAA+B,EAAE,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,IAAI,EAAE,IAAI,GAAG,SAAS,SAAS;KAC1G,CAAC,CAAC;AACP,CAAC;AACD,SAAS,mBAAmB,CAAC,KAAa;IACtC,OAAO,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,KAAK,IAAI,CAAC;AACvD,CAAC;AACD,SAAS,WAAW,CAAC,IAAY,EAAE,KAAa;IAC5C,OAAO,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;AACjE,CAAC","sourcesContent":["import { Effect } from \"effect\";\nimport type * as Scope from \"effect/Scope\";\nimport type { AttemptLocator } from \"../../attempt-locator.ts\";\nimport { resolveAttemptLocator } from \"../../attempt-locator-resolution.ts\";\nimport { analysisHost } from \"../../analysis/host.ts\";\nimport type { AnalysisSelectionRequest, ExperimentId, JsonValue, Sample, } from \"../../analysis/index.ts\";\nimport type { RecordCoordination } from \"../../coordination/record-leases.ts\";\nimport { recordHost } from \"../../record/host/runtime.ts\";\nimport type { RecordRoot } from \"../../record/platform/root.ts\";\nimport type { RecordFileSystem } from \"../../record/platform/services.ts\";\nimport type { RecordReaderOpenError, RecordReaderReadError, } from \"../../record/reader/errors.ts\";\nimport { captureAnalysisIssues, narrowSample, narrowSampleByCurrentIdentity, type AnalysisIssueCapture, } from \"../../sample/capability.ts\";\nimport { materializeSampleSnapshot, narrowSampleSnapshot, narrowSampleSnapshotByCurrentIdentity, } from \"../../sample/analysis.ts\";\nimport type { RecordReadSession, RecordSelection, } from \"../../record/host/types.ts\";\nimport { defaultAttemptOverviewReport } from \"../built-in/attempt-overview.ts\";\nimport { builtInMachineProducerIds, } from \"../built-in/machine.ts\";\nimport { defaultOverviewReport } from \"../built-in/overview.ts\";\nimport { defaultRunMembershipOverviewReport } from \"../built-in/run-membership-overview.ts\";\nimport { resolveReportTitle, type ReportDefinition, } from \"../definition/report.ts\";\nimport type { ClosedSiteRevision } from \"../execution/model.ts\";\nimport { builtInMachineDescriptorOf, builtInShowDocument, buildReportProjections, canonicalMachineJson, closePricingProfileJson, customTargetExecutionManifest, produceBuiltInShowData, reportProjectionFailure, type BuiltInMachineDescriptor, type BuiltInMachineProducerMissing, type ReportProjectionCostInput, type ShowSelection, } from \"../execution/machine.ts\";\nimport { renderResolvedPageText } from \"../runtime/text.ts\";\nimport type { ThemeDefinition } from \"../theme.ts\";\nimport { executeReportSite, startReportBuildBudget, executeReportTarget, reportDefinitionIdentity, type ClosedReportSite, type ClosedTargetExecution, type ReportBuildBudgetAnchor, type ReportExecutionError, } from \"./execute.ts\";\nimport { builtInMachineRegistry, type BuiltInMachineProductionFailed, } from \"./machine.ts\";\nimport { selectShowTarget, type ShowTargetError, } from \"./show-target.ts\";\nimport { isReportTargetRouteInvalid, showTargetRequestForRoute, } from \"./target-route.ts\";\nimport { withReportHostPhase } from \"./progress.ts\";\nimport { buildSiteRevision, type ReportSiteBuildError, } from \"./static.ts\";\nconst SHOW_TEXT_WIDTH = 80;\nexport interface ReportShowPresentationFailed {\n readonly code: \"report-show-presentation-failed\";\n readonly operation: \"text\" | \"machine\";\n readonly reason: string;\n}\nexport type ExecuteReportFromRecordError = RecordReaderOpenError | RecordReaderReadError | ReportExecutionError | ReportSiteBuildError | BuiltInMachineProductionFailed | BuiltInMachineProducerMissing | ReportShowPresentationFailed | {\n readonly code: \"sample-attempt-locator-not-found\";\n readonly locator: AttemptLocator;\n} | {\n readonly code: \"sample-attempt-locator-ambiguous\";\n readonly locator: AttemptLocator;\n};\nexport type ExecuteReportForAttemptFromRecordError = ExecuteReportFromRecordError;\nexport type ExecuteReportFromRecordRequirements = RecordFileSystem | RecordCoordination;\ninterface SelectionTarget {\n readonly root: RecordRoot;\n readonly selection: AnalysisSelectionRequest;\n readonly report?: ReportDefinition;\n}\ninterface AttemptTarget {\n readonly root: RecordRoot;\n readonly locator: AttemptLocator;\n readonly report?: ReportDefinition;\n}\nexport type ReportRecordTarget = SelectionTarget | AttemptTarget;\nexport type ShowReportFromRecordInput = ReportRecordTarget & {\n readonly route?: string;\n readonly format?: \"text\" | \"json\";\n};\nexport type BuildReportSiteFromRecordInput = ReportRecordTarget & {\n readonly theme?: ThemeDefinition;\n};\nexport type CloseReportSiteFromRecordInput = ReportRecordTarget;\n/**\n * The Record-backed show boundary executes and closes exactly one Page. It\n * never enumerates a parameterized Page and never forms a Site revision.\n */\nexport function showReportFromRecord(input: ShowReportFromRecordInput): Effect.Effect<string, ExecuteReportFromRecordError, ExecuteReportFromRecordRequirements> {\n return \"locator\" in input\n ? showAttemptFromRecord(input)\n : showSelectionFromRecord(input);\n}\n/**\n * The Record-backed site boundary enumerates every Page instance once, closes\n * all projections while the Sample is live, and then forms one opaque byte\n * revision consumed unchanged by view and static export.\n */\nexport function buildReportSiteFromRecord(input: BuildReportSiteFromRecordInput): Effect.Effect<ClosedSiteRevision, ExecuteReportFromRecordError, ExecuteReportFromRecordRequirements> {\n return Effect.flatMap(closeReportSiteFromRecord(input), (site) => buildSiteRevision({\n site,\n ...(input.theme === undefined ? {} : { theme: input.theme }),\n }));\n}\n/** @internal Page-level cache input: closed data only, with no live Sample. */\nexport function closeReportSiteFromRecord(input: CloseReportSiteFromRecordInput): Effect.Effect<ClosedReportSite, ExecuteReportFromRecordError, ExecuteReportFromRecordRequirements> {\n return Effect.suspend(() => {\n const budget = startReportBuildBudget();\n return \"locator\" in input\n ? closeAttemptSiteFromRecord(input, budget)\n : closeSelectionSiteFromRecord(input, budget);\n });\n}\n/**\n * @internal Watch-only Record probe. It shares the same selection and\n * project-current/attempt narrowing as Sample opening, but stops after the\n * selected semantic snapshot is materialized. No Sample capability or Report\n * callback is opened on this path.\n */\nexport function reportSnapshotIdentityFromRecord(input: ReportRecordTarget): Effect.Effect<string, ExecuteReportFromRecordError, ExecuteReportFromRecordRequirements> {\n return Effect.scoped(\"locator\" in input\n ? snapshotIdentityForAttempt(input.root, input.locator)\n : snapshotIdentityForSelection(input.root, input.selection));\n}\nfunction showSelectionFromRecord(input: SelectionTarget & {\n readonly route?: string;\n readonly format?: \"text\" | \"json\";\n}) {\n return Effect.scoped(Effect.gen(function* () {\n const sample = yield* openSelectionSample(input.root, input.selection);\n const report = input.report ?? defaultReportForSelection(input.selection);\n const selection = showSelectionForRequest(sample, input.selection);\n return yield* presentShowTarget({\n sample,\n report,\n selection,\n ...(input.route === undefined ? {} : { route: input.route }),\n format: input.format ?? \"text\",\n });\n }));\n}\nfunction showAttemptFromRecord(input: AttemptTarget & {\n readonly route?: string;\n readonly format?: \"text\" | \"json\";\n}) {\n return Effect.scoped(Effect.gen(function* () {\n const sample = yield* openAttemptSample(input.root, input.locator);\n const report = input.report ?? defaultAttemptOverviewReport;\n const selection: ShowSelection = Object.freeze({\n kind: \"attempt-locator\" as const,\n sampleIdentity: sample.snapshot.identity.id,\n locator: String(input.locator),\n });\n return yield* presentShowTarget({\n sample,\n report,\n selection,\n ...(input.route === undefined ? {} : { route: input.route }),\n format: input.format ?? \"text\",\n });\n }));\n}\n/**\n * One selected target for one fixed Sample. A built-in machine Report is\n * executed by the Host-owned producer registry from its data-only descriptor;\n * its author callbacks are never invoked, so a duplicate installed copy is\n * recognized and executed safely. Custom Reports keep executing the selected\n * author Page and then present the closed result.\n */\nfunction presentShowTarget(input: {\n readonly sample: Sample;\n readonly report: ReportDefinition;\n readonly selection: ShowSelection;\n readonly route?: string;\n readonly format: \"text\" | \"json\";\n}): Effect.Effect<string, ExecuteReportFromRecordError, Scope.Scope> {\n if (input.format === \"json\") {\n const descriptor = builtInMachineDescriptorOf(input.report);\n if (descriptor !== undefined) {\n return presentBuiltInMachineShow({\n sample: input.sample,\n report: input.report,\n descriptor,\n selection: input.selection,\n ...(input.route === undefined ? {} : { route: input.route }),\n });\n }\n }\n return Effect.gen(function* () {\n const execution = yield* withReportHostPhase(\"report-execution\", executeReportTarget({\n sample: input.sample,\n report: input.report,\n ...(input.route === undefined ? {} : { route: input.route }),\n }));\n return yield* presentTarget({\n sample: input.sample,\n report: input.report,\n execution,\n selection: input.selection,\n format: input.format,\n });\n });\n}\n/**\n * Produces the Host-owned built-in machine document without executing any\n * author callback. Route and Page selection stay pure; the producer registry\n * resolves the data-only descriptor, and the analysis capture records the\n * same problem table an author execution would surface.\n */\nfunction presentBuiltInMachineShow(input: {\n readonly sample: Sample;\n readonly report: ReportDefinition;\n readonly descriptor: BuiltInMachineDescriptor;\n readonly selection: ShowSelection;\n readonly route?: string;\n}): Effect.Effect<string, ReportExecutionError | BuiltInMachineProductionFailed | BuiltInMachineProducerMissing | ReportShowPresentationFailed, Scope.Scope> {\n return withReportHostPhase(\"report-execution\", Effect.gen(function* () {\n const request = showTargetRequestForRoute(input.report, input.route);\n if (isReportTargetRouteInvalid(request))\n return yield* Effect.fail(request);\n const selected = selectShowTarget(input.report, request);\n if (isShowTargetSelectionError(selected)) {\n return yield* Effect.fail(selected);\n }\n const pageId = selected.page.id;\n const route = selected.kind === \"plain\" ? selected.target.route : selected.route;\n const capture = yield* captureAnalysisIssues(input.sample);\n return yield* Effect.ensuring(Effect.gen(function* () {\n const data = yield* Effect.tryPromise({\n // The producer's Analysis facade captures the execution-local issue\n // token synchronously, so it must start inside the capture context.\n try: () => capture.run(() => Effect.runPromise(Effect.scoped(produceBuiltInShowData({\n registry: builtInMachineRegistry,\n descriptor: input.descriptor,\n sample: input.sample,\n selection: input.selection,\n route,\n pageId,\n })))),\n catch: (cause): BuiltInMachineProductionFailed | BuiltInMachineProducerMissing | ReportShowPresentationFailed => {\n if (isMachineShowFailure(cause))\n return cause;\n return presentationFailure(\"machine\", cause);\n },\n });\n const costs = capturedProjectionCosts(capture, route, pageId);\n const pricingProfile = reportPricingProfileJson(input.report);\n const failure = reportProjectionFailure({ pricingProfile, costs });\n if (failure !== undefined)\n return yield* Effect.fail(failure);\n return yield* Effect.try({\n try: () => `${canonicalMachineJson(builtInShowDocument({\n selection: input.selection,\n report: {\n token: builtInToken(input.descriptor.producerId),\n identity: reportDefinitionIdentity(input.report),\n },\n page: {\n route,\n pageId,\n title: selected.page.title,\n },\n data,\n // The built-in data keeps no second enumerable projection; the\n // capture's cost entries are the only source, bound to this Page.\n projections: buildReportProjections({\n pricingProfile,\n costs,\n }),\n problems: machineProblems(capture.issues(), pageId),\n }))}\\n`,\n catch: (cause): ReportShowPresentationFailed => presentationFailure(\"machine\", cause),\n });\n }), Effect.sync(() => capture.close()));\n }));\n}\nfunction closeSelectionSiteFromRecord(input: SelectionTarget, budget: ReportBuildBudgetAnchor) {\n return Effect.scoped(Effect.gen(function* () {\n const sample = yield* openSelectionSample(input.root, input.selection);\n return yield* withReportHostPhase(\"report-execution\", executeReportSite({\n sample,\n report: input.report ?? defaultReportForSelection(input.selection),\n budget,\n }));\n }));\n}\nfunction closeAttemptSiteFromRecord(input: AttemptTarget, budget: ReportBuildBudgetAnchor) {\n return Effect.scoped(Effect.gen(function* () {\n const sample = yield* openAttemptSample(input.root, input.locator);\n return yield* withReportHostPhase(\"report-execution\", executeReportSite({\n sample,\n report: input.report ?? defaultAttemptOverviewReport,\n budget,\n }));\n }));\n}\ninterface SelectedRecordTarget {\n readonly reader: RecordReadSession;\n readonly selection: RecordSelection;\n}\ninterface SelectedAttemptTarget extends SelectedRecordTarget {\n readonly selectionRequest: AnalysisSelectionRequest;\n readonly runId: import(\"../../analysis/contracts.ts\").RunId;\n readonly slotId: import(\"../../analysis/contracts.ts\").SlotId;\n}\n/** The shared true selection boundary for both Sample opening and watch probes. */\nfunction selectRecordForSelection(root: RecordRoot, selection: AnalysisSelectionRequest) {\n return Effect.gen(function* () {\n const reader = yield* withReportHostPhase(\"record-open\", recordHost.current.openRead({ root }));\n const selected = yield* withReportHostPhase(\"selection\", reader.selectRuns(selection.policy === \"explicit-runs\" ? { runIds: selection.runIds } : undefined));\n const filtered = selection.policy === \"project-current\" && selection.experimentIds !== undefined\n ? yield* filterSelectionByExperiment(selected, selection.experimentIds)\n : selected;\n return Object.freeze({ reader, selection: filtered }) satisfies SelectedRecordTarget;\n });\n}\n/** The shared exact-attempt selection boundary for both Sample opening and watch probes. */\nfunction selectRecordForAttempt(root: RecordRoot, locator: AttemptLocator) {\n return Effect.gen(function* () {\n const reader = yield* withReportHostPhase(\"record-open\", recordHost.current.openRead({ root }));\n const resolved = yield* withReportHostPhase(\"selection\", Effect.gen(function* () {\n const selected = yield* reader.selectRuns();\n return yield* resolveAttemptLocator({ reader, selection: selected, locator });\n }));\n if (resolved.kind === \"not-found\") {\n return yield* Effect.fail({ code: \"sample-attempt-locator-not-found\" as const, locator });\n }\n if (resolved.kind === \"ambiguous\") {\n return yield* Effect.fail({ code: \"sample-attempt-locator-ambiguous\" as const, locator });\n }\n const selectionRequest: AnalysisSelectionRequest = Object.freeze({\n policy: \"explicit-runs\" as const,\n runIds: Object.freeze([resolved.run.runId]),\n });\n const selection = yield* reader.selectRuns({ runIds: selectionRequest.runIds });\n return Object.freeze({\n reader,\n selection,\n selectionRequest,\n runId: resolved.run.runId,\n slotId: resolved.slotId,\n }) satisfies SelectedAttemptTarget;\n });\n}\nfunction snapshotIdentityForSelection(root: RecordRoot, selection: AnalysisSelectionRequest) {\n return Effect.gen(function* () {\n const selected = yield* selectRecordForSelection(root, selection);\n const materialized = yield* materializeSampleSnapshot({\n reader: selected.reader,\n selection: selected.selection,\n selectionRequest: selection,\n });\n const snapshot = selection.policy === \"project-current\"\n ? narrowSampleSnapshotByCurrentIdentity(materialized.snapshot, matchingOccurrencesForCurrentIdentity(selected.selection, selection.currentSlots))\n : materialized.snapshot;\n return snapshot.identity.id;\n });\n}\nfunction snapshotIdentityForAttempt(root: RecordRoot, locator: AttemptLocator) {\n return Effect.gen(function* () {\n const selected = yield* selectRecordForAttempt(root, locator);\n const materialized = yield* materializeSampleSnapshot({\n reader: selected.reader,\n selection: selected.selection,\n selectionRequest: selected.selectionRequest,\n });\n const snapshot = narrowSampleSnapshot(materialized.snapshot, {\n runIds: [selected.runId],\n slotIds: [selected.slotId],\n });\n // This selector is assembled from one successfully resolved Attempt, so\n // the only invalid-selector branch is an internal invariant violation.\n if (\"code\" in snapshot)\n throw snapshot;\n return snapshot.identity.id;\n });\n}\nfunction openSelectionSample(root: RecordRoot, selection: AnalysisSelectionRequest) {\n return Effect.gen(function* () {\n const selected = yield* selectRecordForSelection(root, selection);\n const opened = yield* withReportHostPhase(\"sample-open\", analysisHost.openSample({\n reader: selected.reader,\n selection: selected.selection,\n selectionRequest: selection,\n }));\n return selection.policy === \"project-current\"\n ? narrowSampleByCurrentIdentity(opened, matchingOccurrencesForCurrentIdentity(selected.selection, selection.currentSlots))\n : opened;\n });\n}\nfunction openAttemptSample(root: RecordRoot, locator: AttemptLocator) {\n return Effect.gen(function* () {\n const selected = yield* selectRecordForAttempt(root, locator);\n const sample = yield* withReportHostPhase(\"sample-open\", analysisHost.openSample({\n reader: selected.reader,\n selection: selected.selection,\n selectionRequest: selected.selectionRequest,\n }));\n return narrowSample(sample, {\n runIds: [selected.runId],\n slotIds: [selected.slotId],\n });\n });\n}\nfunction presentTarget(input: {\n readonly sample: Sample;\n readonly report: ReportDefinition;\n readonly execution: ClosedTargetExecution;\n readonly selection: ShowSelection;\n readonly format: \"text\" | \"json\";\n}): Effect.Effect<string, ReportShowPresentationFailed, Scope.Scope> {\n if (input.format === \"text\") {\n return Effect.try({\n try: () => withTrailingNewline(renderResolvedPageText(input.execution.page, {\n locale: \"en\",\n width: SHOW_TEXT_WIDTH,\n })),\n catch: (cause): ReportShowPresentationFailed => presentationFailure(\"text\", cause),\n });\n }\n return Effect.try({\n try: () => `${canonicalMachineJson(customTargetExecutionManifest({\n selection: input.selection,\n report: {\n identity: reportDefinitionIdentity(input.report),\n title: resolveReportTitle(input.report),\n },\n page: input.execution.page,\n textWidth: SHOW_TEXT_WIDTH,\n projections: input.execution.projections,\n problems: input.execution.problems,\n }))}\\n`,\n catch: (cause): ReportShowPresentationFailed => presentationFailure(\"machine\", cause),\n });\n}\nfunction isMachineShowFailure(value: unknown): value is BuiltInMachineProductionFailed | BuiltInMachineProducerMissing {\n return typeof value === \"object\" && value !== null &&\n (Reflect.get(value, \"code\") === \"report-built-in-machine-producer-missing\" ||\n Reflect.get(value, \"code\") === \"report-built-in-machine-production-failed\");\n}\n/** Distinguishes the pure selection error from a selected target without importing the private union. */\nfunction isShowTargetSelectionError(value: unknown): value is ShowTargetError {\n return typeof value === \"object\" && value !== null && \"code\" in value;\n}\n/** The closed JSON form of the Report's PricingProfile, or null without one. */\nfunction reportPricingProfileJson(report: ReportDefinition): JsonValue | null {\n return report.pricing === null ? null : closePricingProfileJson(report.pricing);\n}\n/** Binds exact Analysis row-level cost captures to the built-in target Page. */\nfunction capturedProjectionCosts(capture: AnalysisIssueCapture, route: string, pageId: string): readonly ReportProjectionCostInput[] {\n return capture.costEntries().map((entry) => Object.freeze({\n page: Object.freeze({ pageId, route }),\n measureId: entry.measureId,\n row: Object.freeze({ key: entry.row.key, dimensions: entry.row.dimensions }),\n profileIdentity: entry.profileIdentity,\n projection: entry.projection,\n }));\n}\n/** The host problem table for issues the machine producer recorded while the Sample was live. */\nfunction machineProblems(issues: readonly import(\"../../analysis/index.ts\").AnalysisIssue[], pageId: string): readonly import(\"../execution/machine.ts\").ReportProblem[] {\n return Object.freeze(issues.map((issue) => Object.freeze({\n code: `analysis-${issue.code}`,\n path: Object.freeze([\"page\", pageId]),\n refs: Object.freeze(issue.refs.map((reference) => String(reference.identity.locator)).sort(compareUtf8)),\n summary: issue.message,\n })));\n}\nfunction builtInToken(producerId: string): string {\n switch (producerId) {\n case builtInMachineProducerIds.defaultOverview:\n return \"default-overview\";\n case builtInMachineProducerIds.runMembershipOverview:\n return \"run-membership-overview\";\n case builtInMachineProducerIds.attemptOverview:\n return \"attempt-overview\";\n case builtInMachineProducerIds.standard:\n return \"standard\";\n default:\n return producerId;\n }\n}\nfunction showSelectionForRequest(sample: Sample, selection: AnalysisSelectionRequest): ShowSelection {\n if (selection.policy === \"explicit-runs\") {\n return Object.freeze({\n kind: \"explicit-runs\" as const,\n sampleIdentity: sample.snapshot.identity.id,\n runIds: Object.freeze(selection.runIds.map(String)),\n });\n }\n const experimentIds = selection.experimentIds ?? selection.currentSlots.map((slot) => slot.experimentId);\n return Object.freeze({\n kind: \"project-current\" as const,\n sampleIdentity: sample.snapshot.identity.id,\n experimentIds: Object.freeze(experimentIds.map(String)),\n });\n}\nfunction defaultReportForSelection(selection: AnalysisSelectionRequest): ReportDefinition {\n return selection.policy === \"explicit-runs\"\n ? defaultRunMembershipOverviewReport\n : defaultOverviewReport;\n}\nfunction matchingOccurrencesForCurrentIdentity(selection: import(\"../../record/host/types.ts\").RecordSelection, currentSlots: readonly import(\"../../analysis/contracts.ts\").AnalysisCurrentSlotIdentity[]): readonly import(\"../../analysis/contracts.ts\").AnalysisSlotOccurrenceIdentity[] {\n const digestsByLogicalAlignment = new Map<string, Set<string>>();\n for (const current of currentSlots) {\n const key = logicalAlignmentKey(current.experimentId, current.evalId, current.attemptOrdinal);\n const existing = digestsByLogicalAlignment.get(key) ?? new Set<string>();\n digestsByLogicalAlignment.set(key, existing.add(current.executionIdentityDigest));\n }\n const matching: import(\"../../analysis/contracts.ts\").AnalysisSlotOccurrenceIdentity[] = [];\n for (const entry of selection.expectedSlots) {\n const digests = digestsByLogicalAlignment.get(logicalAlignmentKey(entry.experimentId, entry.slot.evalId, entry.slot.attemptOrdinal));\n if (digests === undefined || !digests.has(entry.slot.executionIdentityDigest))\n continue;\n matching.push(Object.freeze({ runId: entry.run.runId, slotId: entry.slot.slotId }));\n }\n return Object.freeze(matching);\n}\nfunction filterSelectionByExperiment(selection: import(\"../../record/host/types.ts\").RecordSelection, experimentIds: readonly ExperimentId[]): Effect.Effect<import(\"../../record/host/types.ts\").RecordSelection> {\n const wanted = new Set(experimentIds);\n const runFacts = selection.runFacts.filter((facts) => wanted.has(facts.experimentId));\n const allowed = new Set(runFacts.map((facts) => facts.run));\n const allowedRunIds = new Set(runFacts.map((facts) => facts.run.runId));\n return Effect.succeed(Object.freeze({\n runRefs: Object.freeze(runFacts.map((facts) => facts.run)),\n runFacts: Object.freeze(runFacts),\n expectedSlots: Object.freeze(selection.expectedSlots.filter((entry) => allowed.has(entry.run))),\n // `selectRuns()` initially scans the Record-wide physical directory. A\n // concurrently written, unselected Run may therefore be incomplete for a\n // moment. Its warning/problem must not alter the selected semantic Sample\n // (or make an unrelated watch signal reopen Analysis).\n problems: Object.freeze(selection.problems.filter((problem) => allowedRunIds.has(problem.runId))),\n warnings: Object.freeze(selection.warnings.filter((warning) => allowedRunIds.has(warning.runId))),\n }));\n}\nfunction logicalAlignmentKey(experimentId: ExperimentId, evalId: import(\"../../analysis/contracts.ts\").EvalId, attemptOrdinal: number): string {\n return `${experimentId}\\0${evalId}\\0${attemptOrdinal}`;\n}\nfunction presentationFailure(operation: ReportShowPresentationFailed[\"operation\"], cause: unknown): ReportShowPresentationFailed {\n const raw = cause instanceof Error ? cause.message : String(cause);\n return Object.freeze({\n code: \"report-show-presentation-failed\" as const,\n operation,\n reason: raw.replace(/[\\u0000-\\u001f\\u007f-\\u009f]/g, \" \").slice(0, 512).trim() || `${operation} failed`,\n });\n}\nfunction withTrailingNewline(value: string): string {\n return value.endsWith(\"\\n\") ? value : `${value}\\n`;\n}\nfunction compareUtf8(left: string, right: string): number {\n return Buffer.compare(Buffer.from(left), Buffer.from(right));\n}\n"]}
|
|
1
|
+
{"version":3,"file":"from-record.js","sourceRoot":"","sources":["from-record.ts"],"names":[],"mappings":";;AAwEA,oD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,SAAS,WAAW,CAAC,IAAY,EAAE,KAAa;IAC5C,OAAO,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;AACjE,CAAC","sourcesContent":["import { Effect } from \"effect\";\nimport type * as Scope from \"effect/Scope\";\nimport type { AttemptLocator } from \"../../attempt-locator.ts\";\nimport { resolveAttemptLocator } from \"../../attempt-locator-resolution.ts\";\nimport { analysisHost } from \"../../analysis/host.ts\";\nimport type { AnalysisSelectionRequest, ExperimentId, JsonValue, Sample, } from \"../../analysis/index.ts\";\nimport type { RecordCoordination } from \"../../coordination/record-leases.ts\";\nimport { recordHost } from \"../../record/host/runtime.ts\";\nimport type { RecordRoot } from \"../../record/platform/root.ts\";\nimport type { RecordFileSystem } from \"../../record/platform/services.ts\";\nimport type { RecordReaderOpenError, RecordReaderReadError, } from \"../../record/reader/errors.ts\";\nimport { captureAnalysisIssues, narrowSample, narrowSampleByCurrentIdentity, type AnalysisIssueCapture, } from \"../../sample/capability.ts\";\nimport { materializeSampleSnapshot, narrowSampleSnapshot, narrowSampleSnapshotByCurrentIdentity, } from \"../../sample/analysis.ts\";\nimport type { RecordReadSession, RecordSelection, } from \"../../record/host/types.ts\";\nimport { defaultAttemptOverviewReport } from \"../built-in/attempt-overview.ts\";\nimport { builtInMachineProducerIds, } from \"../built-in/machine.ts\";\nimport { defaultOverviewReport } from \"../built-in/overview.ts\";\nimport { defaultRunMembershipOverviewReport } from \"../built-in/run-membership-overview.ts\";\nimport { resolveReportTitle, type ReportDefinition, } from \"../definition/report.ts\";\nimport type { ClosedSiteRevision } from \"../execution/model.ts\";\nimport { builtInMachineDescriptorOf, builtInShowDocument, buildReportProjections, canonicalMachineJson, closePricingProfileJson, customTargetExecutionManifest, produceBuiltInShowData, reportProjectionFailure, type BuiltInMachineDescriptor, type BuiltInMachineProducerMissing, type ReportProjectionCostInput, type ShowSelection, } from \"../execution/machine.ts\";\nimport { renderResolvedPageText } from \"../runtime/text.ts\";\nimport type { PanelMode } from \"../model/panel.ts\";\nimport type { ThemeDefinition } from \"../theme.ts\";\nimport { executeReportSite, startReportBuildBudget, executeReportTarget, reportDefinitionIdentity, type ClosedReportSite, type ClosedTargetExecution, type ReportBuildBudgetAnchor, type ReportExecutionError, } from \"./execute.ts\";\nimport { builtInMachineRegistry, type BuiltInMachineProductionFailed, } from \"./machine.ts\";\nimport { selectShowTarget, type ShowTargetError, } from \"./show-target.ts\";\nimport { isReportTargetRouteInvalid, showTargetRequestForRoute, } from \"./target-route.ts\";\nimport { withReportHostPhase } from \"./progress.ts\";\nimport { buildSiteRevision, type ReportSiteBuildError, } from \"./static.ts\";\nconst SHOW_TEXT_WIDTH = 80;\nexport interface ReportShowPresentationFailed {\n readonly code: \"report-show-presentation-failed\";\n readonly operation: \"text\" | \"machine\";\n readonly reason: string;\n}\nexport type ExecuteReportFromRecordError = RecordReaderOpenError | RecordReaderReadError | ReportExecutionError | ReportSiteBuildError | BuiltInMachineProductionFailed | BuiltInMachineProducerMissing | ReportShowPresentationFailed | {\n readonly code: \"sample-attempt-locator-not-found\";\n readonly locator: AttemptLocator;\n} | {\n readonly code: \"sample-attempt-locator-ambiguous\";\n readonly locator: AttemptLocator;\n};\nexport type ExecuteReportForAttemptFromRecordError = ExecuteReportFromRecordError;\nexport type ExecuteReportFromRecordRequirements = RecordFileSystem | RecordCoordination;\ninterface SelectionTarget {\n readonly root: RecordRoot;\n readonly selection: AnalysisSelectionRequest;\n readonly report?: ReportDefinition;\n}\ninterface AttemptTarget {\n readonly root: RecordRoot;\n readonly locator: AttemptLocator;\n readonly report?: ReportDefinition;\n}\nexport type ReportRecordTarget = SelectionTarget | AttemptTarget;\nexport type ShowReportFromRecordInput = ReportRecordTarget & {\n readonly route?: string;\n readonly format?: \"text\" | \"json\";\n readonly textProjection?: {\n readonly width: number;\n readonly panelMode: PanelMode;\n };\n};\nexport type BuildReportSiteFromRecordInput = ReportRecordTarget & {\n readonly theme?: ThemeDefinition;\n};\nexport type CloseReportSiteFromRecordInput = ReportRecordTarget;\n/**\n * The Record-backed show boundary executes and closes exactly one Page. It\n * never enumerates a parameterized Page and never forms a Site revision.\n */\nexport function showReportFromRecord(input: ShowReportFromRecordInput): Effect.Effect<string, ExecuteReportFromRecordError, ExecuteReportFromRecordRequirements> {\n return \"locator\" in input\n ? showAttemptFromRecord(input)\n : showSelectionFromRecord(input);\n}\n/**\n * The Record-backed site boundary enumerates every Page instance once, closes\n * all projections while the Sample is live, and then forms one opaque byte\n * revision consumed unchanged by view and static export.\n */\nexport function buildReportSiteFromRecord(input: BuildReportSiteFromRecordInput): Effect.Effect<ClosedSiteRevision, ExecuteReportFromRecordError, ExecuteReportFromRecordRequirements> {\n return Effect.flatMap(closeReportSiteFromRecord(input), (site) => buildSiteRevision({\n site,\n ...(input.theme === undefined ? {} : { theme: input.theme }),\n }));\n}\n/** @internal Page-level cache input: closed data only, with no live Sample. */\nexport function closeReportSiteFromRecord(input: CloseReportSiteFromRecordInput): Effect.Effect<ClosedReportSite, ExecuteReportFromRecordError, ExecuteReportFromRecordRequirements> {\n return Effect.suspend(() => {\n const budget = startReportBuildBudget();\n return \"locator\" in input\n ? closeAttemptSiteFromRecord(input, budget)\n : closeSelectionSiteFromRecord(input, budget);\n });\n}\n/**\n * @internal Watch-only Record probe. It shares the same selection and\n * project-current/attempt narrowing as Sample opening, but stops after the\n * selected semantic snapshot is materialized. No Sample capability or Report\n * callback is opened on this path.\n */\nexport function reportSnapshotIdentityFromRecord(input: ReportRecordTarget): Effect.Effect<string, ExecuteReportFromRecordError, ExecuteReportFromRecordRequirements> {\n return Effect.scoped(\"locator\" in input\n ? snapshotIdentityForAttempt(input.root, input.locator)\n : snapshotIdentityForSelection(input.root, input.selection));\n}\nfunction showSelectionFromRecord(input: SelectionTarget & {\n readonly route?: string;\n readonly format?: \"text\" | \"json\";\n readonly textProjection?: {\n readonly width: number;\n readonly panelMode: PanelMode;\n };\n}) {\n return Effect.scoped(Effect.gen(function* () {\n const sample = yield* openSelectionSample(input.root, input.selection);\n const report = input.report ?? defaultReportForSelection(input.selection);\n const selection = showSelectionForRequest(sample, input.selection);\n return yield* presentShowTarget({\n sample,\n report,\n selection,\n ...(input.route === undefined ? {} : { route: input.route }),\n ...(input.textProjection === undefined ? {} : { textProjection: input.textProjection }),\n format: input.format ?? \"text\",\n });\n }));\n}\nfunction showAttemptFromRecord(input: AttemptTarget & {\n readonly route?: string;\n readonly format?: \"text\" | \"json\";\n readonly textProjection?: {\n readonly width: number;\n readonly panelMode: PanelMode;\n };\n}) {\n return Effect.scoped(Effect.gen(function* () {\n const sample = yield* openAttemptSample(input.root, input.locator);\n const report = input.report ?? defaultAttemptOverviewReport;\n const selection: ShowSelection = Object.freeze({\n kind: \"attempt-locator\" as const,\n sampleIdentity: sample.snapshot.identity.id,\n locator: String(input.locator),\n });\n return yield* presentShowTarget({\n sample,\n report,\n selection,\n ...(input.route === undefined ? {} : { route: input.route }),\n ...(input.textProjection === undefined ? {} : { textProjection: input.textProjection }),\n format: input.format ?? \"text\",\n });\n }));\n}\n/**\n * One selected target for one fixed Sample. A built-in machine Report is\n * executed by the Host-owned producer registry from its data-only descriptor;\n * its author callbacks are never invoked, so a duplicate installed copy is\n * recognized and executed safely. Custom Reports keep executing the selected\n * author Page and then present the closed result.\n */\nfunction presentShowTarget(input: {\n readonly sample: Sample;\n readonly report: ReportDefinition;\n readonly selection: ShowSelection;\n readonly route?: string;\n readonly format: \"text\" | \"json\";\n readonly textProjection?: {\n readonly width: number;\n readonly panelMode: PanelMode;\n };\n}): Effect.Effect<string, ExecuteReportFromRecordError, Scope.Scope> {\n if (input.format === \"json\") {\n const descriptor = builtInMachineDescriptorOf(input.report);\n if (descriptor !== undefined) {\n return presentBuiltInMachineShow({\n sample: input.sample,\n report: input.report,\n descriptor,\n selection: input.selection,\n ...(input.route === undefined ? {} : { route: input.route }),\n });\n }\n }\n return Effect.gen(function* () {\n const execution = yield* withReportHostPhase(\"report-execution\", executeReportTarget({\n sample: input.sample,\n report: input.report,\n ...(input.route === undefined ? {} : { route: input.route }),\n ...(input.textProjection === undefined ? {} : { textProjection: input.textProjection }),\n }));\n return yield* presentTarget({\n sample: input.sample,\n report: input.report,\n execution,\n selection: input.selection,\n format: input.format,\n ...(input.textProjection === undefined ? {} : { textProjection: input.textProjection }),\n });\n });\n}\n/**\n * Produces the Host-owned built-in machine document without executing any\n * author callback. Route and Page selection stay pure; the producer registry\n * resolves the data-only descriptor, and the analysis capture records the\n * same problem table an author execution would surface.\n */\nfunction presentBuiltInMachineShow(input: {\n readonly sample: Sample;\n readonly report: ReportDefinition;\n readonly descriptor: BuiltInMachineDescriptor;\n readonly selection: ShowSelection;\n readonly route?: string;\n}): Effect.Effect<string, ReportExecutionError | BuiltInMachineProductionFailed | BuiltInMachineProducerMissing | ReportShowPresentationFailed, Scope.Scope> {\n return withReportHostPhase(\"report-execution\", Effect.gen(function* () {\n const request = showTargetRequestForRoute(input.report, input.route);\n if (isReportTargetRouteInvalid(request))\n return yield* Effect.fail(request);\n const selected = selectShowTarget(input.report, request);\n if (isShowTargetSelectionError(selected)) {\n return yield* Effect.fail(selected);\n }\n const pageId = selected.page.id;\n const route = selected.kind === \"plain\" ? selected.target.route : selected.route;\n const capture = yield* captureAnalysisIssues(input.sample);\n return yield* Effect.ensuring(Effect.gen(function* () {\n const data = yield* Effect.tryPromise({\n // The producer's Analysis facade captures the execution-local issue\n // token synchronously, so it must start inside the capture context.\n try: () => capture.run(() => Effect.runPromise(Effect.scoped(produceBuiltInShowData({\n registry: builtInMachineRegistry,\n descriptor: input.descriptor,\n sample: input.sample,\n selection: input.selection,\n route,\n pageId,\n })))),\n catch: (cause): BuiltInMachineProductionFailed | BuiltInMachineProducerMissing | ReportShowPresentationFailed => {\n if (isMachineShowFailure(cause))\n return cause;\n return presentationFailure(\"machine\", cause);\n },\n });\n const costs = capturedProjectionCosts(capture, route, pageId);\n const pricingProfile = reportPricingProfileJson(input.report);\n const failure = reportProjectionFailure({ pricingProfile, costs });\n if (failure !== undefined)\n return yield* Effect.fail(failure);\n return yield* Effect.try({\n try: () => `${canonicalMachineJson(builtInShowDocument({\n selection: input.selection,\n report: {\n token: builtInToken(input.descriptor.producerId),\n identity: reportDefinitionIdentity(input.report),\n },\n page: {\n route,\n pageId,\n title: selected.page.title,\n },\n data,\n // The built-in data keeps no second enumerable projection; the\n // capture's cost entries are the only source, bound to this Page.\n projections: buildReportProjections({\n pricingProfile,\n costs,\n }),\n problems: machineProblems(capture.issues(), pageId),\n }))}\\n`,\n catch: (cause): ReportShowPresentationFailed => presentationFailure(\"machine\", cause),\n });\n }), Effect.sync(() => capture.close()));\n }));\n}\nfunction closeSelectionSiteFromRecord(input: SelectionTarget, budget: ReportBuildBudgetAnchor) {\n return Effect.scoped(Effect.gen(function* () {\n const sample = yield* openSelectionSample(input.root, input.selection);\n return yield* withReportHostPhase(\"report-execution\", executeReportSite({\n sample,\n report: input.report ?? defaultReportForSelection(input.selection),\n budget,\n }));\n }));\n}\nfunction closeAttemptSiteFromRecord(input: AttemptTarget, budget: ReportBuildBudgetAnchor) {\n return Effect.scoped(Effect.gen(function* () {\n const sample = yield* openAttemptSample(input.root, input.locator);\n return yield* withReportHostPhase(\"report-execution\", executeReportSite({\n sample,\n report: input.report ?? defaultAttemptOverviewReport,\n budget,\n }));\n }));\n}\ninterface SelectedRecordTarget {\n readonly reader: RecordReadSession;\n readonly selection: RecordSelection;\n}\ninterface SelectedAttemptTarget extends SelectedRecordTarget {\n readonly selectionRequest: AnalysisSelectionRequest;\n readonly runId: import(\"../../analysis/contracts.ts\").RunId;\n readonly slotId: import(\"../../analysis/contracts.ts\").SlotId;\n}\n/** The shared true selection boundary for both Sample opening and watch probes. */\nfunction selectRecordForSelection(root: RecordRoot, selection: AnalysisSelectionRequest) {\n return Effect.gen(function* () {\n const reader = yield* withReportHostPhase(\"record-open\", recordHost.current.openRead({ root }));\n const selected = yield* withReportHostPhase(\"selection\", reader.selectRuns(selection.policy === \"explicit-runs\" ? { runIds: selection.runIds } : undefined));\n const filtered = selection.policy === \"project-current\" && selection.experimentIds !== undefined\n ? yield* filterSelectionByExperiment(selected, selection.experimentIds)\n : selected;\n return Object.freeze({ reader, selection: filtered }) satisfies SelectedRecordTarget;\n });\n}\n/** The shared exact-attempt selection boundary for both Sample opening and watch probes. */\nfunction selectRecordForAttempt(root: RecordRoot, locator: AttemptLocator) {\n return Effect.gen(function* () {\n const reader = yield* withReportHostPhase(\"record-open\", recordHost.current.openRead({ root }));\n const resolved = yield* withReportHostPhase(\"selection\", Effect.gen(function* () {\n const selected = yield* reader.selectRuns();\n return yield* resolveAttemptLocator({ reader, selection: selected, locator });\n }));\n if (resolved.kind === \"not-found\") {\n return yield* Effect.fail({ code: \"sample-attempt-locator-not-found\" as const, locator });\n }\n if (resolved.kind === \"ambiguous\") {\n return yield* Effect.fail({ code: \"sample-attempt-locator-ambiguous\" as const, locator });\n }\n const selectionRequest: AnalysisSelectionRequest = Object.freeze({\n policy: \"explicit-runs\" as const,\n runIds: Object.freeze([resolved.run.runId]),\n });\n const selection = yield* reader.selectRuns({ runIds: selectionRequest.runIds });\n return Object.freeze({\n reader,\n selection,\n selectionRequest,\n runId: resolved.run.runId,\n slotId: resolved.slotId,\n }) satisfies SelectedAttemptTarget;\n });\n}\nfunction snapshotIdentityForSelection(root: RecordRoot, selection: AnalysisSelectionRequest) {\n return Effect.gen(function* () {\n const selected = yield* selectRecordForSelection(root, selection);\n const materialized = yield* materializeSampleSnapshot({\n reader: selected.reader,\n selection: selected.selection,\n selectionRequest: selection,\n });\n const snapshot = selection.policy === \"project-current\"\n ? narrowSampleSnapshotByCurrentIdentity(materialized.snapshot, matchingOccurrencesForCurrentIdentity(selected.selection, selection.currentSlots))\n : materialized.snapshot;\n return snapshot.identity.id;\n });\n}\nfunction snapshotIdentityForAttempt(root: RecordRoot, locator: AttemptLocator) {\n return Effect.gen(function* () {\n const selected = yield* selectRecordForAttempt(root, locator);\n const materialized = yield* materializeSampleSnapshot({\n reader: selected.reader,\n selection: selected.selection,\n selectionRequest: selected.selectionRequest,\n });\n const snapshot = narrowSampleSnapshot(materialized.snapshot, {\n runIds: [selected.runId],\n slotIds: [selected.slotId],\n });\n // This selector is assembled from one successfully resolved Attempt, so\n // the only invalid-selector branch is an internal invariant violation.\n if (\"code\" in snapshot)\n throw snapshot;\n return snapshot.identity.id;\n });\n}\nfunction openSelectionSample(root: RecordRoot, selection: AnalysisSelectionRequest) {\n return Effect.gen(function* () {\n const selected = yield* selectRecordForSelection(root, selection);\n const opened = yield* withReportHostPhase(\"sample-open\", analysisHost.openSample({\n reader: selected.reader,\n selection: selected.selection,\n selectionRequest: selection,\n }));\n return selection.policy === \"project-current\"\n ? narrowSampleByCurrentIdentity(opened, matchingOccurrencesForCurrentIdentity(selected.selection, selection.currentSlots))\n : opened;\n });\n}\nfunction openAttemptSample(root: RecordRoot, locator: AttemptLocator) {\n return Effect.gen(function* () {\n const selected = yield* selectRecordForAttempt(root, locator);\n const sample = yield* withReportHostPhase(\"sample-open\", analysisHost.openSample({\n reader: selected.reader,\n selection: selected.selection,\n selectionRequest: selected.selectionRequest,\n }));\n return narrowSample(sample, {\n runIds: [selected.runId],\n slotIds: [selected.slotId],\n });\n });\n}\nfunction presentTarget(input: {\n readonly sample: Sample;\n readonly report: ReportDefinition;\n readonly execution: ClosedTargetExecution;\n readonly selection: ShowSelection;\n readonly format: \"text\" | \"json\";\n readonly textProjection?: {\n readonly width: number;\n readonly panelMode: PanelMode;\n };\n}): Effect.Effect<string, ReportShowPresentationFailed, Scope.Scope> {\n if (input.format === \"text\") {\n return Effect.try({\n try: () => withTrailingNewline(renderResolvedPageText(input.execution.page, {\n locale: \"en\",\n width: input.textProjection?.width ?? SHOW_TEXT_WIDTH,\n panelMode: input.textProjection?.panelMode ?? \"plain\",\n })),\n catch: (cause): ReportShowPresentationFailed => presentationFailure(\"text\", cause),\n });\n }\n return Effect.try({\n try: () => `${canonicalMachineJson(customTargetExecutionManifest({\n selection: input.selection,\n report: {\n identity: reportDefinitionIdentity(input.report),\n title: resolveReportTitle(input.report),\n },\n page: input.execution.page,\n textWidth: SHOW_TEXT_WIDTH,\n projections: input.execution.projections,\n problems: input.execution.problems,\n }))}\\n`,\n catch: (cause): ReportShowPresentationFailed => presentationFailure(\"machine\", cause),\n });\n}\nfunction isMachineShowFailure(value: unknown): value is BuiltInMachineProductionFailed | BuiltInMachineProducerMissing {\n return typeof value === \"object\" && value !== null &&\n (Reflect.get(value, \"code\") === \"report-built-in-machine-producer-missing\" ||\n Reflect.get(value, \"code\") === \"report-built-in-machine-production-failed\");\n}\n/** Distinguishes the pure selection error from a selected target without importing the private union. */\nfunction isShowTargetSelectionError(value: unknown): value is ShowTargetError {\n return typeof value === \"object\" && value !== null && \"code\" in value;\n}\n/** The closed JSON form of the Report's PricingProfile, or null without one. */\nfunction reportPricingProfileJson(report: ReportDefinition): JsonValue | null {\n return report.pricing === null ? null : closePricingProfileJson(report.pricing);\n}\n/** Binds exact Analysis row-level cost captures to the built-in target Page. */\nfunction capturedProjectionCosts(capture: AnalysisIssueCapture, route: string, pageId: string): readonly ReportProjectionCostInput[] {\n return capture.costEntries().map((entry) => Object.freeze({\n page: Object.freeze({ pageId, route }),\n measureId: entry.measureId,\n row: Object.freeze({ key: entry.row.key, dimensions: entry.row.dimensions }),\n profileIdentity: entry.profileIdentity,\n projection: entry.projection,\n }));\n}\n/** The host problem table for issues the machine producer recorded while the Sample was live. */\nfunction machineProblems(issues: readonly import(\"../../analysis/index.ts\").AnalysisIssue[], pageId: string): readonly import(\"../execution/machine.ts\").ReportProblem[] {\n return Object.freeze(issues.map((issue) => Object.freeze({\n code: `analysis-${issue.code}`,\n path: Object.freeze([\"page\", pageId]),\n refs: Object.freeze(issue.refs.map((reference) => String(reference.identity.locator)).sort(compareUtf8)),\n summary: issue.message,\n })));\n}\nfunction builtInToken(producerId: string): string {\n switch (producerId) {\n case builtInMachineProducerIds.defaultOverview:\n return \"default-overview\";\n case builtInMachineProducerIds.runMembershipOverview:\n return \"run-membership-overview\";\n case builtInMachineProducerIds.attemptOverview:\n return \"attempt-overview\";\n case builtInMachineProducerIds.standard:\n return \"standard\";\n default:\n return producerId;\n }\n}\nfunction showSelectionForRequest(sample: Sample, selection: AnalysisSelectionRequest): ShowSelection {\n if (selection.policy === \"explicit-runs\") {\n return Object.freeze({\n kind: \"explicit-runs\" as const,\n sampleIdentity: sample.snapshot.identity.id,\n runIds: Object.freeze(selection.runIds.map(String)),\n });\n }\n const experimentIds = selection.experimentIds ?? selection.currentSlots.map((slot) => slot.experimentId);\n return Object.freeze({\n kind: \"project-current\" as const,\n sampleIdentity: sample.snapshot.identity.id,\n experimentIds: Object.freeze(experimentIds.map(String)),\n });\n}\nfunction defaultReportForSelection(selection: AnalysisSelectionRequest): ReportDefinition {\n return selection.policy === \"explicit-runs\"\n ? defaultRunMembershipOverviewReport\n : defaultOverviewReport;\n}\nfunction matchingOccurrencesForCurrentIdentity(selection: import(\"../../record/host/types.ts\").RecordSelection, currentSlots: readonly import(\"../../analysis/contracts.ts\").AnalysisCurrentSlotIdentity[]): readonly import(\"../../analysis/contracts.ts\").AnalysisSlotOccurrenceIdentity[] {\n const digestsByLogicalAlignment = new Map<string, Set<string>>();\n for (const current of currentSlots) {\n const key = logicalAlignmentKey(current.experimentId, current.evalId, current.attemptOrdinal);\n const existing = digestsByLogicalAlignment.get(key) ?? new Set<string>();\n digestsByLogicalAlignment.set(key, existing.add(current.executionIdentityDigest));\n }\n const matching: import(\"../../analysis/contracts.ts\").AnalysisSlotOccurrenceIdentity[] = [];\n for (const entry of selection.expectedSlots) {\n const digests = digestsByLogicalAlignment.get(logicalAlignmentKey(entry.experimentId, entry.slot.evalId, entry.slot.attemptOrdinal));\n if (digests === undefined || !digests.has(entry.slot.executionIdentityDigest))\n continue;\n matching.push(Object.freeze({ runId: entry.run.runId, slotId: entry.slot.slotId }));\n }\n return Object.freeze(matching);\n}\nfunction filterSelectionByExperiment(selection: import(\"../../record/host/types.ts\").RecordSelection, experimentIds: readonly ExperimentId[]): Effect.Effect<import(\"../../record/host/types.ts\").RecordSelection> {\n const wanted = new Set(experimentIds);\n const runFacts = selection.runFacts.filter((facts) => wanted.has(facts.experimentId));\n const allowed = new Set(runFacts.map((facts) => facts.run));\n const allowedRunIds = new Set(runFacts.map((facts) => facts.run.runId));\n return Effect.succeed(Object.freeze({\n runRefs: Object.freeze(runFacts.map((facts) => facts.run)),\n runFacts: Object.freeze(runFacts),\n expectedSlots: Object.freeze(selection.expectedSlots.filter((entry) => allowed.has(entry.run))),\n // `selectRuns()` initially scans the Record-wide physical directory. A\n // concurrently written, unselected Run may therefore be incomplete for a\n // moment. Its warning/problem must not alter the selected semantic Sample\n // (or make an unrelated watch signal reopen Analysis).\n problems: Object.freeze(selection.problems.filter((problem) => allowedRunIds.has(problem.runId))),\n warnings: Object.freeze(selection.warnings.filter((warning) => allowedRunIds.has(warning.runId))),\n }));\n}\nfunction logicalAlignmentKey(experimentId: ExperimentId, evalId: import(\"../../analysis/contracts.ts\").EvalId, attemptOrdinal: number): string {\n return `${experimentId}\\0${evalId}\\0${attemptOrdinal}`;\n}\nfunction presentationFailure(operation: ReportShowPresentationFailed[\"operation\"], cause: unknown): ReportShowPresentationFailed {\n const raw = cause instanceof Error ? cause.message : String(cause);\n return Object.freeze({\n code: \"report-show-presentation-failed\" as const,\n operation,\n reason: raw.replace(/[\\u0000-\\u001f\\u007f-\\u009f]/g, \" \").slice(0, 512).trim() || `${operation} failed`,\n });\n}\nfunction withTrailingNewline(value: string): string {\n return value.endsWith(\"\\n\") ? value : `${value}\\n`;\n}\nfunction compareUtf8(left: string, right: string): number {\n return Buffer.compare(Buffer.from(left), Buffer.from(right));\n}\n"]}
|
|
@@ -8,6 +8,7 @@ import type { RecordReaderOpenError, RecordReaderReadError } from "../../record/
|
|
|
8
8
|
import { type ReportDefinition } from "../definition/report.cjs";
|
|
9
9
|
import type { ClosedSiteRevision } from "../execution/model.cjs";
|
|
10
10
|
import { type BuiltInMachineProducerMissing } from "../execution/machine.cjs";
|
|
11
|
+
import type { PanelMode } from "../model/panel.cjs";
|
|
11
12
|
import type { ThemeDefinition } from "../theme.cjs";
|
|
12
13
|
import { type ClosedReportSite, type ReportExecutionError } from "./execute.cjs";
|
|
13
14
|
import { type BuiltInMachineProductionFailed } from "./machine.cjs";
|
|
@@ -40,6 +41,10 @@ export type ReportRecordTarget = SelectionTarget | AttemptTarget;
|
|
|
40
41
|
export type ShowReportFromRecordInput = ReportRecordTarget & {
|
|
41
42
|
readonly route?: string;
|
|
42
43
|
readonly format?: "text" | "json";
|
|
44
|
+
readonly textProjection?: {
|
|
45
|
+
readonly width: number;
|
|
46
|
+
readonly panelMode: PanelMode;
|
|
47
|
+
};
|
|
43
48
|
};
|
|
44
49
|
export type BuildReportSiteFromRecordInput = ReportRecordTarget & {
|
|
45
50
|
readonly theme?: ThemeDefinition;
|
|
@@ -8,6 +8,7 @@ import type { RecordReaderOpenError, RecordReaderReadError } from "../../record/
|
|
|
8
8
|
import { type ReportDefinition } from "../definition/report.mjs";
|
|
9
9
|
import type { ClosedSiteRevision } from "../execution/model.mjs";
|
|
10
10
|
import { type BuiltInMachineProducerMissing } from "../execution/machine.mjs";
|
|
11
|
+
import type { PanelMode } from "../model/panel.mjs";
|
|
11
12
|
import type { ThemeDefinition } from "../theme.mjs";
|
|
12
13
|
import { type ClosedReportSite, type ReportExecutionError } from "./execute.mjs";
|
|
13
14
|
import { type BuiltInMachineProductionFailed } from "./machine.mjs";
|
|
@@ -40,6 +41,10 @@ export type ReportRecordTarget = SelectionTarget | AttemptTarget;
|
|
|
40
41
|
export type ShowReportFromRecordInput = ReportRecordTarget & {
|
|
41
42
|
readonly route?: string;
|
|
42
43
|
readonly format?: "text" | "json";
|
|
44
|
+
readonly textProjection?: {
|
|
45
|
+
readonly width: number;
|
|
46
|
+
readonly panelMode: PanelMode;
|
|
47
|
+
};
|
|
43
48
|
};
|
|
44
49
|
export type BuildReportSiteFromRecordInput = ReportRecordTarget & {
|
|
45
50
|
readonly theme?: ThemeDefinition;
|
|
@@ -8,6 +8,7 @@ import type { RecordReaderOpenError, RecordReaderReadError } from "../../record/
|
|
|
8
8
|
import { type ReportDefinition } from "../definition/report.js";
|
|
9
9
|
import type { ClosedSiteRevision } from "../execution/model.js";
|
|
10
10
|
import { type BuiltInMachineProducerMissing } from "../execution/machine.js";
|
|
11
|
+
import type { PanelMode } from "../model/panel.js";
|
|
11
12
|
import type { ThemeDefinition } from "../theme.js";
|
|
12
13
|
import { type ClosedReportSite, type ReportExecutionError } from "./execute.js";
|
|
13
14
|
import { type BuiltInMachineProductionFailed } from "./machine.js";
|
|
@@ -40,6 +41,10 @@ export type ReportRecordTarget = SelectionTarget | AttemptTarget;
|
|
|
40
41
|
export type ShowReportFromRecordInput = ReportRecordTarget & {
|
|
41
42
|
readonly route?: string;
|
|
42
43
|
readonly format?: "text" | "json";
|
|
44
|
+
readonly textProjection?: {
|
|
45
|
+
readonly width: number;
|
|
46
|
+
readonly panelMode: PanelMode;
|
|
47
|
+
};
|
|
43
48
|
};
|
|
44
49
|
export type BuildReportSiteFromRecordInput = ReportRecordTarget & {
|
|
45
50
|
readonly theme?: ThemeDefinition;
|
|
@@ -31,7 +31,9 @@ function resolvePage(input) {
|
|
|
31
31
|
}
|
|
32
32
|
/** Finds an already-built terminal projection. It never invokes a renderer. */
|
|
33
33
|
function resolvedPageTextProjection(page, input) {
|
|
34
|
-
return page.text.find((projection) => projection.locale === input.locale &&
|
|
34
|
+
return page.text.find((projection) => projection.locale === input.locale &&
|
|
35
|
+
projection.width === input.width &&
|
|
36
|
+
projection.panelMode === input.panelMode);
|
|
35
37
|
}
|
|
36
38
|
/** Finds an already-built browser projection. It never invokes a renderer. */
|
|
37
39
|
function resolvedPageWebProjection(page, input) {
|
|
@@ -115,16 +117,24 @@ function freezeTextProjections(value, sample) {
|
|
|
115
117
|
if (rejectLiveCapability(projection, sample, ["text", String(index)])) {
|
|
116
118
|
throw new TypeError(`text[${index}] retains a live Sample capability`);
|
|
117
119
|
}
|
|
118
|
-
if (!isNonEmptyString(projection.locale) || !isPositiveSafeInteger(projection.width) ||
|
|
119
|
-
|
|
120
|
+
if (!isNonEmptyString(projection.locale) || !isPositiveSafeInteger(projection.width) ||
|
|
121
|
+
(projection.panelMode !== "boxed" && projection.panelMode !== "plain") || typeof projection.text !== "string") {
|
|
122
|
+
throw new TypeError(`text[${index}] must contain locale, positive width, panel mode, and text`);
|
|
120
123
|
}
|
|
121
|
-
const key = `${projection.locale}\u0000${projection.width}`;
|
|
124
|
+
const key = `${projection.locale}\u0000${projection.width}\u0000${projection.panelMode}`;
|
|
122
125
|
if (seen.has(key))
|
|
123
126
|
throw new TypeError(`text projection ${JSON.stringify(key)} is duplicated`);
|
|
124
127
|
seen.add(key);
|
|
125
|
-
return Object.freeze({
|
|
128
|
+
return Object.freeze({
|
|
129
|
+
locale: projection.locale,
|
|
130
|
+
width: projection.width,
|
|
131
|
+
panelMode: projection.panelMode,
|
|
132
|
+
text: projection.text,
|
|
133
|
+
});
|
|
126
134
|
});
|
|
127
|
-
return Object.freeze(closed.sort((left, right) => compareUtf8(left.locale, right.locale) ||
|
|
135
|
+
return Object.freeze(closed.sort((left, right) => compareUtf8(left.locale, right.locale) ||
|
|
136
|
+
left.width - right.width ||
|
|
137
|
+
compareUtf8(left.panelMode, right.panelMode)));
|
|
128
138
|
}
|
|
129
139
|
function freezeWebProjections(value, sample) {
|
|
130
140
|
if (!Array.isArray(value) || value.length === 0) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolved-page.js","sourceRoot":"","sources":["resolved-page.ts"],"names":[],"mappings":";;;AAyHA,kCAaC;AAED,gEAKC;AAED,8DAIC;AAiRD,kCAYC;AAhbD,mCAAgC;AAEhC,8DAAwH;AAExH,8EAA8E;AACjE,QAAA,oBAAoB,GAAG,kCAAkC,CAAC;AA8GvE;;;;;GAKG;AAC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AAC;QAC1D,IAAI,UAAU,KAAK,CAAC;YAChB,OAAO,UAAU,CAAC;IAC1B,CAAC;IACD,OAAO,SAAS,CAAC,MAAM,GAAG,UAAU,CAAC,MAAM,CAAC;AAChD,CAAC","sourcesContent":["import { Effect } from \"effect\";\nimport type * as Scope from \"effect/Scope\";\nimport { sampleCapabilityTypeId, type JsonValue, type Sample, type SampleIdentity, } from \"../../analysis/contracts.ts\";\nimport type { LocalizedText } from \"../../shared/types.ts\";\n/** A closed page has no route back to an author callback or a live Sample. */\nexport const RESOLVED_PAGE_FORMAT = \"niceeval.report.resolved-page/v1\";\nexport interface ResolvedPageTarget {\n readonly pageId: string;\n readonly route: string;\n /** Parameter identity is data, never a page loader or encoder callback. */\n readonly params?: JsonValue;\n}\nexport interface ResolvedPageTextProjection {\n readonly locale: string;\n readonly width: number;\n readonly text: string;\n}\nexport interface ResolvedPageWebProjection {\n readonly locale: string;\n readonly html: string;\n}\n/**\n * A closed download remains a real byte payload until the site builder places\n * it in a revision file. This boundary takes ownership through a defensive\n * copy; byte-count limits deliberately remain a site-builder policy.\n */\nexport interface ResolvedPageDownload {\n readonly id: string;\n readonly path: string;\n readonly mediaType: string;\n /** The exact closed payload that view/static must write unchanged. */\n readonly bytes: Uint8Array;\n readonly byteLength: number;\n readonly sha256?: string;\n}\n/** Download payload supplied by the live page-closure phase. */\nexport interface ResolvedPageDownloadOutput {\n readonly id: string;\n readonly path: string;\n readonly mediaType: string;\n readonly bytes: Uint8Array;\n readonly sha256?: string;\n}\n/** Closed renderer payloads that belong in a full site revision, not downloads. */\nexport type ResolvedPageAssetKind = \"style\" | \"script\" | \"source\" | \"diff\" | \"other\";\nexport interface ResolvedPageAsset {\n readonly kind: ResolvedPageAssetKind;\n /** Canonical POSIX-relative path within the eventual revision. */\n readonly path: string;\n readonly mediaType: string;\n /** The exact closed payload that view/static must write unchanged. */\n readonly bytes: Uint8Array;\n readonly byteLength: number;\n readonly sha256?: string;\n}\n/** Asset payload supplied by the live page-closure phase. */\nexport interface ResolvedPageAssetOutput {\n readonly kind: ResolvedPageAssetKind;\n readonly path: string;\n readonly mediaType: string;\n readonly bytes: Uint8Array;\n readonly sha256?: string;\n}\n/**\n * The one closed product of a Page execution. `head` is structured data only;\n * no React element, generic semantic tree, renderer, or author function may\n * survive into this value.\n */\nexport interface ResolvedPage {\n readonly format: typeof RESOLVED_PAGE_FORMAT;\n readonly target: ResolvedPageTarget;\n readonly sample: SampleIdentity;\n readonly title: LocalizedText;\n readonly head: JsonValue;\n readonly text: readonly ResolvedPageTextProjection[];\n readonly web: readonly ResolvedPageWebProjection[];\n readonly downloads: readonly ResolvedPageDownload[];\n readonly assets: readonly ResolvedPageAsset[];\n}\n/** The only live capability passed to the page closure phase. */\nexport interface LiveResolvedPageContext {\n readonly sample: Sample;\n readonly target: ResolvedPageTarget;\n}\n/**\n * The closure phase owns author/component resolution and must produce both\n * projections before the enclosing Sample Scope closes. Its return type has no\n * escape hatch for open component data.\n */\nexport interface ResolvedPageOutput {\n readonly title: LocalizedText;\n readonly head?: JsonValue;\n readonly text: readonly ResolvedPageTextProjection[];\n readonly web: readonly ResolvedPageWebProjection[];\n /** Real payloads are closed here rather than discarded into summaries. */\n readonly downloads?: readonly ResolvedPageDownloadOutput[];\n /** Renderer assets and Source/Diff payloads remain distinct from downloads. */\n readonly assets?: readonly ResolvedPageAssetOutput[];\n}\nexport interface ResolvePageInput<Rendered, Error, Requirements> {\n readonly sample: Sample;\n readonly target: ResolvedPageTarget;\n /** Already adapted at the public callback boundary. Evaluated exactly once. */\n readonly render: Effect.Effect<Rendered, Error, Requirements>;\n /**\n * Resolves every author component and produces all closed projections. This\n * operation is evaluated exactly once and receives the live Sample only here.\n */\n readonly close: (rendered: Rendered, context: LiveResolvedPageContext) => Effect.Effect<ResolvedPageOutput, Error, Requirements>;\n}\nexport interface ResolvedPageClosureError {\n readonly code: \"report-resolved-page-invalid\";\n readonly path: readonly string[];\n readonly reason: string;\n}\n/**\n * Runs one Page render and one component-resolution closure while its caller's\n * Sample Scope is live. The returned object is deliberately data-only, so it\n * can outlive that Scope without retaining a reader, Promise, Effect Scope, or\n * callback.\n */\nexport function resolvePage<Rendered, Error, Requirements>(input: ResolvePageInput<Rendered, Error, Requirements>): Effect.Effect<ResolvedPage, Error | ResolvedPageClosureError, Requirements | Scope.Scope> {\n return Effect.gen(function* () {\n const rendered = yield* input.render;\n const output = yield* input.close(rendered, {\n sample: input.sample,\n target: input.target,\n });\n return yield* closeResolvedPage({\n sample: input.sample,\n target: input.target,\n output,\n });\n });\n}\n/** Finds an already-built terminal projection. It never invokes a renderer. */\nexport function resolvedPageTextProjection(page: ResolvedPage, input: {\n readonly locale: string;\n readonly width: number;\n}): ResolvedPageTextProjection | undefined {\n return page.text.find((projection) => projection.locale === input.locale && projection.width === input.width);\n}\n/** Finds an already-built browser projection. It never invokes a renderer. */\nexport function resolvedPageWebProjection(page: ResolvedPage, input: {\n readonly locale: string;\n}): ResolvedPageWebProjection | undefined {\n return page.web.find((projection) => projection.locale === input.locale);\n}\nfunction closeResolvedPage(input: {\n readonly sample: Sample;\n readonly target: ResolvedPageTarget;\n readonly output: ResolvedPageOutput;\n}): Effect.Effect<ResolvedPage, ResolvedPageClosureError> {\n return Effect.try({\n try: () => freezeResolvedPage(input),\n catch: (error): ResolvedPageClosureError => Object.freeze({\n code: \"report-resolved-page-invalid\" as const,\n path: Object.freeze([]),\n reason: error instanceof Error ? error.message : \"a Page closure returned an invalid value\",\n }),\n });\n}\nfunction freezeResolvedPage(input: {\n readonly sample: Sample;\n readonly target: ResolvedPageTarget;\n readonly output: ResolvedPageOutput;\n}): ResolvedPage {\n const target = freezeTarget(input.target, input.sample);\n const title = freezeLocalizedText(input.output.title, input.sample, [\"title\"]);\n const head = closeJson(input.output.head ?? null, input.sample, [\"head\"], new Set<object>());\n const text = freezeTextProjections(input.output.text, input.sample);\n const web = freezeWebProjections(input.output.web, input.sample);\n const downloads = freezeDownloads(input.output.downloads ?? []);\n const assets = freezeAssets(input.output.assets ?? []);\n assertDistinctPayloadPaths(downloads, assets);\n const sample = input.sample.snapshot.identity;\n if (sample.kind !== \"analysis-sample\" || !isNonEmptyString(sample.id)) {\n throw new TypeError(\"sample identity must be a closed analysis-sample identity\");\n }\n return Object.freeze({\n format: RESOLVED_PAGE_FORMAT,\n target,\n sample: Object.freeze({ kind: \"analysis-sample\" as const, id: sample.id }),\n title,\n head,\n text,\n web,\n downloads,\n assets,\n });\n}\nfunction freezeTarget(input: ResolvedPageTarget, sample: Sample): ResolvedPageTarget {\n if (!isNonEmptyString(input.pageId))\n throw new TypeError(\"target.pageId must be a non-empty string\");\n if (!isNonEmptyString(input.route))\n throw new TypeError(\"target.route must be a non-empty string\");\n return Object.freeze({\n pageId: input.pageId,\n route: input.route,\n ...(input.params === undefined\n ? {}\n : { params: closeJson(input.params, sample, [\"target\", \"params\"], new Set<object>()) }),\n });\n}\nfunction freezeLocalizedText(value: LocalizedText, sample: Sample, path: readonly string[]): LocalizedText {\n if (typeof value === \"string\")\n return value;\n const closed = closeJson(value, sample, path, new Set<object>());\n if (Array.isArray(closed) || closed === null || typeof closed !== \"object\") {\n throw new TypeError(`${path.join(\".\")} must be a string or locale map`);\n }\n const entries = Object.entries(closed);\n if (entries.length === 0 || entries.some(([locale, text]) => !isNonEmptyString(locale) || typeof text !== \"string\")) {\n throw new TypeError(`${path.join(\".\")} must be a non-empty locale map of strings`);\n }\n const result: Record<string, string> = Object.create(null) as Record<string, string>;\n for (const [locale, text] of entries) {\n // The validation above proves this is a locale-string pair.\n result[locale] = text as string;\n }\n return Object.freeze(result);\n}\nfunction freezeTextProjections(value: readonly ResolvedPageTextProjection[], sample: Sample): readonly ResolvedPageTextProjection[] {\n if (!Array.isArray(value) || value.length === 0) {\n throw new TypeError(\"a resolved Page must contain at least one text projection\");\n }\n const seen = new Set<string>();\n const closed = value.map((projection, index) => {\n if (projection === null || typeof projection !== \"object\" || Array.isArray(projection)) {\n throw new TypeError(`text[${index}] must be a projection object`);\n }\n if (rejectLiveCapability(projection, sample, [\"text\", String(index)])) {\n throw new TypeError(`text[${index}] retains a live Sample capability`);\n }\n if (!isNonEmptyString(projection.locale) || !isPositiveSafeInteger(projection.width) || typeof projection.text !== \"string\") {\n throw new TypeError(`text[${index}] must contain locale, positive width, and text`);\n }\n const key = `${projection.locale}\\u0000${projection.width}`;\n if (seen.has(key))\n throw new TypeError(`text projection ${JSON.stringify(key)} is duplicated`);\n seen.add(key);\n return Object.freeze({ locale: projection.locale, width: projection.width, text: projection.text });\n });\n return Object.freeze(closed.sort((left, right) => compareUtf8(left.locale, right.locale) || left.width - right.width));\n}\nfunction freezeWebProjections(value: readonly ResolvedPageWebProjection[], sample: Sample): readonly ResolvedPageWebProjection[] {\n if (!Array.isArray(value) || value.length === 0) {\n throw new TypeError(\"a resolved Page must contain at least one web projection\");\n }\n const seen = new Set<string>();\n const closed = value.map((projection, index) => {\n if (projection === null || typeof projection !== \"object\" || Array.isArray(projection)) {\n throw new TypeError(`web[${index}] must be a projection object`);\n }\n if (rejectLiveCapability(projection, sample, [\"web\", String(index)])) {\n throw new TypeError(`web[${index}] retains a live Sample capability`);\n }\n if (!isNonEmptyString(projection.locale) || typeof projection.html !== \"string\") {\n throw new TypeError(`web[${index}] must contain locale and html`);\n }\n if (seen.has(projection.locale))\n throw new TypeError(`web locale ${JSON.stringify(projection.locale)} is duplicated`);\n seen.add(projection.locale);\n return Object.freeze({ locale: projection.locale, html: projection.html });\n });\n return Object.freeze(closed.sort((left, right) => compareUtf8(left.locale, right.locale)));\n}\nfunction freezeDownloads(value: readonly ResolvedPageDownloadOutput[]): readonly ResolvedPageDownload[] {\n if (!Array.isArray(value))\n throw new TypeError(\"downloads must be an array\");\n const ids = new Set<string>();\n const paths = new Set<string>();\n const closed = value.map((download, index) => {\n if (!isPlainDataRecord(download) || !hasExactFields(download, [\"id\", \"path\", \"mediaType\", \"bytes\", \"sha256\"], [\"id\", \"path\", \"mediaType\", \"bytes\"])) {\n throw new TypeError(`downloads[${index}] must be a closed payload object`);\n }\n if (!isNonEmptyString(download.id) || !isCanonicalRelativePath(download.path) || !isNonEmptyString(download.mediaType) ||\n !(download.bytes instanceof Uint8Array) ||\n (download.sha256 !== undefined && !isNonEmptyString(download.sha256))) {\n throw new TypeError(`downloads[${index}] has an invalid payload`);\n }\n if (ids.has(download.id) || paths.has(download.path)) {\n throw new TypeError(`downloads[${index}] repeats an id or path`);\n }\n ids.add(download.id);\n paths.add(download.path);\n // A non-empty TypedArray cannot be Object.freeze()'d by ECMAScript. The\n // frozen wrapper owns this fresh copy, so later mutation of the author's\n // buffer cannot alter the resolved payload.\n const bytes = new Uint8Array(download.bytes);\n return Object.freeze({\n id: download.id,\n path: download.path,\n mediaType: download.mediaType,\n bytes,\n byteLength: bytes.byteLength,\n ...(download.sha256 === undefined ? {} : { sha256: download.sha256 }),\n });\n });\n return Object.freeze(closed.sort((left, right) => compareUtf8(left.path, right.path) || compareUtf8(left.id, right.id)));\n}\nfunction freezeAssets(value: readonly ResolvedPageAssetOutput[]): readonly ResolvedPageAsset[] {\n if (!Array.isArray(value))\n throw new TypeError(\"assets must be an array\");\n const paths = new Set<string>();\n const closed = value.map((asset, index) => {\n if (!isPlainDataRecord(asset) || !hasExactFields(asset, [\"kind\", \"path\", \"mediaType\", \"bytes\", \"sha256\"], [\"kind\", \"path\", \"mediaType\", \"bytes\"])) {\n throw new TypeError(`assets[${index}] must be a closed payload object`);\n }\n if (!isResolvedPageAssetKind(asset.kind) || !isCanonicalRelativePath(asset.path) ||\n !isNonEmptyString(asset.mediaType) || !(asset.bytes instanceof Uint8Array) ||\n (asset.sha256 !== undefined && !isNonEmptyString(asset.sha256))) {\n throw new TypeError(`assets[${index}] has an invalid payload`);\n }\n if (paths.has(asset.path))\n throw new TypeError(`assets[${index}] repeats a path`);\n paths.add(asset.path);\n // TypedArray elements cannot be frozen by ECMAScript. The frozen wrapper\n // owns this independent payload; callers cannot mutate the author's copy.\n const bytes = new Uint8Array(asset.bytes);\n return Object.freeze({\n kind: asset.kind,\n path: asset.path,\n mediaType: asset.mediaType,\n bytes,\n byteLength: bytes.byteLength,\n ...(asset.sha256 === undefined ? {} : { sha256: asset.sha256 }),\n });\n });\n return Object.freeze(closed.sort((left, right) => compareUtf8(left.path, right.path) ||\n compareUtf8(left.kind, right.kind) ||\n compareUtf8(left.mediaType, right.mediaType)));\n}\n/** A full revision receives one namespace of emitted paths across payload kinds. */\nfunction assertDistinctPayloadPaths(downloads: readonly ResolvedPageDownload[], assets: readonly ResolvedPageAsset[]): void {\n const downloadPaths = new Set(downloads.map((download) => download.path));\n for (const asset of assets) {\n if (downloadPaths.has(asset.path)) {\n throw new TypeError(`asset path ${JSON.stringify(asset.path)} conflicts with a download path`);\n }\n }\n}\nfunction closeJson(value: unknown, sample: Sample, path: readonly string[], active: Set<object>): JsonValue {\n if (value === null || typeof value === \"boolean\" || typeof value === \"string\")\n return value;\n if (typeof value === \"number\") {\n if (!Number.isFinite(value))\n throw new TypeError(`${path.join(\".\")} contains a non-finite number`);\n return value;\n }\n if (typeof value === \"undefined\" || typeof value === \"bigint\" || typeof value === \"symbol\" || typeof value === \"function\") {\n throw new TypeError(`${path.join(\".\")} contains a non-closed value`);\n }\n if (rejectLiveCapability(value, sample, path)) {\n throw new TypeError(`${path.join(\".\")} retains a live Sample capability`);\n }\n if (active.has(value))\n throw new TypeError(`${path.join(\".\")} contains a cycle`);\n active.add(value);\n try {\n if (Array.isArray(value)) {\n return Object.freeze(value.map((entry, index) => closeJson(entry, sample, [...path, String(index)], active)));\n }\n if (!isPlainDataRecord(value)) {\n throw new TypeError(`${path.join(\".\")} must be a plain data object`);\n }\n const result: Record<string, JsonValue> = Object.create(null) as Record<string, JsonValue>;\n for (const key of Object.keys(value).sort(compareUtf8)) {\n result[key] = closeJson(value[key], sample, [...path, key], active);\n }\n return Object.freeze(result);\n }\n finally {\n active.delete(value);\n }\n}\nfunction rejectLiveCapability(value: object, sample: Sample, _path: readonly string[]): boolean {\n if (value === sample)\n return true;\n const brand = Object.getOwnPropertyDescriptor(value, sampleCapabilityTypeId);\n if (brand !== undefined && \"value\" in brand && brand.value === true)\n return true;\n const kind = Object.getOwnPropertyDescriptor(value, \"kind\");\n const snapshot = Object.getOwnPropertyDescriptor(value, \"snapshot\");\n return kind !== undefined && \"value\" in kind && kind.value === \"analysis-sample\" && snapshot !== undefined;\n}\nfunction isPlainDataRecord(value: object): value is Readonly<Record<string, unknown>> {\n if (Object.getPrototypeOf(value) !== Object.prototype && Object.getPrototypeOf(value) !== null)\n return false;\n for (const key of Reflect.ownKeys(value)) {\n if (typeof key !== \"string\")\n return false;\n const descriptor = Object.getOwnPropertyDescriptor(value, key);\n if (descriptor === undefined || !descriptor.enumerable || !(\"value\" in descriptor))\n return false;\n }\n return true;\n}\nfunction hasExactFields(value: Readonly<Record<string, unknown>>, allowed: readonly string[], required: readonly string[]): boolean {\n const keys = Object.getOwnPropertyNames(value);\n return keys.every((key) => allowed.includes(key)) &&\n required.every((key) => Object.hasOwn(value, key));\n}\nfunction isNonEmptyString(value: unknown): value is string {\n return typeof value === \"string\" && value.length > 0;\n}\nfunction isPositiveSafeInteger(value: unknown): value is number {\n return typeof value === \"number\" && Number.isSafeInteger(value) && value > 0;\n}\nfunction isResolvedPageAssetKind(value: unknown): value is ResolvedPageAssetKind {\n return value === \"style\" || value === \"script\" || value === \"source\" || value === \"diff\" || value === \"other\";\n}\nfunction isCanonicalRelativePath(value: unknown): value is string {\n if (!isNonEmptyString(value) || value.startsWith(\"/\") || value.endsWith(\"/\") || value.includes(\"\\\\\") || value.includes(\"\\u0000\")) {\n return false;\n }\n return value.split(\"/\").every((segment) => segment.length > 0 && segment !== \".\" && segment !== \"..\");\n}\nconst textEncoder = new TextEncoder();\n/** UTF-8 byte ordering is the canonical ordering shared by machine output. */\nexport function compareUtf8(left: string, right: string): number {\n if (left === right)\n return 0;\n const leftBytes = textEncoder.encode(left);\n const rightBytes = textEncoder.encode(right);\n const length = Math.min(leftBytes.length, rightBytes.length);\n for (let index = 0; index < length; index += 1) {\n const difference = leftBytes[index]! - rightBytes[index]!;\n if (difference !== 0)\n return difference;\n }\n return leftBytes.length - rightBytes.length;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"resolved-page.js","sourceRoot":"","sources":["resolved-page.ts"],"names":[],"mappings":";;;AA2HA,kCAaC;AAED,gEAQC;AAED,8DAIC;AAyRD,kCAYC;AA7bD,mCAAgC;AAEhC,8DAAwH;AAGxH,8EAA8E;AACjE,QAAA,oBAAoB,GAAG,kCAAkC,CAAC;AA+GvE;;;;;GAKG;AACH,SAAgB,WAAW,CAAgC,KAAsD;IAC7G,OAAO,eAAM,CAAC,GAAG,CAAC,QAAQ,CAAC;QACvB,MAAM,QAAQ,GAAG,KAAK,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC;QACrC,MAAM,MAAM,GAAG,KAAK,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,QAAQ,EAAE;YACxC,MAAM,EAAE,KAAK,CAAC,MAAM;YACpB,MAAM,EAAE,KAAK,CAAC,MAAM;SACvB,CAAC,CAAC;QACH,OAAO,KAAK,CAAC,CAAC,iBAAiB,CAAC;YAC5B,MAAM,EAAE,KAAK,CAAC,MAAM;YACpB,MAAM,EAAE,KAAK,CAAC,MAAM;YACpB,MAAM;SACT,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;AACP,CAAC;AACD,+EAA+E;AAC/E,SAAgB,0BAA0B,CAAC,IAAkB,EAAE,KAI9D;IACG,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,UAAU,EAAE,EAAE,CAAC,UAAU,CAAC,MAAM,KAAK,KAAK,CAAC,MAAM;QACpE,UAAU,CAAC,KAAK,KAAK,KAAK,CAAC,KAAK;QAChC,UAAU,CAAC,SAAS,KAAK,KAAK,CAAC,SAAS,CAAC,CAAC;AAClD,CAAC;AACD,8EAA8E;AAC9E,SAAgB,yBAAyB,CAAC,IAAkB,EAAE,KAE7D;IACG,OAAO,IA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O,KAAK,IAAI,CAAC,CAAC;AAC1G,CAAC;AACD,MAAM,WAAW,GAAG,IAAI,WAAW,EAAE,CAAC;AACtC,8EAA8E;AAC9E,SAAgB,WAAW,CAAC,IAAY,EAAE,KAAa;IACnD,IAAI,IAAI,KAAK,KAAK;QACd,OAAO,CAAC,CAAC;IACb,MAAM,SAAS,GAAG,WAAW,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IAC3C,MAAM,UAAU,GAAG,WAAW,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IAC7C,MAAM,MAAM,GAAG,IAAI,CAAC,GAAG,CAAC,SAAS,CAAC,MAAM,EAAE,UAAU,CAAC,MAAM,CAAC,CAAC;IAC7D,KAAK,IAAI,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,MAAM,EAAE,KAAK,IAAI,CAAC,EAAE,CAAC;QAC7C,MAAM,UAAU,GAAG,SAAS,CAAC,KAAK,CAAE,GAAG,UAAU,CAAC,KAAK,CAAE,CAAC;QAC1D,IAAI,UAAU,KAAK,CAAC;YAChB,OAAO,UAAU,CAAC;IAC1B,CAAC;IACD,OAAO,SAAS,CAAC,MAAM,GAAG,UAAU,CAAC,MAAM,CAAC;AAChD,CAAC","sourcesContent":["import { Effect } from \"effect\";\nimport type * as Scope from \"effect/Scope\";\nimport { sampleCapabilityTypeId, type JsonValue, type Sample, type SampleIdentity, } from \"../../analysis/contracts.ts\";\nimport type { LocalizedText } from \"../../shared/types.ts\";\nimport type { PanelMode } from \"../model/panel.ts\";\n/** A closed page has no route back to an author callback or a live Sample. */\nexport const RESOLVED_PAGE_FORMAT = \"niceeval.report.resolved-page/v1\";\nexport interface ResolvedPageTarget {\n readonly pageId: string;\n readonly route: string;\n /** Parameter identity is data, never a page loader or encoder callback. */\n readonly params?: JsonValue;\n}\nexport interface ResolvedPageTextProjection {\n readonly locale: string;\n readonly width: number;\n readonly panelMode: PanelMode;\n readonly text: string;\n}\nexport interface ResolvedPageWebProjection {\n readonly locale: string;\n readonly html: string;\n}\n/**\n * A closed download remains a real byte payload until the site builder places\n * it in a revision file. This boundary takes ownership through a defensive\n * copy; byte-count limits deliberately remain a site-builder policy.\n */\nexport interface ResolvedPageDownload {\n readonly id: string;\n readonly path: string;\n readonly mediaType: string;\n /** The exact closed payload that view/static must write unchanged. */\n readonly bytes: Uint8Array;\n readonly byteLength: number;\n readonly sha256?: string;\n}\n/** Download payload supplied by the live page-closure phase. */\nexport interface ResolvedPageDownloadOutput {\n readonly id: string;\n readonly path: string;\n readonly mediaType: string;\n readonly bytes: Uint8Array;\n readonly sha256?: string;\n}\n/** Closed renderer payloads that belong in a full site revision, not downloads. */\nexport type ResolvedPageAssetKind = \"style\" | \"script\" | \"source\" | \"diff\" | \"other\";\nexport interface ResolvedPageAsset {\n readonly kind: ResolvedPageAssetKind;\n /** Canonical POSIX-relative path within the eventual revision. */\n readonly path: string;\n readonly mediaType: string;\n /** The exact closed payload that view/static must write unchanged. */\n readonly bytes: Uint8Array;\n readonly byteLength: number;\n readonly sha256?: string;\n}\n/** Asset payload supplied by the live page-closure phase. */\nexport interface ResolvedPageAssetOutput {\n readonly kind: ResolvedPageAssetKind;\n readonly path: string;\n readonly mediaType: string;\n readonly bytes: Uint8Array;\n readonly sha256?: string;\n}\n/**\n * The one closed product of a Page execution. `head` is structured data only;\n * no React element, generic semantic tree, renderer, or author function may\n * survive into this value.\n */\nexport interface ResolvedPage {\n readonly format: typeof RESOLVED_PAGE_FORMAT;\n readonly target: ResolvedPageTarget;\n readonly sample: SampleIdentity;\n readonly title: LocalizedText;\n readonly head: JsonValue;\n readonly text: readonly ResolvedPageTextProjection[];\n readonly web: readonly ResolvedPageWebProjection[];\n readonly downloads: readonly ResolvedPageDownload[];\n readonly assets: readonly ResolvedPageAsset[];\n}\n/** The only live capability passed to the page closure phase. */\nexport interface LiveResolvedPageContext {\n readonly sample: Sample;\n readonly target: ResolvedPageTarget;\n}\n/**\n * The closure phase owns author/component resolution and must produce both\n * projections before the enclosing Sample Scope closes. Its return type has no\n * escape hatch for open component data.\n */\nexport interface ResolvedPageOutput {\n readonly title: LocalizedText;\n readonly head?: JsonValue;\n readonly text: readonly ResolvedPageTextProjection[];\n readonly web: readonly ResolvedPageWebProjection[];\n /** Real payloads are closed here rather than discarded into summaries. */\n readonly downloads?: readonly ResolvedPageDownloadOutput[];\n /** Renderer assets and Source/Diff payloads remain distinct from downloads. */\n readonly assets?: readonly ResolvedPageAssetOutput[];\n}\nexport interface ResolvePageInput<Rendered, Error, Requirements> {\n readonly sample: Sample;\n readonly target: ResolvedPageTarget;\n /** Already adapted at the public callback boundary. Evaluated exactly once. */\n readonly render: Effect.Effect<Rendered, Error, Requirements>;\n /**\n * Resolves every author component and produces all closed projections. This\n * operation is evaluated exactly once and receives the live Sample only here.\n */\n readonly close: (rendered: Rendered, context: LiveResolvedPageContext) => Effect.Effect<ResolvedPageOutput, Error, Requirements>;\n}\nexport interface ResolvedPageClosureError {\n readonly code: \"report-resolved-page-invalid\";\n readonly path: readonly string[];\n readonly reason: string;\n}\n/**\n * Runs one Page render and one component-resolution closure while its caller's\n * Sample Scope is live. The returned object is deliberately data-only, so it\n * can outlive that Scope without retaining a reader, Promise, Effect Scope, or\n * callback.\n */\nexport function resolvePage<Rendered, Error, Requirements>(input: ResolvePageInput<Rendered, Error, Requirements>): Effect.Effect<ResolvedPage, Error | ResolvedPageClosureError, Requirements | Scope.Scope> {\n return Effect.gen(function* () {\n const rendered = yield* input.render;\n const output = yield* input.close(rendered, {\n sample: input.sample,\n target: input.target,\n });\n return yield* closeResolvedPage({\n sample: input.sample,\n target: input.target,\n output,\n });\n });\n}\n/** Finds an already-built terminal projection. It never invokes a renderer. */\nexport function resolvedPageTextProjection(page: ResolvedPage, input: {\n readonly locale: string;\n readonly width: number;\n readonly panelMode: PanelMode;\n}): ResolvedPageTextProjection | undefined {\n return page.text.find((projection) => projection.locale === input.locale &&\n projection.width === input.width &&\n projection.panelMode === input.panelMode);\n}\n/** Finds an already-built browser projection. It never invokes a renderer. */\nexport function resolvedPageWebProjection(page: ResolvedPage, input: {\n readonly locale: string;\n}): ResolvedPageWebProjection | undefined {\n return page.web.find((projection) => projection.locale === input.locale);\n}\nfunction closeResolvedPage(input: {\n readonly sample: Sample;\n readonly target: ResolvedPageTarget;\n readonly output: ResolvedPageOutput;\n}): Effect.Effect<ResolvedPage, ResolvedPageClosureError> {\n return Effect.try({\n try: () => freezeResolvedPage(input),\n catch: (error): ResolvedPageClosureError => Object.freeze({\n code: \"report-resolved-page-invalid\" as const,\n path: Object.freeze([]),\n reason: error instanceof Error ? error.message : \"a Page closure returned an invalid value\",\n }),\n });\n}\nfunction freezeResolvedPage(input: {\n readonly sample: Sample;\n readonly target: ResolvedPageTarget;\n readonly output: ResolvedPageOutput;\n}): ResolvedPage {\n const target = freezeTarget(input.target, input.sample);\n const title = freezeLocalizedText(input.output.title, input.sample, [\"title\"]);\n const head = closeJson(input.output.head ?? null, input.sample, [\"head\"], new Set<object>());\n const text = freezeTextProjections(input.output.text, input.sample);\n const web = freezeWebProjections(input.output.web, input.sample);\n const downloads = freezeDownloads(input.output.downloads ?? []);\n const assets = freezeAssets(input.output.assets ?? []);\n assertDistinctPayloadPaths(downloads, assets);\n const sample = input.sample.snapshot.identity;\n if (sample.kind !== \"analysis-sample\" || !isNonEmptyString(sample.id)) {\n throw new TypeError(\"sample identity must be a closed analysis-sample identity\");\n }\n return Object.freeze({\n format: RESOLVED_PAGE_FORMAT,\n target,\n sample: Object.freeze({ kind: \"analysis-sample\" as const, id: sample.id }),\n title,\n head,\n text,\n web,\n downloads,\n assets,\n });\n}\nfunction freezeTarget(input: ResolvedPageTarget, sample: Sample): ResolvedPageTarget {\n if (!isNonEmptyString(input.pageId))\n throw new TypeError(\"target.pageId must be a non-empty string\");\n if (!isNonEmptyString(input.route))\n throw new TypeError(\"target.route must be a non-empty string\");\n return Object.freeze({\n pageId: input.pageId,\n route: input.route,\n ...(input.params === undefined\n ? {}\n : { params: closeJson(input.params, sample, [\"target\", \"params\"], new Set<object>()) }),\n });\n}\nfunction freezeLocalizedText(value: LocalizedText, sample: Sample, path: readonly string[]): LocalizedText {\n if (typeof value === \"string\")\n return value;\n const closed = closeJson(value, sample, path, new Set<object>());\n if (Array.isArray(closed) || closed === null || typeof closed !== \"object\") {\n throw new TypeError(`${path.join(\".\")} must be a string or locale map`);\n }\n const entries = Object.entries(closed);\n if (entries.length === 0 || entries.some(([locale, text]) => !isNonEmptyString(locale) || typeof text !== \"string\")) {\n throw new TypeError(`${path.join(\".\")} must be a non-empty locale map of strings`);\n }\n const result: Record<string, string> = Object.create(null) as Record<string, string>;\n for (const [locale, text] of entries) {\n // The validation above proves this is a locale-string pair.\n result[locale] = text as string;\n }\n return Object.freeze(result);\n}\nfunction freezeTextProjections(value: readonly ResolvedPageTextProjection[], sample: Sample): readonly ResolvedPageTextProjection[] {\n if (!Array.isArray(value) || value.length === 0) {\n throw new TypeError(\"a resolved Page must contain at least one text projection\");\n }\n const seen = new Set<string>();\n const closed = value.map((projection, index) => {\n if (projection === null || typeof projection !== \"object\" || Array.isArray(projection)) {\n throw new TypeError(`text[${index}] must be a projection object`);\n }\n if (rejectLiveCapability(projection, sample, [\"text\", String(index)])) {\n throw new TypeError(`text[${index}] retains a live Sample capability`);\n }\n if (!isNonEmptyString(projection.locale) || !isPositiveSafeInteger(projection.width) ||\n (projection.panelMode !== \"boxed\" && projection.panelMode !== \"plain\") || typeof projection.text !== \"string\") {\n throw new TypeError(`text[${index}] must contain locale, positive width, panel mode, and text`);\n }\n const key = `${projection.locale}\\u0000${projection.width}\\u0000${projection.panelMode}`;\n if (seen.has(key))\n throw new TypeError(`text projection ${JSON.stringify(key)} is duplicated`);\n seen.add(key);\n return Object.freeze({\n locale: projection.locale,\n width: projection.width,\n panelMode: projection.panelMode,\n text: projection.text,\n });\n });\n return Object.freeze(closed.sort((left, right) => compareUtf8(left.locale, right.locale) ||\n left.width - right.width ||\n compareUtf8(left.panelMode, right.panelMode)));\n}\nfunction freezeWebProjections(value: readonly ResolvedPageWebProjection[], sample: Sample): readonly ResolvedPageWebProjection[] {\n if (!Array.isArray(value) || value.length === 0) {\n throw new TypeError(\"a resolved Page must contain at least one web projection\");\n }\n const seen = new Set<string>();\n const closed = value.map((projection, index) => {\n if (projection === null || typeof projection !== \"object\" || Array.isArray(projection)) {\n throw new TypeError(`web[${index}] must be a projection object`);\n }\n if (rejectLiveCapability(projection, sample, [\"web\", String(index)])) {\n throw new TypeError(`web[${index}] retains a live Sample capability`);\n }\n if (!isNonEmptyString(projection.locale) || typeof projection.html !== \"string\") {\n throw new TypeError(`web[${index}] must contain locale and html`);\n }\n if (seen.has(projection.locale))\n throw new TypeError(`web locale ${JSON.stringify(projection.locale)} is duplicated`);\n seen.add(projection.locale);\n return Object.freeze({ locale: projection.locale, html: projection.html });\n });\n return Object.freeze(closed.sort((left, right) => compareUtf8(left.locale, right.locale)));\n}\nfunction freezeDownloads(value: readonly ResolvedPageDownloadOutput[]): readonly ResolvedPageDownload[] {\n if (!Array.isArray(value))\n throw new TypeError(\"downloads must be an array\");\n const ids = new Set<string>();\n const paths = new Set<string>();\n const closed = value.map((download, index) => {\n if (!isPlainDataRecord(download) || !hasExactFields(download, [\"id\", \"path\", \"mediaType\", \"bytes\", \"sha256\"], [\"id\", \"path\", \"mediaType\", \"bytes\"])) {\n throw new TypeError(`downloads[${index}] must be a closed payload object`);\n }\n if (!isNonEmptyString(download.id) || !isCanonicalRelativePath(download.path) || !isNonEmptyString(download.mediaType) ||\n !(download.bytes instanceof Uint8Array) ||\n (download.sha256 !== undefined && !isNonEmptyString(download.sha256))) {\n throw new TypeError(`downloads[${index}] has an invalid payload`);\n }\n if (ids.has(download.id) || paths.has(download.path)) {\n throw new TypeError(`downloads[${index}] repeats an id or path`);\n }\n ids.add(download.id);\n paths.add(download.path);\n // A non-empty TypedArray cannot be Object.freeze()'d by ECMAScript. The\n // frozen wrapper owns this fresh copy, so later mutation of the author's\n // buffer cannot alter the resolved payload.\n const bytes = new Uint8Array(download.bytes);\n return Object.freeze({\n id: download.id,\n path: download.path,\n mediaType: download.mediaType,\n bytes,\n byteLength: bytes.byteLength,\n ...(download.sha256 === undefined ? {} : { sha256: download.sha256 }),\n });\n });\n return Object.freeze(closed.sort((left, right) => compareUtf8(left.path, right.path) || compareUtf8(left.id, right.id)));\n}\nfunction freezeAssets(value: readonly ResolvedPageAssetOutput[]): readonly ResolvedPageAsset[] {\n if (!Array.isArray(value))\n throw new TypeError(\"assets must be an array\");\n const paths = new Set<string>();\n const closed = value.map((asset, index) => {\n if (!isPlainDataRecord(asset) || !hasExactFields(asset, [\"kind\", \"path\", \"mediaType\", \"bytes\", \"sha256\"], [\"kind\", \"path\", \"mediaType\", \"bytes\"])) {\n throw new TypeError(`assets[${index}] must be a closed payload object`);\n }\n if (!isResolvedPageAssetKind(asset.kind) || !isCanonicalRelativePath(asset.path) ||\n !isNonEmptyString(asset.mediaType) || !(asset.bytes instanceof Uint8Array) ||\n (asset.sha256 !== undefined && !isNonEmptyString(asset.sha256))) {\n throw new TypeError(`assets[${index}] has an invalid payload`);\n }\n if (paths.has(asset.path))\n throw new TypeError(`assets[${index}] repeats a path`);\n paths.add(asset.path);\n // TypedArray elements cannot be frozen by ECMAScript. The frozen wrapper\n // owns this independent payload; callers cannot mutate the author's copy.\n const bytes = new Uint8Array(asset.bytes);\n return Object.freeze({\n kind: asset.kind,\n path: asset.path,\n mediaType: asset.mediaType,\n bytes,\n byteLength: bytes.byteLength,\n ...(asset.sha256 === undefined ? {} : { sha256: asset.sha256 }),\n });\n });\n return Object.freeze(closed.sort((left, right) => compareUtf8(left.path, right.path) ||\n compareUtf8(left.kind, right.kind) ||\n compareUtf8(left.mediaType, right.mediaType)));\n}\n/** A full revision receives one namespace of emitted paths across payload kinds. */\nfunction assertDistinctPayloadPaths(downloads: readonly ResolvedPageDownload[], assets: readonly ResolvedPageAsset[]): void {\n const downloadPaths = new Set(downloads.map((download) => download.path));\n for (const asset of assets) {\n if (downloadPaths.has(asset.path)) {\n throw new TypeError(`asset path ${JSON.stringify(asset.path)} conflicts with a download path`);\n }\n }\n}\nfunction closeJson(value: unknown, sample: Sample, path: readonly string[], active: Set<object>): JsonValue {\n if (value === null || typeof value === \"boolean\" || typeof value === \"string\")\n return value;\n if (typeof value === \"number\") {\n if (!Number.isFinite(value))\n throw new TypeError(`${path.join(\".\")} contains a non-finite number`);\n return value;\n }\n if (typeof value === \"undefined\" || typeof value === \"bigint\" || typeof value === \"symbol\" || typeof value === \"function\") {\n throw new TypeError(`${path.join(\".\")} contains a non-closed value`);\n }\n if (rejectLiveCapability(value, sample, path)) {\n throw new TypeError(`${path.join(\".\")} retains a live Sample capability`);\n }\n if (active.has(value))\n throw new TypeError(`${path.join(\".\")} contains a cycle`);\n active.add(value);\n try {\n if (Array.isArray(value)) {\n return Object.freeze(value.map((entry, index) => closeJson(entry, sample, [...path, String(index)], active)));\n }\n if (!isPlainDataRecord(value)) {\n throw new TypeError(`${path.join(\".\")} must be a plain data object`);\n }\n const result: Record<string, JsonValue> = Object.create(null) as Record<string, JsonValue>;\n for (const key of Object.keys(value).sort(compareUtf8)) {\n result[key] = closeJson(value[key], sample, [...path, key], active);\n }\n return Object.freeze(result);\n }\n finally {\n active.delete(value);\n }\n}\nfunction rejectLiveCapability(value: object, sample: Sample, _path: readonly string[]): boolean {\n if (value === sample)\n return true;\n const brand = Object.getOwnPropertyDescriptor(value, sampleCapabilityTypeId);\n if (brand !== undefined && \"value\" in brand && brand.value === true)\n return true;\n const kind = Object.getOwnPropertyDescriptor(value, \"kind\");\n const snapshot = Object.getOwnPropertyDescriptor(value, \"snapshot\");\n return kind !== undefined && \"value\" in kind && kind.value === \"analysis-sample\" && snapshot !== undefined;\n}\nfunction isPlainDataRecord(value: object): value is Readonly<Record<string, unknown>> {\n if (Object.getPrototypeOf(value) !== Object.prototype && Object.getPrototypeOf(value) !== null)\n return false;\n for (const key of Reflect.ownKeys(value)) {\n if (typeof key !== \"string\")\n return false;\n const descriptor = Object.getOwnPropertyDescriptor(value, key);\n if (descriptor === undefined || !descriptor.enumerable || !(\"value\" in descriptor))\n return false;\n }\n return true;\n}\nfunction hasExactFields(value: Readonly<Record<string, unknown>>, allowed: readonly string[], required: readonly string[]): boolean {\n const keys = Object.getOwnPropertyNames(value);\n return keys.every((key) => allowed.includes(key)) &&\n required.every((key) => Object.hasOwn(value, key));\n}\nfunction isNonEmptyString(value: unknown): value is string {\n return typeof value === \"string\" && value.length > 0;\n}\nfunction isPositiveSafeInteger(value: unknown): value is number {\n return typeof value === \"number\" && Number.isSafeInteger(value) && value > 0;\n}\nfunction isResolvedPageAssetKind(value: unknown): value is ResolvedPageAssetKind {\n return value === \"style\" || value === \"script\" || value === \"source\" || value === \"diff\" || value === \"other\";\n}\nfunction isCanonicalRelativePath(value: unknown): value is string {\n if (!isNonEmptyString(value) || value.startsWith(\"/\") || value.endsWith(\"/\") || value.includes(\"\\\\\") || value.includes(\"\\u0000\")) {\n return false;\n }\n return value.split(\"/\").every((segment) => segment.length > 0 && segment !== \".\" && segment !== \"..\");\n}\nconst textEncoder = new TextEncoder();\n/** UTF-8 byte ordering is the canonical ordering shared by machine output. */\nexport function compareUtf8(left: string, right: string): number {\n if (left === right)\n return 0;\n const leftBytes = textEncoder.encode(left);\n const rightBytes = textEncoder.encode(right);\n const length = Math.min(leftBytes.length, rightBytes.length);\n for (let index = 0; index < length; index += 1) {\n const difference = leftBytes[index]! - rightBytes[index]!;\n if (difference !== 0)\n return difference;\n }\n return leftBytes.length - rightBytes.length;\n}\n"]}
|