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.
Files changed (41) hide show
  1. package/dist/cli.cjs +10 -1
  2. package/dist/cli.cjs.map +1 -1
  3. package/dist/report/execution/machine.cjs +1 -1
  4. package/dist/report/execution/machine.cjs.map +1 -1
  5. package/dist/report/host/execute.cjs +14 -4
  6. package/dist/report/host/execute.cjs.map +1 -1
  7. package/dist/report/host/execute.d.cts +5 -0
  8. package/dist/report/host/execute.d.mts +5 -0
  9. package/dist/report/host/execute.d.ts +5 -0
  10. package/dist/report/host/from-record.cjs +6 -1
  11. package/dist/report/host/from-record.cjs.map +1 -1
  12. package/dist/report/host/from-record.d.cts +5 -0
  13. package/dist/report/host/from-record.d.mts +5 -0
  14. package/dist/report/host/from-record.d.ts +5 -0
  15. package/dist/report/runtime/resolved-page.cjs +16 -6
  16. package/dist/report/runtime/resolved-page.cjs.map +1 -1
  17. package/dist/report/runtime/resolved-page.d.cts +3 -0
  18. package/dist/report/runtime/resolved-page.d.mts +3 -0
  19. package/dist/report/runtime/resolved-page.d.ts +3 -0
  20. package/dist/report/runtime/text.cjs +1 -0
  21. package/dist/report/runtime/text.cjs.map +1 -1
  22. package/dist/report/runtime/text.d.cts +4 -0
  23. package/dist/report/runtime/text.d.mts +4 -0
  24. package/dist/report/runtime/text.d.ts +4 -0
  25. package/docs-site/zh/explanation/runner.mdx +2 -2
  26. package/docs-site/zh/index.mdx +2 -2
  27. package/docs-site/zh/reference/cli.mdx +14 -14
  28. package/docs-site/zh/reference/events.mdx +1 -1
  29. package/docs-site/zh/troubleshooting/debugging.mdx +2 -2
  30. package/docs-site/zh/tutorials/agent-feedback-loop.mdx +2 -2
  31. package/docs-site/zh/tutorials/ci-integration.mdx +1 -1
  32. package/docs-site/zh/tutorials/connect-your-agent.mdx +2 -2
  33. package/docs-site/zh/tutorials/custom-reports.mdx +4 -4
  34. package/docs-site/zh/tutorials/deploy-report-site.mdx +3 -3
  35. package/docs-site/zh/tutorials/experiments.mdx +2 -2
  36. package/docs-site/zh/tutorials/handle-execution-failures.mdx +1 -1
  37. package/docs-site/zh/tutorials/install-custom-sandbox-agent.mdx +1 -1
  38. package/docs-site/zh/tutorials/publish-report.mdx +4 -4
  39. package/docs-site/zh/tutorials/reporters.mdx +1 -1
  40. package/docs-site/zh/tutorials/viewing-results.mdx +9 -9
  41. package/package.json +1 -1
@@ -290,7 +290,7 @@ function customTargetExecutionManifest(input) {
290
290
  if (!isPositiveSafeInteger(input.textWidth)) {
291
291
  throw new TypeError("custom target execution textWidth must be a positive safe integer");
292
292
  }
293
- const text = (0, text_ts_1.resolvedPageText)(input.page, { locale: "en", width: input.textWidth });
293
+ const text = (0, text_ts_1.resolvedPageText)(input.page, { locale: "en", width: input.textWidth, panelMode: "plain" });
294
294
  if (!("state" in text) || text.state !== "rendered") {
295
295
  throw new TypeError("the selected Page lacks a closed English text projection at the requested width");
296
296
  }
@@ -1 +1 @@
1
- {"version":3,"file":"machine.js","sourceRoot":"","sources":["machine.ts"],"names":[],"mappings":";;;AAsMA,wDAqCC;AAED,wDAEC;AAED,0DA2BC;AAuID,wEAYC;AAED,gEAMC;AAED,wEAWC;AAED,gEAOC;AAKD,wDAwBC;AAED,kDA4BC;AAMD,sEA4CC;AAED,oDAEC;AAED,4CAEC;AAKD,0DAEC;AAzjBD,mCAAgC;AAGhC,oDAAqF;AAErF,kEAA8E;AAC9E,gDAAsD;AAGtD,gEAAgE;AACnD,QAAA,oBAAoB,GAAG,kBAAkB,CAAC;AAC1C,QAAA,8BAA8B,GAAG,qCAAqC,CAAC;AACvE,QAAA,yBAAyB,GAAG,gCAAgC,CAAC;AAoL1E;;;;;GAKG;AACH,SAAgB,sBAAsB,CAAC,KAGtC;IACG,MAAM,cAAc,GAAG,KAAK,CAAC,cAAc,KAAK,IAAI;QAChD,CAAC,CAAC,IAAI;QACN,CAAC,CAAC,SAAS,CAAC,KAAK,CAAC,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AAG,CAAC,CAAC;AACjF,CAAC","sourcesContent":["import { Effect } from \"effect\";\nimport type * as Scope from \"effect/Scope\";\nimport type { JsonValue, Sample, } from \"../../analysis/contracts.ts\";\nimport { isCostProjectionValue, type PricingProfile, } from \"../../analysis/cost.ts\";\nimport type { LocalizedText } from \"../../shared/types.ts\";\nimport { compareUtf8, type ResolvedPage, } from \"../runtime/resolved-page.ts\";\nimport { resolvedPageText } from \"../runtime/text.ts\";\n/** Content-addressed identities are opaque, printable strings at this boundary. */\nexport type ContentAddress = string;\n/** The exact machine schemas in docs/feature/reports/cli.md. */\nexport const BUILT_IN_SHOW_SCHEMA = \"niceeval.show/v1\";\nexport const CUSTOM_TARGET_EXECUTION_SCHEMA = \"niceeval.report-target-execution/v1\";\nexport const REPORT_PROJECTIONS_SCHEMA = \"niceeval.report-projections/v1\";\nexport type BuiltInReportToken = string;\nexport type ShowSelection = {\n readonly kind: \"project-current\";\n readonly sampleIdentity: ContentAddress;\n readonly experimentIds: readonly string[];\n} | {\n readonly kind: \"explicit-runs\";\n readonly sampleIdentity: ContentAddress;\n readonly runIds: readonly string[];\n} | {\n readonly kind: \"attempt-locator\";\n readonly sampleIdentity: ContentAddress;\n readonly locator: string;\n};\n/**\n * Host-owned problems expose canonical ordering inputs. Their exact detailed\n * shape remains Host-owned; no callback, Error, Cause, or reader is allowed.\n */\nexport interface ReportProblem {\n readonly code: string;\n readonly path: readonly string[];\n readonly refs: readonly string[];\n readonly summary?: string;\n}\n/**\n * Built-ins may emit only their declared domain families. This is intentionally\n * not a generic component/HTML/text reverse-engineering format.\n */\nexport type BuiltInShowData = {\n readonly kind: \"leaderboard\";\n readonly rows: JsonValue;\n} | {\n readonly kind: \"attempt\";\n readonly evidence: JsonValue;\n readonly observability: JsonValue;\n readonly fileChanges: JsonValue;\n} | {\n readonly kind: \"source\";\n readonly sources: JsonValue;\n} | {\n readonly kind: \"execution\";\n readonly execution: JsonValue;\n} | {\n readonly kind: \"timing\";\n readonly timing: JsonValue;\n};\nexport interface BuiltInShowDocument {\n readonly schema: typeof BUILT_IN_SHOW_SCHEMA;\n readonly locale: \"en\";\n readonly selection: ShowSelection;\n readonly report: {\n readonly token: BuiltInReportToken;\n readonly identity: ContentAddress;\n };\n readonly page: {\n readonly route: string;\n readonly pageId: string;\n readonly title: LocalizedText;\n };\n readonly data: BuiltInShowData;\n readonly projections: ReportProjections;\n readonly problems: readonly ReportProblem[];\n}\n/**\n * The custom schema is a single target execution manifest, never a revision.\n * It contains only the selected Page's closed English text—not a React tree,\n * HTML body, site identity, Sample capability, Record payload, or raw bytes.\n */\nexport interface CustomTargetExecutionManifest {\n readonly schema: typeof CUSTOM_TARGET_EXECUTION_SCHEMA;\n readonly locale: \"en\";\n readonly selection: ShowSelection;\n readonly report: {\n readonly identity: ContentAddress;\n readonly title: LocalizedText;\n };\n readonly page: {\n readonly route: string;\n readonly pageId: string;\n readonly title: LocalizedText;\n readonly renderedText: string;\n };\n readonly downloads: readonly {\n readonly path: string;\n readonly mediaType: string;\n readonly bytes: number;\n }[];\n readonly projections: ReportProjections;\n readonly problems: readonly ReportProblem[];\n}\n/** One captured cost projection bound to the Page execution that requested it. */\nexport interface ReportProjectionCost {\n readonly page: {\n readonly pageId: string;\n readonly route: string;\n };\n readonly measureId: string;\n readonly row: {\n readonly key: string;\n readonly dimensions: Readonly<Record<string, JsonValue>>;\n };\n readonly profileIdentity: string;\n /** Analysis-owned closed projection; Report never rebuilds it from `value`. */\n readonly projection: JsonValue;\n}\n/**\n * The top-level projections object shared verbatim by the built-in show\n * document and the custom target-execution manifest, and written as the site\n * revision's `_niceeval/data/projections.json`. `pricingProfile` is the\n * closed JSON form of the Report's PricingProfile, or null when the Report\n * declares none. `costs` is canonical: route → pageId → measureId → row.key\n * → profileIdentity. A projection may appear on distinct Pages; distinct\n * dimensions or projections at one canonical capture key are a build failure.\n */\nexport interface ReportProjections {\n readonly schema: typeof REPORT_PROJECTIONS_SCHEMA;\n readonly pricingProfile: JsonValue | null;\n readonly costs: readonly ReportProjectionCost[];\n}\nexport interface ReportProjectionCostInput {\n readonly page: {\n readonly pageId: string;\n readonly route: string;\n };\n readonly measureId: string;\n readonly row: {\n readonly key: string;\n readonly dimensions: Readonly<Record<string, unknown>>;\n };\n readonly profileIdentity: string;\n readonly projection: unknown;\n}\n/** A same-key, different row-content failure that a Host can surface directly. */\nexport interface ReportProjectionConflict {\n readonly code: \"report-cost-projection-conflict\";\n readonly page: {\n readonly pageId: string;\n readonly route: string;\n };\n readonly measureId: string;\n readonly rowKey: string;\n readonly profileIdentity: string;\n}\n/** Capture and projection must name the same Analysis-owned PricingProfile. */\nexport interface ReportProjectionProfileIdentityMismatch {\n readonly code: \"report-cost-projection-profile-identity-mismatch\";\n readonly page: {\n readonly pageId: string;\n readonly route: string;\n };\n readonly measureId: string;\n readonly rowKey: string;\n readonly profileIdentity: string;\n readonly projectionProfileIdentity: string | null;\n}\n/** A cost capture cannot exist when the Report declares no PricingProfile. */\nexport interface ReportProjectionReportPricingMissing {\n readonly code: \"report-cost-projection-report-pricing-missing\";\n readonly page: {\n readonly pageId: string;\n readonly route: string;\n };\n readonly measureId: string;\n readonly rowKey: string;\n readonly profileIdentity: string;\n}\n/** Every captured cost must use the exact Profile declared by the Report. */\nexport interface ReportProjectionReportPricingMismatch {\n readonly code: \"report-cost-projection-report-pricing-mismatch\";\n readonly page: {\n readonly pageId: string;\n readonly route: string;\n };\n readonly measureId: string;\n readonly rowKey: string;\n readonly profileIdentity: string;\n readonly reportPricingProfileIdentity: string;\n}\nexport type ReportProjectionBuildFailure = ReportProjectionConflict | ReportProjectionProfileIdentityMismatch | ReportProjectionReportPricingMissing | ReportProjectionReportPricingMismatch;\n/**\n * Closes, deduplicates, and canonically sorts captured projection entries.\n * Two identical entries at one canonical capture key collapse. Different\n * Page bindings deliberately do not collide; distinct dimensions at one key\n * do, because they represent distinct captured rows.\n */\nexport function buildReportProjections(input: {\n readonly pricingProfile: JsonValue | null;\n readonly costs: readonly ReportProjectionCostInput[];\n}): ReportProjections {\n const pricingProfile = input.pricingProfile === null\n ? null\n : closeJson(input.pricingProfile, new Set<object>());\n const failure = reportProjectionFailure({ pricingProfile, costs: input.costs });\n if (failure !== undefined)\n throw failure;\n const byKey = new Map<string, {\n readonly cost: ReportProjectionCost;\n readonly content: string;\n }>();\n for (const entry of input.costs) {\n const cost = closeProjectionCost(entry);\n const key = projectionCostKey(cost);\n const content = projectionCostContent(cost);\n const existing = byKey.get(key);\n if (existing === undefined) {\n byKey.set(key, Object.freeze({ cost, content }));\n continue;\n }\n if (existing.content !== content) {\n throw projectionConflict(cost);\n }\n }\n const costs = Object.freeze([...byKey.values()].map((entry) => entry.cost).sort((left, right) => compareUtf8(left.page.route, right.page.route) ||\n compareUtf8(left.page.pageId, right.page.pageId) ||\n compareUtf8(left.measureId, right.measureId) ||\n compareUtf8(left.row.key, right.row.key) ||\n compareUtf8(left.profileIdentity, right.profileIdentity)));\n return Object.freeze({\n schema: REPORT_PROJECTIONS_SCHEMA,\n pricingProfile,\n costs,\n });\n}\n/** The empty projections for a Page or site that captured no cost values. */\nexport function emptyReportProjections(pricingProfile: JsonValue | null): ReportProjections {\n return buildReportProjections({ pricingProfile, costs: [] });\n}\n/** Validates Report Profile binding and same-key row-content identity. */\nexport function reportProjectionFailure(input: {\n readonly pricingProfile: JsonValue | null;\n readonly costs: readonly ReportProjectionCostInput[];\n}): ReportProjectionBuildFailure | undefined {\n const reportPricingProfileIdentity = pricingProfileIdentity(input.pricingProfile);\n const byKey = new Map<string, {\n readonly content: string;\n }>();\n for (const inputEntry of input.costs) {\n const cost = closeProjectionCost(inputEntry);\n if (reportPricingProfileIdentity === null)\n return reportPricingMissing(cost);\n const profileIdentity = projectionProfileIdentity(cost.projection);\n if (profileIdentity !== cost.profileIdentity)\n return projectionProfileIdentityMismatch(cost, profileIdentity);\n if (cost.profileIdentity !== reportPricingProfileIdentity) {\n return reportPricingMismatch(cost, reportPricingProfileIdentity);\n }\n const key = projectionCostKey(cost);\n const content = projectionCostContent(cost);\n const prior = byKey.get(key);\n if (prior !== undefined && prior.content !== content) {\n return projectionConflict(cost);\n }\n byKey.set(key, Object.freeze({ content }));\n }\n return undefined;\n}\nfunction closeProjectionCost(input: ReportProjectionCostInput): ReportProjectionCost {\n const page = input.page;\n const row = input.row;\n if (!isPlainRecord(page) || !isPlainRecord(row)) {\n throw new TypeError(\"projection cost page and row must be plain data objects\");\n }\n // CostProjectionValue has one closed-domain validator in Analysis. This\n // machine boundary deliberately calls it before JSON closing rather than\n // accepting any projection-shaped payload from a capture.\n if (!isCostProjectionValue(input.projection)) {\n throw new TypeError(\"projection cost projection must be an Analysis CostProjectionValue\");\n }\n const dimensions = closeJson(row.dimensions, new Set<object>());\n if (dimensions === null || Array.isArray(dimensions) || typeof dimensions !== \"object\") {\n throw new TypeError(\"projection cost row.dimensions must be a plain data object\");\n }\n return Object.freeze({\n page: Object.freeze({\n pageId: requireNonEmptyString(page.pageId, \"projection cost page.pageId\"),\n route: requireNonEmptyString(page.route, \"projection cost page.route\"),\n }),\n measureId: requireNonEmptyString(input.measureId, \"projection cost measureId\"),\n row: Object.freeze({\n key: requireString(row.key, \"projection cost row.key\"),\n dimensions: dimensions as Readonly<Record<string, JsonValue>>,\n }),\n profileIdentity: requireNonEmptyString(input.profileIdentity, \"projection cost profileIdentity\"),\n projection: closeJson(input.projection, new Set<object>()),\n });\n}\nfunction projectionCostKey(cost: ReportProjectionCost): string {\n return writeCanonicalJson(Object.freeze([\n cost.page.route,\n cost.page.pageId,\n cost.measureId,\n cost.row.key,\n cost.profileIdentity,\n ]));\n}\n/**\n * Dimensions are retained outside the canonical capture key so they do not\n * affect sort order, but they remain part of the captured row's meaning. Two\n * entries at one key can collapse only when both dimensions and projection\n * are byte-identical canonical JSON.\n */\nfunction projectionCostContent(cost: ReportProjectionCost): string {\n return writeCanonicalJson(Object.freeze({\n dimensions: cost.row.dimensions,\n projection: cost.projection,\n }));\n}\nfunction projectionConflict(cost: ReportProjectionCost): ReportProjectionConflict {\n return Object.freeze({\n code: \"report-cost-projection-conflict\" as const,\n page: cost.page,\n measureId: cost.measureId,\n rowKey: cost.row.key,\n profileIdentity: cost.profileIdentity,\n });\n}\nfunction projectionProfileIdentity(value: JsonValue): string | null {\n if (value === null || Array.isArray(value) || typeof value !== \"object\")\n return null;\n const profile = (value as Readonly<Record<string, JsonValue>>).profile;\n if (profile === null || Array.isArray(profile) || typeof profile !== \"object\")\n return null;\n const record = profile as Readonly<Record<string, JsonValue>>;\n return typeof record.contentIdentity === \"string\" && record.contentIdentity.length > 0\n ? record.contentIdentity\n : null;\n}\nfunction pricingProfileIdentity(value: JsonValue | null): string | null {\n if (value === null)\n return null;\n if (!isPlainRecord(value) || typeof value.contentIdentity !== \"string\" || value.contentIdentity.length === 0) {\n throw new TypeError(\"projection pricingProfile must be a closed PricingProfile JSON object\");\n }\n return value.contentIdentity;\n}\nfunction projectionProfileIdentityMismatch(cost: ReportProjectionCost, projectionProfileIdentity: string | null): ReportProjectionProfileIdentityMismatch {\n return Object.freeze({\n code: \"report-cost-projection-profile-identity-mismatch\" as const,\n page: cost.page,\n measureId: cost.measureId,\n rowKey: cost.row.key,\n profileIdentity: cost.profileIdentity,\n projectionProfileIdentity,\n });\n}\nfunction reportPricingMissing(cost: ReportProjectionCost): ReportProjectionReportPricingMissing {\n return Object.freeze({\n code: \"report-cost-projection-report-pricing-missing\" as const,\n page: cost.page,\n measureId: cost.measureId,\n rowKey: cost.row.key,\n profileIdentity: cost.profileIdentity,\n });\n}\nfunction reportPricingMismatch(cost: ReportProjectionCost, reportPricingProfileIdentity: string): ReportProjectionReportPricingMismatch {\n return Object.freeze({\n code: \"report-cost-projection-report-pricing-mismatch\" as const,\n page: cost.page,\n measureId: cost.measureId,\n rowKey: cost.row.key,\n profileIdentity: cost.profileIdentity,\n reportPricingProfileIdentity,\n });\n}\nconst BUILT_IN_MACHINE_DESCRIPTOR = Symbol.for(\"niceeval.report.built-in-machine-descriptor/v2\");\nconst BUILT_IN_MACHINE_REPORT_DESCRIPTOR = Symbol.for(\"niceeval.report.built-in-machine-report-descriptor/v2\");\nconst BUILT_IN_MACHINE_DESCRIPTOR_BRAND = \"niceeval.report.built-in-machine-descriptor/v2\";\n/**\n * A descriptor intentionally contains only one versioned producer id. The\n * Symbol.for brand makes that data identity work across duplicate packages.\n */\nexport interface BuiltInMachineDescriptor {\n readonly producerId: string;\n}\nexport interface BuiltInMachineProducerInput {\n readonly sample: Sample;\n readonly selection: ShowSelection;\n readonly route: string;\n readonly pageId: string;\n}\n/** This callback is held only in a Host registry—not on a descriptor. */\nexport type BuiltInMachineProducer<Error, Requirements> = (input: BuiltInMachineProducerInput) => Effect.Effect<BuiltInShowData, Error, Requirements>;\nexport interface BuiltInMachineRegistry<Error, Requirements> {\n readonly producers: ReadonlyMap<string, BuiltInMachineProducer<Error, Requirements>>;\n}\nexport interface BuiltInMachineProducerMissing {\n readonly code: \"report-built-in-machine-producer-missing\";\n readonly producerId: string;\n}\n/** Defines a data-only descriptor. It has no executable producer field. */\nexport function defineBuiltInMachineDescriptor(producerId: string): BuiltInMachineDescriptor {\n if (!isVersionedProducerId(producerId)) {\n throw new TypeError(\"a built-in machine producer id must end in @v<positive integer>\");\n }\n const descriptor: BuiltInMachineDescriptor = { producerId };\n Object.defineProperty(descriptor, BUILT_IN_MACHINE_DESCRIPTOR, {\n value: BUILT_IN_MACHINE_DESCRIPTOR_BRAND,\n enumerable: false,\n configurable: false,\n writable: false,\n });\n return Object.freeze(descriptor);\n}\n/** A duplicate installed package recognizes the same descriptor through Symbol.for. */\nexport function isBuiltInMachineDescriptor(value: unknown): value is BuiltInMachineDescriptor {\n if (!isBuiltInDescriptorRecord(value) || !hasOnlyFields(value, [\"producerId\"]) || !isVersionedProducerId(value.producerId)) {\n return false;\n }\n const brand = Object.getOwnPropertyDescriptor(value, BUILT_IN_MACHINE_DESCRIPTOR);\n return brand !== undefined && \"value\" in brand && brand.value === BUILT_IN_MACHINE_DESCRIPTOR_BRAND;\n}\n/** Installs data identity before a built-in definition is frozen; it installs no callback. */\nexport function attachBuiltInMachineDescriptor<Definition extends object>(definition: Definition, descriptor: BuiltInMachineDescriptor): Definition {\n if (!isBuiltInMachineDescriptor(descriptor)) {\n throw new TypeError(\"a built-in Report must use a valid machine descriptor\");\n }\n Object.defineProperty(definition, BUILT_IN_MACHINE_REPORT_DESCRIPTOR, {\n value: descriptor,\n enumerable: false,\n configurable: false,\n writable: false,\n });\n return definition;\n}\n/** Reads only the stable data descriptor, never a process-local WeakMap. */\nexport function builtInMachineDescriptorOf(value: unknown): BuiltInMachineDescriptor | undefined {\n if ((typeof value !== \"object\" && typeof value !== \"function\") || value === null)\n return undefined;\n const property = Object.getOwnPropertyDescriptor(value, BUILT_IN_MACHINE_REPORT_DESCRIPTOR);\n return property !== undefined && \"value\" in property && isBuiltInMachineDescriptor(property.value)\n ? property.value\n : undefined;\n}\n/**\n * The Host selects the producer from its own registry by producerId. The\n * descriptor is never called and cannot contain a callback to call.\n */\nexport function produceBuiltInShowData<Error, Requirements>(input: {\n readonly registry: BuiltInMachineRegistry<Error, Requirements>;\n readonly descriptor: BuiltInMachineDescriptor;\n readonly sample: Sample;\n readonly selection: ShowSelection;\n readonly route: string;\n readonly pageId: string;\n}): Effect.Effect<BuiltInShowData, Error | BuiltInMachineProducerMissing, Requirements | Scope.Scope> {\n if (!isBuiltInMachineDescriptor(input.descriptor)) {\n throw new TypeError(\"a built-in machine descriptor must be created by defineBuiltInMachineDescriptor\");\n }\n const producer = input.registry.producers.get(input.descriptor.producerId);\n if (producer === undefined) {\n return Effect.fail(Object.freeze({\n code: \"report-built-in-machine-producer-missing\" as const,\n producerId: input.descriptor.producerId,\n }));\n }\n return producer({\n sample: input.sample,\n selection: input.selection,\n route: input.route,\n pageId: input.pageId,\n });\n}\n/** Builds the docs-defined built-in show document from already closed domain data. */\nexport function builtInShowDocument(input: {\n readonly selection: ShowSelection;\n readonly report: {\n readonly token: BuiltInReportToken;\n readonly identity: ContentAddress;\n };\n readonly page: {\n readonly route: string;\n readonly pageId: string;\n readonly title: LocalizedText;\n };\n readonly data: BuiltInShowData;\n readonly projections: ReportProjections;\n readonly problems?: readonly ReportProblem[];\n}): BuiltInShowDocument {\n return Object.freeze({\n schema: BUILT_IN_SHOW_SCHEMA,\n locale: \"en\" as const,\n selection: freezeSelection(input.selection),\n report: Object.freeze({\n token: requireNonEmptyString(input.report.token, \"report.token\"),\n identity: requireNonEmptyString(input.report.identity, \"report.identity\"),\n }),\n page: freezePage(input.page),\n data: freezeBuiltInData(input.data),\n projections: freezeProjections(input.projections),\n problems: freezeProblems(input.problems ?? []),\n });\n}\n/**\n * Builds the docs-defined custom single-target manifest. `ResolvedPage` has\n * already closed every author callback, so reading its English text performs\n * neither component resolution nor a second Analysis request.\n */\nexport function customTargetExecutionManifest(input: {\n readonly selection: ShowSelection;\n readonly report: {\n readonly identity: ContentAddress;\n readonly title: LocalizedText;\n };\n readonly page: ResolvedPage;\n readonly textWidth: number;\n readonly projections: ReportProjections;\n readonly problems?: readonly ReportProblem[];\n}): CustomTargetExecutionManifest {\n if (!isPositiveSafeInteger(input.textWidth)) {\n throw new TypeError(\"custom target execution textWidth must be a positive safe integer\");\n }\n const text = resolvedPageText(input.page, { locale: \"en\", width: input.textWidth });\n if (!(\"state\" in text) || text.state !== \"rendered\") {\n throw new TypeError(\"the selected Page lacks a closed English text projection at the requested width\");\n }\n return Object.freeze({\n schema: CUSTOM_TARGET_EXECUTION_SCHEMA,\n locale: \"en\" as const,\n selection: freezeSelection(input.selection),\n report: Object.freeze({\n identity: requireNonEmptyString(input.report.identity, \"report.identity\"),\n title: freezeLocalizedText(input.report.title, \"report.title\"),\n }),\n page: Object.freeze({\n route: input.page.target.route,\n pageId: input.page.target.pageId,\n title: freezeLocalizedText(input.page.title, \"page.title\"),\n renderedText: text.text,\n }),\n // Assets remain revision payloads. The target-page manifest intentionally\n // exposes only the docs-defined download summaries, never either payload.\n downloads: Object.freeze([...input.page.downloads]\n .map((download) => Object.freeze({\n path: download.path,\n mediaType: download.mediaType,\n bytes: download.byteLength,\n }))\n .sort((left, right) => compareUtf8(left.path, right.path) || compareUtf8(left.mediaType, right.mediaType) || left.bytes - right.bytes)),\n projections: freezeProjections(input.projections),\n problems: freezeProblems(input.problems ?? []),\n });\n}\n/** Canonical UTF-8 JSON for the two show schemas. */\nexport function canonicalMachineJson(value: BuiltInShowDocument | CustomTargetExecutionManifest): string {\n return writeCanonicalJson(closeMachineJson(value));\n}\n/** Strict JSON clone for a Host-owned closed domain value. */\nexport function closeMachineJson(value: unknown): JsonValue {\n return closeJson(value, new Set<object>());\n}\n/**\n * A PricingProfile carries an internal Symbol descriptor for cross-package\n * validation. Machine documents expose only its closed enumerable data form.\n */\nexport function closePricingProfileJson(profile: PricingProfile): JsonValue {\n return closeMachineJson(Object.fromEntries(Object.entries(profile)));\n}\nfunction freezeSelection(value: ShowSelection): ShowSelection {\n const sampleIdentity = requireNonEmptyString(value.sampleIdentity, \"selection.sampleIdentity\");\n switch (value.kind) {\n case \"project-current\":\n return Object.freeze({\n kind: \"project-current\" as const,\n sampleIdentity,\n experimentIds: freezeSortedUniqueStrings(value.experimentIds, \"selection.experimentIds\"),\n });\n case \"explicit-runs\":\n return Object.freeze({\n kind: \"explicit-runs\" as const,\n sampleIdentity,\n runIds: freezeSortedUniqueStrings(value.runIds, \"selection.runIds\"),\n });\n case \"attempt-locator\":\n return Object.freeze({\n kind: \"attempt-locator\" as const,\n sampleIdentity,\n locator: requireNonEmptyString(value.locator, \"selection.locator\"),\n });\n }\n}\nfunction freezePage(value: {\n readonly route: string;\n readonly pageId: string;\n readonly title: LocalizedText;\n}): {\n readonly route: string;\n readonly pageId: string;\n readonly title: LocalizedText;\n} {\n return Object.freeze({\n route: requireNonEmptyString(value.route, \"page.route\"),\n pageId: requireNonEmptyString(value.pageId, \"page.pageId\"),\n title: freezeLocalizedText(value.title, \"page.title\"),\n });\n}\nfunction freezeBuiltInData(value: BuiltInShowData): BuiltInShowData {\n if (!isPlainRecord(value) || typeof value.kind !== \"string\") {\n throw new TypeError(\"built-in show data must be a named domain result\");\n }\n // Domain arrays are deliberately not given a generic renderer sort here.\n // The selected registry producer owns their stable identities and must close\n // them in the canonical order defined for that domain before returning.\n switch (value.kind) {\n case \"leaderboard\":\n assertExactFields(value, [\"kind\", \"rows\"], \"leaderboard show data\");\n return Object.freeze({ kind: \"leaderboard\" as const, rows: closeMachineJson(value.rows) });\n case \"attempt\":\n assertExactFields(value, [\"kind\", \"evidence\", \"observability\", \"fileChanges\"], \"attempt show data\");\n return Object.freeze({\n kind: \"attempt\" as const,\n evidence: closeMachineJson(value.evidence),\n observability: closeMachineJson(value.observability),\n fileChanges: closeMachineJson(value.fileChanges),\n });\n case \"source\":\n assertExactFields(value, [\"kind\", \"sources\"], \"source show data\");\n return Object.freeze({ kind: \"source\" as const, sources: closeMachineJson(value.sources) });\n case \"execution\":\n assertExactFields(value, [\"kind\", \"execution\"], \"execution show data\");\n return Object.freeze({ kind: \"execution\" as const, execution: closeMachineJson(value.execution) });\n case \"timing\":\n assertExactFields(value, [\"kind\", \"timing\"], \"timing show data\");\n return Object.freeze({ kind: \"timing\" as const, timing: closeMachineJson(value.timing) });\n default:\n throw new TypeError(\"built-in show data kind is not declared by the show schema\");\n }\n}\n/** Re-closes a ReportProjections value: validates schema, dedupes, and canonically sorts. */\nfunction freezeProjections(value: ReportProjections): ReportProjections {\n if (!isPlainRecord(value) || value.schema !== REPORT_PROJECTIONS_SCHEMA) {\n throw new TypeError(\"projections must be a niceeval.report-projections/v1 value\");\n }\n return buildReportProjections({\n pricingProfile: value.pricingProfile,\n costs: value.costs.map((entry) => ({\n page: entry.page,\n measureId: entry.measureId,\n row: entry.row,\n profileIdentity: entry.profileIdentity,\n projection: entry.projection,\n })),\n });\n}\nfunction freezeProblems(value: readonly ReportProblem[]): readonly ReportProblem[] {\n if (!Array.isArray(value))\n throw new TypeError(\"problems must be an array\");\n const entries = value.map((problem, index) => {\n if (!isNonEmptyString(problem.code))\n throw new TypeError(`problems[${index}].code must be a non-empty string`);\n const path = freezeStrings(problem.path, `problems[${index}].path`);\n const refs = freezeSortedUniqueStrings(problem.refs, `problems[${index}].refs`);\n if (problem.summary !== undefined && !isNonEmptyString(problem.summary)) {\n throw new TypeError(`problems[${index}].summary must be a non-empty string when supplied`);\n }\n return Object.freeze({\n code: problem.code,\n path,\n refs,\n ...(problem.summary === undefined ? {} : { summary: problem.summary }),\n });\n });\n return Object.freeze(entries.sort((left, right) => compareUtf8(left.code, right.code) ||\n comparePath(left.path, right.path) ||\n compareStringArrays(left.refs, right.refs) ||\n compareUtf8(left.summary ?? \"\", right.summary ?? \"\")));\n}\nfunction freezeLocalizedText(value: LocalizedText, label: string): LocalizedText {\n if (typeof value === \"string\")\n return value;\n const closed = closeMachineJson(value);\n if (closed === null || Array.isArray(closed) || typeof closed !== \"object\") {\n throw new TypeError(`${label} 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(`${label} 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 freezeStrings(value: readonly string[], label: string): readonly string[] {\n if (!Array.isArray(value) || value.some((entry) => !isNonEmptyString(entry))) {\n throw new TypeError(`${label} must be an array of non-empty strings`);\n }\n return Object.freeze([...value]);\n}\nfunction freezeSortedUniqueStrings(value: readonly string[], label: string): readonly string[] {\n const entries = freezeStrings(value, label);\n return Object.freeze([...new Set(entries)].sort(compareUtf8));\n}\nfunction comparePath(left: readonly string[], right: readonly string[]): number {\n const length = Math.min(left.length, right.length);\n for (let index = 0; index < length; index += 1) {\n const difference = compareUtf8(left[index]!, right[index]!);\n if (difference !== 0)\n return difference;\n }\n return left.length - right.length;\n}\nfunction compareStringArrays(left: readonly string[], right: readonly string[]): number {\n return comparePath(left, right);\n}\nfunction closeJson(value: unknown, 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(\"machine JSON cannot contain a non-finite number\");\n return Object.is(value, -0) ? 0 : value;\n }\n if (typeof value === \"undefined\" || typeof value === \"bigint\" || typeof value === \"symbol\" || typeof value === \"function\") {\n throw new TypeError(\"machine JSON must be data only\");\n }\n if (active.has(value))\n throw new TypeError(\"machine JSON cannot contain a cycle\");\n active.add(value);\n try {\n if (Array.isArray(value))\n return Object.freeze(value.map((entry) => closeJson(entry, active)));\n if (!isPlainRecord(value))\n throw new TypeError(\"machine JSON must use plain data objects\");\n const copy: Record<string, JsonValue> = Object.create(null) as Record<string, JsonValue>;\n for (const key of Object.keys(value).sort(compareUtf8))\n copy[key] = closeJson(value[key], active);\n return Object.freeze(copy);\n }\n finally {\n active.delete(value);\n }\n}\nfunction writeCanonicalJson(value: JsonValue): string {\n if (value === null)\n return \"null\";\n switch (typeof value) {\n case \"boolean\":\n return value ? \"true\" : \"false\";\n case \"number\":\n return JSON.stringify(value);\n case \"string\":\n return JSON.stringify(value);\n case \"object\":\n break;\n }\n if (Array.isArray(value))\n return `[${value.map(writeCanonicalJson).join(\",\")}]`;\n const record = value as Readonly<Record<string, JsonValue>>;\n const keys = Object.keys(record).sort(compareUtf8);\n return `{${keys.map((key) => `${JSON.stringify(key)}:${writeCanonicalJson(record[key]!)}`).join(\",\")}}`;\n}\nfunction isPlainRecord(value: unknown): value is Readonly<Record<string, unknown>> {\n if (typeof value !== \"object\" || value === null || Array.isArray(value) || value instanceof Uint8Array)\n return false;\n const prototype = Object.getPrototypeOf(value);\n if (prototype !== Object.prototype && prototype !== 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}\n/** The descriptor alone is allowed its one non-enumerable Symbol.for brand. */\nfunction isBuiltInDescriptorRecord(value: unknown): value is Readonly<Record<string, unknown>> {\n if (typeof value !== \"object\" || value === null || Array.isArray(value) || value instanceof Uint8Array)\n return false;\n const prototype = Object.getPrototypeOf(value);\n if (prototype !== Object.prototype && prototype !== null)\n return false;\n for (const key of Reflect.ownKeys(value)) {\n if (typeof key === \"symbol\" && key !== BUILT_IN_MACHINE_DESCRIPTOR)\n return false;\n if (typeof key !== \"string\" && typeof key !== \"symbol\")\n return false;\n const descriptor = Object.getOwnPropertyDescriptor(value, key);\n if (descriptor === undefined || !(\"value\" in descriptor))\n return false;\n }\n return true;\n}\nfunction hasOnlyFields(value: Readonly<Record<string, unknown>>, keys: readonly string[]): boolean {\n const actual = Object.getOwnPropertyNames(value);\n return actual.length === keys.length && keys.every((key) => Object.hasOwn(value, key));\n}\nfunction assertExactFields(value: Readonly<Record<string, unknown>>, keys: readonly string[], label: string): void {\n if (!hasOnlyFields(value, keys))\n throw new TypeError(`${label} has an invalid field set`);\n}\nfunction isVersionedProducerId(value: unknown): value is string {\n return typeof value === \"string\" && /^[^\\s@][^\\s]*@v[1-9][0-9]*$/u.test(value);\n}\nfunction requireNonEmptyString(value: unknown, label: string): string {\n if (!isNonEmptyString(value))\n throw new TypeError(`${label} must be a non-empty string`);\n return value;\n}\nfunction requireString(value: unknown, label: string): string {\n if (typeof value !== \"string\")\n throw new TypeError(`${label} must be a string`);\n return value;\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}\n"]}
1
+ {"version":3,"file":"machine.js","sourceRoot":"","sources":["machine.ts"],"names":[],"mappings":";;;AAsMA,wDAqCC;AAED,wDAEC;AAED,0DA2BC;AAuID,wEAYC;AAED,gEAMC;AAED,wEAWC;A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KAAK,6BAA6B,CAAC,CAAC;IAC/D,OAAO,KAAK,CAAC;AACjB,CAAC;AACD,SAAS,aAAa,CAAC,KAAc,EAAE,KAAa;IAChD,IAAI,OAAO,KAAK,KAAK,QAAQ;QACzB,MAAM,IAAI,SAAS,CAAC,GAAG,KAAK,mBAAmB,CAAC,CAAC;IACrD,OAAO,KAAK,CAAC;AACjB,CAAC;AACD,SAAS,gBAAgB,CAAC,KAAc;IACpC,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC;AACzD,CAAC;AACD,SAAS,qBAAqB,CAAC,KAAc;IACzC,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,MAAM,CAAC,aAAa,CAAC,KAAK,CAAC,IAAI,KAAK,GAAG,CAAC,CAAC;AACjF,CAAC","sourcesContent":["import { Effect } from \"effect\";\nimport type * as Scope from \"effect/Scope\";\nimport type { JsonValue, Sample, } from \"../../analysis/contracts.ts\";\nimport { isCostProjectionValue, type PricingProfile, } from \"../../analysis/cost.ts\";\nimport type { LocalizedText } from \"../../shared/types.ts\";\nimport { compareUtf8, type ResolvedPage, } from \"../runtime/resolved-page.ts\";\nimport { resolvedPageText } from \"../runtime/text.ts\";\n/** Content-addressed identities are opaque, printable strings at this boundary. */\nexport type ContentAddress = string;\n/** The exact machine schemas in docs/feature/reports/cli.md. */\nexport const BUILT_IN_SHOW_SCHEMA = \"niceeval.show/v1\";\nexport const CUSTOM_TARGET_EXECUTION_SCHEMA = \"niceeval.report-target-execution/v1\";\nexport const REPORT_PROJECTIONS_SCHEMA = \"niceeval.report-projections/v1\";\nexport type BuiltInReportToken = string;\nexport type ShowSelection = {\n readonly kind: \"project-current\";\n readonly sampleIdentity: ContentAddress;\n readonly experimentIds: readonly string[];\n} | {\n readonly kind: \"explicit-runs\";\n readonly sampleIdentity: ContentAddress;\n readonly runIds: readonly string[];\n} | {\n readonly kind: \"attempt-locator\";\n readonly sampleIdentity: ContentAddress;\n readonly locator: string;\n};\n/**\n * Host-owned problems expose canonical ordering inputs. Their exact detailed\n * shape remains Host-owned; no callback, Error, Cause, or reader is allowed.\n */\nexport interface ReportProblem {\n readonly code: string;\n readonly path: readonly string[];\n readonly refs: readonly string[];\n readonly summary?: string;\n}\n/**\n * Built-ins may emit only their declared domain families. This is intentionally\n * not a generic component/HTML/text reverse-engineering format.\n */\nexport type BuiltInShowData = {\n readonly kind: \"leaderboard\";\n readonly rows: JsonValue;\n} | {\n readonly kind: \"attempt\";\n readonly evidence: JsonValue;\n readonly observability: JsonValue;\n readonly fileChanges: JsonValue;\n} | {\n readonly kind: \"source\";\n readonly sources: JsonValue;\n} | {\n readonly kind: \"execution\";\n readonly execution: JsonValue;\n} | {\n readonly kind: \"timing\";\n readonly timing: JsonValue;\n};\nexport interface BuiltInShowDocument {\n readonly schema: typeof BUILT_IN_SHOW_SCHEMA;\n readonly locale: \"en\";\n readonly selection: ShowSelection;\n readonly report: {\n readonly token: BuiltInReportToken;\n readonly identity: ContentAddress;\n };\n readonly page: {\n readonly route: string;\n readonly pageId: string;\n readonly title: LocalizedText;\n };\n readonly data: BuiltInShowData;\n readonly projections: ReportProjections;\n readonly problems: readonly ReportProblem[];\n}\n/**\n * The custom schema is a single target execution manifest, never a revision.\n * It contains only the selected Page's closed English text—not a React tree,\n * HTML body, site identity, Sample capability, Record payload, or raw bytes.\n */\nexport interface CustomTargetExecutionManifest {\n readonly schema: typeof CUSTOM_TARGET_EXECUTION_SCHEMA;\n readonly locale: \"en\";\n readonly selection: ShowSelection;\n readonly report: {\n readonly identity: ContentAddress;\n readonly title: LocalizedText;\n };\n readonly page: {\n readonly route: string;\n readonly pageId: string;\n readonly title: LocalizedText;\n readonly renderedText: string;\n };\n readonly downloads: readonly {\n readonly path: string;\n readonly mediaType: string;\n readonly bytes: number;\n }[];\n readonly projections: ReportProjections;\n readonly problems: readonly ReportProblem[];\n}\n/** One captured cost projection bound to the Page execution that requested it. */\nexport interface ReportProjectionCost {\n readonly page: {\n readonly pageId: string;\n readonly route: string;\n };\n readonly measureId: string;\n readonly row: {\n readonly key: string;\n readonly dimensions: Readonly<Record<string, JsonValue>>;\n };\n readonly profileIdentity: string;\n /** Analysis-owned closed projection; Report never rebuilds it from `value`. */\n readonly projection: JsonValue;\n}\n/**\n * The top-level projections object shared verbatim by the built-in show\n * document and the custom target-execution manifest, and written as the site\n * revision's `_niceeval/data/projections.json`. `pricingProfile` is the\n * closed JSON form of the Report's PricingProfile, or null when the Report\n * declares none. `costs` is canonical: route → pageId → measureId → row.key\n * → profileIdentity. A projection may appear on distinct Pages; distinct\n * dimensions or projections at one canonical capture key are a build failure.\n */\nexport interface ReportProjections {\n readonly schema: typeof REPORT_PROJECTIONS_SCHEMA;\n readonly pricingProfile: JsonValue | null;\n readonly costs: readonly ReportProjectionCost[];\n}\nexport interface ReportProjectionCostInput {\n readonly page: {\n readonly pageId: string;\n readonly route: string;\n };\n readonly measureId: string;\n readonly row: {\n readonly key: string;\n readonly dimensions: Readonly<Record<string, unknown>>;\n };\n readonly profileIdentity: string;\n readonly projection: unknown;\n}\n/** A same-key, different row-content failure that a Host can surface directly. */\nexport interface ReportProjectionConflict {\n readonly code: \"report-cost-projection-conflict\";\n readonly page: {\n readonly pageId: string;\n readonly route: string;\n };\n readonly measureId: string;\n readonly rowKey: string;\n readonly profileIdentity: string;\n}\n/** Capture and projection must name the same Analysis-owned PricingProfile. */\nexport interface ReportProjectionProfileIdentityMismatch {\n readonly code: \"report-cost-projection-profile-identity-mismatch\";\n readonly page: {\n readonly pageId: string;\n readonly route: string;\n };\n readonly measureId: string;\n readonly rowKey: string;\n readonly profileIdentity: string;\n readonly projectionProfileIdentity: string | null;\n}\n/** A cost capture cannot exist when the Report declares no PricingProfile. */\nexport interface ReportProjectionReportPricingMissing {\n readonly code: \"report-cost-projection-report-pricing-missing\";\n readonly page: {\n readonly pageId: string;\n readonly route: string;\n };\n readonly measureId: string;\n readonly rowKey: string;\n readonly profileIdentity: string;\n}\n/** Every captured cost must use the exact Profile declared by the Report. */\nexport interface ReportProjectionReportPricingMismatch {\n readonly code: \"report-cost-projection-report-pricing-mismatch\";\n readonly page: {\n readonly pageId: string;\n readonly route: string;\n };\n readonly measureId: string;\n readonly rowKey: string;\n readonly profileIdentity: string;\n readonly reportPricingProfileIdentity: string;\n}\nexport type ReportProjectionBuildFailure = ReportProjectionConflict | ReportProjectionProfileIdentityMismatch | ReportProjectionReportPricingMissing | ReportProjectionReportPricingMismatch;\n/**\n * Closes, deduplicates, and canonically sorts captured projection entries.\n * Two identical entries at one canonical capture key collapse. Different\n * Page bindings deliberately do not collide; distinct dimensions at one key\n * do, because they represent distinct captured rows.\n */\nexport function buildReportProjections(input: {\n readonly pricingProfile: JsonValue | null;\n readonly costs: readonly ReportProjectionCostInput[];\n}): ReportProjections {\n const pricingProfile = input.pricingProfile === null\n ? null\n : closeJson(input.pricingProfile, new Set<object>());\n const failure = reportProjectionFailure({ pricingProfile, costs: input.costs });\n if (failure !== undefined)\n throw failure;\n const byKey = new Map<string, {\n readonly cost: ReportProjectionCost;\n readonly content: string;\n }>();\n for (const entry of input.costs) {\n const cost = closeProjectionCost(entry);\n const key = projectionCostKey(cost);\n const content = projectionCostContent(cost);\n const existing = byKey.get(key);\n if (existing === undefined) {\n byKey.set(key, Object.freeze({ cost, content }));\n continue;\n }\n if (existing.content !== content) {\n throw projectionConflict(cost);\n }\n }\n const costs = Object.freeze([...byKey.values()].map((entry) => entry.cost).sort((left, right) => compareUtf8(left.page.route, right.page.route) ||\n compareUtf8(left.page.pageId, right.page.pageId) ||\n compareUtf8(left.measureId, right.measureId) ||\n compareUtf8(left.row.key, right.row.key) ||\n compareUtf8(left.profileIdentity, right.profileIdentity)));\n return Object.freeze({\n schema: REPORT_PROJECTIONS_SCHEMA,\n pricingProfile,\n costs,\n });\n}\n/** The empty projections for a Page or site that captured no cost values. */\nexport function emptyReportProjections(pricingProfile: JsonValue | null): ReportProjections {\n return buildReportProjections({ pricingProfile, costs: [] });\n}\n/** Validates Report Profile binding and same-key row-content identity. */\nexport function reportProjectionFailure(input: {\n readonly pricingProfile: JsonValue | null;\n readonly costs: readonly ReportProjectionCostInput[];\n}): ReportProjectionBuildFailure | undefined {\n const reportPricingProfileIdentity = pricingProfileIdentity(input.pricingProfile);\n const byKey = new Map<string, {\n readonly content: string;\n }>();\n for (const inputEntry of input.costs) {\n const cost = closeProjectionCost(inputEntry);\n if (reportPricingProfileIdentity === null)\n return reportPricingMissing(cost);\n const profileIdentity = projectionProfileIdentity(cost.projection);\n if (profileIdentity !== cost.profileIdentity)\n return projectionProfileIdentityMismatch(cost, profileIdentity);\n if (cost.profileIdentity !== reportPricingProfileIdentity) {\n return reportPricingMismatch(cost, reportPricingProfileIdentity);\n }\n const key = projectionCostKey(cost);\n const content = projectionCostContent(cost);\n const prior = byKey.get(key);\n if (prior !== undefined && prior.content !== content) {\n return projectionConflict(cost);\n }\n byKey.set(key, Object.freeze({ content }));\n }\n return undefined;\n}\nfunction closeProjectionCost(input: ReportProjectionCostInput): ReportProjectionCost {\n const page = input.page;\n const row = input.row;\n if (!isPlainRecord(page) || !isPlainRecord(row)) {\n throw new TypeError(\"projection cost page and row must be plain data objects\");\n }\n // CostProjectionValue has one closed-domain validator in Analysis. This\n // machine boundary deliberately calls it before JSON closing rather than\n // accepting any projection-shaped payload from a capture.\n if (!isCostProjectionValue(input.projection)) {\n throw new TypeError(\"projection cost projection must be an Analysis CostProjectionValue\");\n }\n const dimensions = closeJson(row.dimensions, new Set<object>());\n if (dimensions === null || Array.isArray(dimensions) || typeof dimensions !== \"object\") {\n throw new TypeError(\"projection cost row.dimensions must be a plain data object\");\n }\n return Object.freeze({\n page: Object.freeze({\n pageId: requireNonEmptyString(page.pageId, \"projection cost page.pageId\"),\n route: requireNonEmptyString(page.route, \"projection cost page.route\"),\n }),\n measureId: requireNonEmptyString(input.measureId, \"projection cost measureId\"),\n row: Object.freeze({\n key: requireString(row.key, \"projection cost row.key\"),\n dimensions: dimensions as Readonly<Record<string, JsonValue>>,\n }),\n profileIdentity: requireNonEmptyString(input.profileIdentity, \"projection cost profileIdentity\"),\n projection: closeJson(input.projection, new Set<object>()),\n });\n}\nfunction projectionCostKey(cost: ReportProjectionCost): string {\n return writeCanonicalJson(Object.freeze([\n cost.page.route,\n cost.page.pageId,\n cost.measureId,\n cost.row.key,\n cost.profileIdentity,\n ]));\n}\n/**\n * Dimensions are retained outside the canonical capture key so they do not\n * affect sort order, but they remain part of the captured row's meaning. Two\n * entries at one key can collapse only when both dimensions and projection\n * are byte-identical canonical JSON.\n */\nfunction projectionCostContent(cost: ReportProjectionCost): string {\n return writeCanonicalJson(Object.freeze({\n dimensions: cost.row.dimensions,\n projection: cost.projection,\n }));\n}\nfunction projectionConflict(cost: ReportProjectionCost): ReportProjectionConflict {\n return Object.freeze({\n code: \"report-cost-projection-conflict\" as const,\n page: cost.page,\n measureId: cost.measureId,\n rowKey: cost.row.key,\n profileIdentity: cost.profileIdentity,\n });\n}\nfunction projectionProfileIdentity(value: JsonValue): string | null {\n if (value === null || Array.isArray(value) || typeof value !== \"object\")\n return null;\n const profile = (value as Readonly<Record<string, JsonValue>>).profile;\n if (profile === null || Array.isArray(profile) || typeof profile !== \"object\")\n return null;\n const record = profile as Readonly<Record<string, JsonValue>>;\n return typeof record.contentIdentity === \"string\" && record.contentIdentity.length > 0\n ? record.contentIdentity\n : null;\n}\nfunction pricingProfileIdentity(value: JsonValue | null): string | null {\n if (value === null)\n return null;\n if (!isPlainRecord(value) || typeof value.contentIdentity !== \"string\" || value.contentIdentity.length === 0) {\n throw new TypeError(\"projection pricingProfile must be a closed PricingProfile JSON object\");\n }\n return value.contentIdentity;\n}\nfunction projectionProfileIdentityMismatch(cost: ReportProjectionCost, projectionProfileIdentity: string | null): ReportProjectionProfileIdentityMismatch {\n return Object.freeze({\n code: \"report-cost-projection-profile-identity-mismatch\" as const,\n page: cost.page,\n measureId: cost.measureId,\n rowKey: cost.row.key,\n profileIdentity: cost.profileIdentity,\n projectionProfileIdentity,\n });\n}\nfunction reportPricingMissing(cost: ReportProjectionCost): ReportProjectionReportPricingMissing {\n return Object.freeze({\n code: \"report-cost-projection-report-pricing-missing\" as const,\n page: cost.page,\n measureId: cost.measureId,\n rowKey: cost.row.key,\n profileIdentity: cost.profileIdentity,\n });\n}\nfunction reportPricingMismatch(cost: ReportProjectionCost, reportPricingProfileIdentity: string): ReportProjectionReportPricingMismatch {\n return Object.freeze({\n code: \"report-cost-projection-report-pricing-mismatch\" as const,\n page: cost.page,\n measureId: cost.measureId,\n rowKey: cost.row.key,\n profileIdentity: cost.profileIdentity,\n reportPricingProfileIdentity,\n });\n}\nconst BUILT_IN_MACHINE_DESCRIPTOR = Symbol.for(\"niceeval.report.built-in-machine-descriptor/v2\");\nconst BUILT_IN_MACHINE_REPORT_DESCRIPTOR = Symbol.for(\"niceeval.report.built-in-machine-report-descriptor/v2\");\nconst BUILT_IN_MACHINE_DESCRIPTOR_BRAND = \"niceeval.report.built-in-machine-descriptor/v2\";\n/**\n * A descriptor intentionally contains only one versioned producer id. The\n * Symbol.for brand makes that data identity work across duplicate packages.\n */\nexport interface BuiltInMachineDescriptor {\n readonly producerId: string;\n}\nexport interface BuiltInMachineProducerInput {\n readonly sample: Sample;\n readonly selection: ShowSelection;\n readonly route: string;\n readonly pageId: string;\n}\n/** This callback is held only in a Host registry—not on a descriptor. */\nexport type BuiltInMachineProducer<Error, Requirements> = (input: BuiltInMachineProducerInput) => Effect.Effect<BuiltInShowData, Error, Requirements>;\nexport interface BuiltInMachineRegistry<Error, Requirements> {\n readonly producers: ReadonlyMap<string, BuiltInMachineProducer<Error, Requirements>>;\n}\nexport interface BuiltInMachineProducerMissing {\n readonly code: \"report-built-in-machine-producer-missing\";\n readonly producerId: string;\n}\n/** Defines a data-only descriptor. It has no executable producer field. */\nexport function defineBuiltInMachineDescriptor(producerId: string): BuiltInMachineDescriptor {\n if (!isVersionedProducerId(producerId)) {\n throw new TypeError(\"a built-in machine producer id must end in @v<positive integer>\");\n }\n const descriptor: BuiltInMachineDescriptor = { producerId };\n Object.defineProperty(descriptor, BUILT_IN_MACHINE_DESCRIPTOR, {\n value: BUILT_IN_MACHINE_DESCRIPTOR_BRAND,\n enumerable: false,\n configurable: false,\n writable: false,\n });\n return Object.freeze(descriptor);\n}\n/** A duplicate installed package recognizes the same descriptor through Symbol.for. */\nexport function isBuiltInMachineDescriptor(value: unknown): value is BuiltInMachineDescriptor {\n if (!isBuiltInDescriptorRecord(value) || !hasOnlyFields(value, [\"producerId\"]) || !isVersionedProducerId(value.producerId)) {\n return false;\n }\n const brand = Object.getOwnPropertyDescriptor(value, BUILT_IN_MACHINE_DESCRIPTOR);\n return brand !== undefined && \"value\" in brand && brand.value === BUILT_IN_MACHINE_DESCRIPTOR_BRAND;\n}\n/** Installs data identity before a built-in definition is frozen; it installs no callback. */\nexport function attachBuiltInMachineDescriptor<Definition extends object>(definition: Definition, descriptor: BuiltInMachineDescriptor): Definition {\n if (!isBuiltInMachineDescriptor(descriptor)) {\n throw new TypeError(\"a built-in Report must use a valid machine descriptor\");\n }\n Object.defineProperty(definition, BUILT_IN_MACHINE_REPORT_DESCRIPTOR, {\n value: descriptor,\n enumerable: false,\n configurable: false,\n writable: false,\n });\n return definition;\n}\n/** Reads only the stable data descriptor, never a process-local WeakMap. */\nexport function builtInMachineDescriptorOf(value: unknown): BuiltInMachineDescriptor | undefined {\n if ((typeof value !== \"object\" && typeof value !== \"function\") || value === null)\n return undefined;\n const property = Object.getOwnPropertyDescriptor(value, BUILT_IN_MACHINE_REPORT_DESCRIPTOR);\n return property !== undefined && \"value\" in property && isBuiltInMachineDescriptor(property.value)\n ? property.value\n : undefined;\n}\n/**\n * The Host selects the producer from its own registry by producerId. The\n * descriptor is never called and cannot contain a callback to call.\n */\nexport function produceBuiltInShowData<Error, Requirements>(input: {\n readonly registry: BuiltInMachineRegistry<Error, Requirements>;\n readonly descriptor: BuiltInMachineDescriptor;\n readonly sample: Sample;\n readonly selection: ShowSelection;\n readonly route: string;\n readonly pageId: string;\n}): Effect.Effect<BuiltInShowData, Error | BuiltInMachineProducerMissing, Requirements | Scope.Scope> {\n if (!isBuiltInMachineDescriptor(input.descriptor)) {\n throw new TypeError(\"a built-in machine descriptor must be created by defineBuiltInMachineDescriptor\");\n }\n const producer = input.registry.producers.get(input.descriptor.producerId);\n if (producer === undefined) {\n return Effect.fail(Object.freeze({\n code: \"report-built-in-machine-producer-missing\" as const,\n producerId: input.descriptor.producerId,\n }));\n }\n return producer({\n sample: input.sample,\n selection: input.selection,\n route: input.route,\n pageId: input.pageId,\n });\n}\n/** Builds the docs-defined built-in show document from already closed domain data. */\nexport function builtInShowDocument(input: {\n readonly selection: ShowSelection;\n readonly report: {\n readonly token: BuiltInReportToken;\n readonly identity: ContentAddress;\n };\n readonly page: {\n readonly route: string;\n readonly pageId: string;\n readonly title: LocalizedText;\n };\n readonly data: BuiltInShowData;\n readonly projections: ReportProjections;\n readonly problems?: readonly ReportProblem[];\n}): BuiltInShowDocument {\n return Object.freeze({\n schema: BUILT_IN_SHOW_SCHEMA,\n locale: \"en\" as const,\n selection: freezeSelection(input.selection),\n report: Object.freeze({\n token: requireNonEmptyString(input.report.token, \"report.token\"),\n identity: requireNonEmptyString(input.report.identity, \"report.identity\"),\n }),\n page: freezePage(input.page),\n data: freezeBuiltInData(input.data),\n projections: freezeProjections(input.projections),\n problems: freezeProblems(input.problems ?? []),\n });\n}\n/**\n * Builds the docs-defined custom single-target manifest. `ResolvedPage` has\n * already closed every author callback, so reading its English text performs\n * neither component resolution nor a second Analysis request.\n */\nexport function customTargetExecutionManifest(input: {\n readonly selection: ShowSelection;\n readonly report: {\n readonly identity: ContentAddress;\n readonly title: LocalizedText;\n };\n readonly page: ResolvedPage;\n readonly textWidth: number;\n readonly projections: ReportProjections;\n readonly problems?: readonly ReportProblem[];\n}): CustomTargetExecutionManifest {\n if (!isPositiveSafeInteger(input.textWidth)) {\n throw new TypeError(\"custom target execution textWidth must be a positive safe integer\");\n }\n const text = resolvedPageText(input.page, { locale: \"en\", width: input.textWidth, panelMode: \"plain\" });\n if (!(\"state\" in text) || text.state !== \"rendered\") {\n throw new TypeError(\"the selected Page lacks a closed English text projection at the requested width\");\n }\n return Object.freeze({\n schema: CUSTOM_TARGET_EXECUTION_SCHEMA,\n locale: \"en\" as const,\n selection: freezeSelection(input.selection),\n report: Object.freeze({\n identity: requireNonEmptyString(input.report.identity, \"report.identity\"),\n title: freezeLocalizedText(input.report.title, \"report.title\"),\n }),\n page: Object.freeze({\n route: input.page.target.route,\n pageId: input.page.target.pageId,\n title: freezeLocalizedText(input.page.title, \"page.title\"),\n renderedText: text.text,\n }),\n // Assets remain revision payloads. The target-page manifest intentionally\n // exposes only the docs-defined download summaries, never either payload.\n downloads: Object.freeze([...input.page.downloads]\n .map((download) => Object.freeze({\n path: download.path,\n mediaType: download.mediaType,\n bytes: download.byteLength,\n }))\n .sort((left, right) => compareUtf8(left.path, right.path) || compareUtf8(left.mediaType, right.mediaType) || left.bytes - right.bytes)),\n projections: freezeProjections(input.projections),\n problems: freezeProblems(input.problems ?? []),\n });\n}\n/** Canonical UTF-8 JSON for the two show schemas. */\nexport function canonicalMachineJson(value: BuiltInShowDocument | CustomTargetExecutionManifest): string {\n return writeCanonicalJson(closeMachineJson(value));\n}\n/** Strict JSON clone for a Host-owned closed domain value. */\nexport function closeMachineJson(value: unknown): JsonValue {\n return closeJson(value, new Set<object>());\n}\n/**\n * A PricingProfile carries an internal Symbol descriptor for cross-package\n * validation. Machine documents expose only its closed enumerable data form.\n */\nexport function closePricingProfileJson(profile: PricingProfile): JsonValue {\n return closeMachineJson(Object.fromEntries(Object.entries(profile)));\n}\nfunction freezeSelection(value: ShowSelection): ShowSelection {\n const sampleIdentity = requireNonEmptyString(value.sampleIdentity, \"selection.sampleIdentity\");\n switch (value.kind) {\n case \"project-current\":\n return Object.freeze({\n kind: \"project-current\" as const,\n sampleIdentity,\n experimentIds: freezeSortedUniqueStrings(value.experimentIds, \"selection.experimentIds\"),\n });\n case \"explicit-runs\":\n return Object.freeze({\n kind: \"explicit-runs\" as const,\n sampleIdentity,\n runIds: freezeSortedUniqueStrings(value.runIds, \"selection.runIds\"),\n });\n case \"attempt-locator\":\n return Object.freeze({\n kind: \"attempt-locator\" as const,\n sampleIdentity,\n locator: requireNonEmptyString(value.locator, \"selection.locator\"),\n });\n }\n}\nfunction freezePage(value: {\n readonly route: string;\n readonly pageId: string;\n readonly title: LocalizedText;\n}): {\n readonly route: string;\n readonly pageId: string;\n readonly title: LocalizedText;\n} {\n return Object.freeze({\n route: requireNonEmptyString(value.route, \"page.route\"),\n pageId: requireNonEmptyString(value.pageId, \"page.pageId\"),\n title: freezeLocalizedText(value.title, \"page.title\"),\n });\n}\nfunction freezeBuiltInData(value: BuiltInShowData): BuiltInShowData {\n if (!isPlainRecord(value) || typeof value.kind !== \"string\") {\n throw new TypeError(\"built-in show data must be a named domain result\");\n }\n // Domain arrays are deliberately not given a generic renderer sort here.\n // The selected registry producer owns their stable identities and must close\n // them in the canonical order defined for that domain before returning.\n switch (value.kind) {\n case \"leaderboard\":\n assertExactFields(value, [\"kind\", \"rows\"], \"leaderboard show data\");\n return Object.freeze({ kind: \"leaderboard\" as const, rows: closeMachineJson(value.rows) });\n case \"attempt\":\n assertExactFields(value, [\"kind\", \"evidence\", \"observability\", \"fileChanges\"], \"attempt show data\");\n return Object.freeze({\n kind: \"attempt\" as const,\n evidence: closeMachineJson(value.evidence),\n observability: closeMachineJson(value.observability),\n fileChanges: closeMachineJson(value.fileChanges),\n });\n case \"source\":\n assertExactFields(value, [\"kind\", \"sources\"], \"source show data\");\n return Object.freeze({ kind: \"source\" as const, sources: closeMachineJson(value.sources) });\n case \"execution\":\n assertExactFields(value, [\"kind\", \"execution\"], \"execution show data\");\n return Object.freeze({ kind: \"execution\" as const, execution: closeMachineJson(value.execution) });\n case \"timing\":\n assertExactFields(value, [\"kind\", \"timing\"], \"timing show data\");\n return Object.freeze({ kind: \"timing\" as const, timing: closeMachineJson(value.timing) });\n default:\n throw new TypeError(\"built-in show data kind is not declared by the show schema\");\n }\n}\n/** Re-closes a ReportProjections value: validates schema, dedupes, and canonically sorts. */\nfunction freezeProjections(value: ReportProjections): ReportProjections {\n if (!isPlainRecord(value) || value.schema !== REPORT_PROJECTIONS_SCHEMA) {\n throw new TypeError(\"projections must be a niceeval.report-projections/v1 value\");\n }\n return buildReportProjections({\n pricingProfile: value.pricingProfile,\n costs: value.costs.map((entry) => ({\n page: entry.page,\n measureId: entry.measureId,\n row: entry.row,\n profileIdentity: entry.profileIdentity,\n projection: entry.projection,\n })),\n });\n}\nfunction freezeProblems(value: readonly ReportProblem[]): readonly ReportProblem[] {\n if (!Array.isArray(value))\n throw new TypeError(\"problems must be an array\");\n const entries = value.map((problem, index) => {\n if (!isNonEmptyString(problem.code))\n throw new TypeError(`problems[${index}].code must be a non-empty string`);\n const path = freezeStrings(problem.path, `problems[${index}].path`);\n const refs = freezeSortedUniqueStrings(problem.refs, `problems[${index}].refs`);\n if (problem.summary !== undefined && !isNonEmptyString(problem.summary)) {\n throw new TypeError(`problems[${index}].summary must be a non-empty string when supplied`);\n }\n return Object.freeze({\n code: problem.code,\n path,\n refs,\n ...(problem.summary === undefined ? {} : { summary: problem.summary }),\n });\n });\n return Object.freeze(entries.sort((left, right) => compareUtf8(left.code, right.code) ||\n comparePath(left.path, right.path) ||\n compareStringArrays(left.refs, right.refs) ||\n compareUtf8(left.summary ?? \"\", right.summary ?? \"\")));\n}\nfunction freezeLocalizedText(value: LocalizedText, label: string): LocalizedText {\n if (typeof value === \"string\")\n return value;\n const closed = closeMachineJson(value);\n if (closed === null || Array.isArray(closed) || typeof closed !== \"object\") {\n throw new TypeError(`${label} 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(`${label} 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 freezeStrings(value: readonly string[], label: string): readonly string[] {\n if (!Array.isArray(value) || value.some((entry) => !isNonEmptyString(entry))) {\n throw new TypeError(`${label} must be an array of non-empty strings`);\n }\n return Object.freeze([...value]);\n}\nfunction freezeSortedUniqueStrings(value: readonly string[], label: string): readonly string[] {\n const entries = freezeStrings(value, label);\n return Object.freeze([...new Set(entries)].sort(compareUtf8));\n}\nfunction comparePath(left: readonly string[], right: readonly string[]): number {\n const length = Math.min(left.length, right.length);\n for (let index = 0; index < length; index += 1) {\n const difference = compareUtf8(left[index]!, right[index]!);\n if (difference !== 0)\n return difference;\n }\n return left.length - right.length;\n}\nfunction compareStringArrays(left: readonly string[], right: readonly string[]): number {\n return comparePath(left, right);\n}\nfunction closeJson(value: unknown, 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(\"machine JSON cannot contain a non-finite number\");\n return Object.is(value, -0) ? 0 : value;\n }\n if (typeof value === \"undefined\" || typeof value === \"bigint\" || typeof value === \"symbol\" || typeof value === \"function\") {\n throw new TypeError(\"machine JSON must be data only\");\n }\n if (active.has(value))\n throw new TypeError(\"machine JSON cannot contain a cycle\");\n active.add(value);\n try {\n if (Array.isArray(value))\n return Object.freeze(value.map((entry) => closeJson(entry, active)));\n if (!isPlainRecord(value))\n throw new TypeError(\"machine JSON must use plain data objects\");\n const copy: Record<string, JsonValue> = Object.create(null) as Record<string, JsonValue>;\n for (const key of Object.keys(value).sort(compareUtf8))\n copy[key] = closeJson(value[key], active);\n return Object.freeze(copy);\n }\n finally {\n active.delete(value);\n }\n}\nfunction writeCanonicalJson(value: JsonValue): string {\n if (value === null)\n return \"null\";\n switch (typeof value) {\n case \"boolean\":\n return value ? \"true\" : \"false\";\n case \"number\":\n return JSON.stringify(value);\n case \"string\":\n return JSON.stringify(value);\n case \"object\":\n break;\n }\n if (Array.isArray(value))\n return `[${value.map(writeCanonicalJson).join(\",\")}]`;\n const record = value as Readonly<Record<string, JsonValue>>;\n const keys = Object.keys(record).sort(compareUtf8);\n return `{${keys.map((key) => `${JSON.stringify(key)}:${writeCanonicalJson(record[key]!)}`).join(\",\")}}`;\n}\nfunction isPlainRecord(value: unknown): value is Readonly<Record<string, unknown>> {\n if (typeof value !== \"object\" || value === null || Array.isArray(value) || value instanceof Uint8Array)\n return false;\n const prototype = Object.getPrototypeOf(value);\n if (prototype !== Object.prototype && prototype !== 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}\n/** The descriptor alone is allowed its one non-enumerable Symbol.for brand. */\nfunction isBuiltInDescriptorRecord(value: unknown): value is Readonly<Record<string, unknown>> {\n if (typeof value !== \"object\" || value === null || Array.isArray(value) || value instanceof Uint8Array)\n return false;\n const prototype = Object.getPrototypeOf(value);\n if (prototype !== Object.prototype && prototype !== null)\n return false;\n for (const key of Reflect.ownKeys(value)) {\n if (typeof key === \"symbol\" && key !== BUILT_IN_MACHINE_DESCRIPTOR)\n return false;\n if (typeof key !== \"string\" && typeof key !== \"symbol\")\n return false;\n const descriptor = Object.getOwnPropertyDescriptor(value, key);\n if (descriptor === undefined || !(\"value\" in descriptor))\n return false;\n }\n return true;\n}\nfunction hasOnlyFields(value: Readonly<Record<string, unknown>>, keys: readonly string[]): boolean {\n const actual = Object.getOwnPropertyNames(value);\n return actual.length === keys.length && keys.every((key) => Object.hasOwn(value, key));\n}\nfunction assertExactFields(value: Readonly<Record<string, unknown>>, keys: readonly string[], label: string): void {\n if (!hasOnlyFields(value, keys))\n throw new TypeError(`${label} has an invalid field set`);\n}\nfunction isVersionedProducerId(value: unknown): value is string {\n return typeof value === \"string\" && /^[^\\s@][^\\s]*@v[1-9][0-9]*$/u.test(value);\n}\nfunction requireNonEmptyString(value: unknown, label: string): string {\n if (!isNonEmptyString(value))\n throw new TypeError(`${label} must be a non-empty string`);\n return value;\n}\nfunction requireString(value: unknown, label: string): string {\n if (typeof value !== \"string\")\n throw new TypeError(`${label} must be a string`);\n return value;\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}\n"]}
@@ -225,6 +225,7 @@ function executeTarget(input) {
225
225
  hrefPages: input.pages,
226
226
  page: context.page,
227
227
  route: context.target.route,
228
+ ...(input.textProjection === undefined ? {} : { textProjection: input.textProjection }),
228
229
  }),
229
230
  });
230
231
  }
@@ -238,20 +239,29 @@ function closeRenderedPage(input) {
238
239
  });
239
240
  (0, tree_ts_1.validateReportTree)(resolved);
240
241
  assertDocumentBudget(resolved, input.page.id, input.page.path);
241
- const text = WEB_LOCALES.map((locale) => {
242
+ const requestedTextProjections = [
243
+ { width: TEXT_WIDTH, panelMode: "plain" },
244
+ ...(input.textProjection === undefined ||
245
+ (input.textProjection.width === TEXT_WIDTH && input.textProjection.panelMode === "plain")
246
+ ? []
247
+ : [input.textProjection]),
248
+ ];
249
+ const text = WEB_LOCALES.flatMap((locale) => requestedTextProjections.map((projection) => {
242
250
  const pageDimensions = (0, tree_ts_1.collectPageDimensions)(resolved, input.report.dimensionPins, "text");
243
251
  const context = (0, tree_ts_1.createTextContext)({
244
- width: TEXT_WIDTH,
252
+ width: projection.width,
245
253
  locale,
254
+ panelMode: projection.panelMode,
246
255
  pageDimensions,
247
256
  command: (target) => commandForTarget(input.hrefPages, target),
248
257
  });
249
258
  return Object.freeze({
250
259
  locale,
251
- width: TEXT_WIDTH,
260
+ width: projection.width,
261
+ panelMode: projection.panelMode,
252
262
  text: (0, tree_ts_1.renderNodeToText)(resolved, context),
253
263
  });
254
- });
264
+ }));
255
265
  const web = WEB_LOCALES.map((locale) => {
256
266
  const pageDimensions = (0, tree_ts_1.collectPageDimensions)(resolved, input.report.dimensionPins, "web");
257
267
  const context = (0, tree_ts_1.withPageDimensions)({
@@ -1 +1 @@
1
- {"version":3,"file":"execute.js","sourceRoot":"","sources":["execute.ts"],"names":[],"mappings":";;AAkEA,kDAoCC;AAID,8CA6FC;AA4MD,wDAKC;AA8GD,4DA0BC;AAwCD,0CAEC;AA1kBD,6CAAyC;AACzC,+CAA4C;AAC5C,mCAAgC;AAEhC,iCAAiF;AACjF,6CAAwD;AACxD,sDAA0K;AAC1K,8DAA+F;AAC/F,uDAA2I;AAC3I,mDAA0Q;AAC1Q,wEAAyE;AACzE,gEAAoE;AACpE,oDAAiO;AAEjO,oDAA2K;AAC3K,sDAAsG;AACtG,kDAA0D;AAG1D,qDAAoG;AACpG,uDAA0H;AAC1H,wDAA+M;AAC/M,MAAM,UAAU,GAAG,EAAE,CAAC;AACtB,MAAM,WAAW,GAAG,CAAC,IAAI,EAAE,OAAO,CAAU,CAAC;AAuC7C;;;GAGG;AACH,SAAgB,mBAAmB,CAAC,KAInC;IACG,MAAM,OAAO,GAAG,IAAA,2CAAyB,EAAC,KAAK,CAAC,MAAM,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC;IACrE,IAAI,IAAA,4CAA0B,EAAC,OAAO,CAAC;QACnC,OAAO,eAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAChC,OAAO,eAAM,CAAC,GAAG,CAAC,QAAQ,CAAC;QACvB,MAAM,OAAO,GAAG,KAAK,CAAC,CAAC,IAAA,qCAAqB,EAAC,KAAK,CAAC,MAAM,CAAC,CAAC;QAC3D,OAAO,KAAK,CAAC,CAAC,eAAM,CAAC,QAAQ,CAAC,eAAM,CAAC,OAAO;QAC5C,kEAAkE;QAClE,iCAAiC;QACjC,aAAa,CAAC;YACV,GAAG,KAAK;YACR,KAAK,EAAE,KAAK,CAAC,MAAM,C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AAO,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;AACjE,CAAC;AACD,qEAAqE;AACrE,SAAgB,eAAe,CAAC,IAAkB,EAAE,MAAc;IAC9D,OAAO,IAAA,gCAAoB,EAAC,IAAI,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;AACpD,CAAC","sourcesContent":["import { createHash } from \"node:crypto\";\nimport { readFile } from \"node:fs/promises\";\nimport { Effect } from \"effect\";\nimport type * as Scope from \"effect/Scope\";\nimport { createElement, Fragment as ReactFragment, type ReactNode } from \"react\";\nimport { renderToStaticMarkup } from \"react-dom/server\";\nimport { attemptEvidenceView, query, type AnalysisIssue, type AnalysisRequestError, type JsonValue, type Sample, type SampleClosedError, } from \"../../analysis/index.ts\";\nimport { captureAnalysisIssues, type AnalysisIssueCapture, } from \"../../sample/capability.ts\";\nimport { buildReportMeta, resolveReportTitle, type PageContext, type ReportDefinition, type ReportTarget, } from \"../definition/report.ts\";\nimport { COMPONENT_RAW_CHILDREN, Fragment, collectPageDimensions, createTextContext, renderNodeToText, resolveReportTree, runWithWebContext, validateReportTree, withPageDimensions, type ReportElement, type ReportNode, type WebContext, } from \"../definition/tree.ts\";\nimport { collectDownloads } from \"../definition/primitives/downloads.ts\";\nimport { DOWNLOAD_TARGET_PAGE } from \"../definition/primitives.tsx\";\nimport { REPORT_BUILD_RSS_BYTES_MAX, REPORT_BUILD_TIME_MS_MAX, REPORT_DOCUMENT_DEPTH_MAX, REPORT_DOCUMENT_NODES_MAX, REPORT_PAGES_MAX, reportBuildBudgetExceeded, type ReportBuildBudgetExceeded, } from \"../execution/model.ts\";\nimport type { ReportProblem } from \"../execution/machine.ts\";\nimport { routeWithParameterKey, staticPathForDownload, staticPathForRoute, validateDownloadPath, validateParameterKey, validateReportRoute, } from \"../execution/paths.ts\";\nimport { collectRendererAssetDeclarations, materializeRendererAssets, } from \"../extension/assets.ts\";\nimport { resolveLocalizedText } from \"../model/locale.ts\";\nimport { type ResolvedPage, type ResolvedPageAssetOutput, type ResolvedPageClosureError, type ResolvedPageOutput, } from \"../runtime/resolved-page.ts\";\nimport type { ThemeDefinition } from \"../theme.ts\";\nimport { executeShowTarget, type ShowTargetError, type ShowTargetRequest, } from \"./show-target.ts\";\nimport { isReportTargetRouteInvalid, showTargetRequestForRoute, type ReportTargetRouteInvalid, } from \"./target-route.ts\";\nimport { buildReportProjections, closePricingProfileJson, reportProjectionFailure, type ReportProjectionBuildFailure, type ReportProjectionCostInput, type ReportProjections, } from \"../execution/machine.ts\";\nconst TEXT_WIDTH = 80;\nconst WEB_LOCALES = [\"en\", \"zh-CN\"] as const;\nexport interface ReportPageExecutionFailed {\n readonly code: \"report-page-execution-failed\";\n readonly pageId: string;\n readonly phase: \"enumerate\" | \"params-encode\" | \"resolve\" | \"text\" | \"web\" | \"assets\";\n readonly reason: string;\n}\nexport interface ReportSiteRouteConflict {\n readonly code: \"report-site-route-conflict\";\n readonly route: string;\n readonly pageIds: readonly [\n string,\n string\n ];\n}\nexport type ReportExecutionError = SampleClosedError | AnalysisRequestError | ShowTargetError | ResolvedPageClosureError | ReportTargetRouteInvalid | ReportPageExecutionFailed | ReportSiteRouteConflict | ReportProjectionBuildFailure | ReportBuildBudgetExceeded;\nexport interface ClosedTargetExecution {\n readonly page: ResolvedPage;\n readonly projections: ReportProjections;\n readonly problems: readonly ReportProblem[];\n}\nexport interface ClosedSitePage {\n readonly page: ResolvedPage;\n readonly navigation: boolean;\n}\n/** Host-private complete page closure used only while forming a revision. */\nexport interface ClosedReportSite {\n /** Monotonic-enough wall clock anchor for the full Sample-open + byte build budget. */\n readonly startedAtMs: number;\n /** Process RSS immediately before the Record-backed Sample is opened. */\n readonly baselineRssBytes: number;\n readonly sampleIdentity: string;\n readonly reportIdentity: string;\n readonly title: import(\"../model/locale.ts\").LocalizedText;\n readonly theme?: ThemeDefinition;\n readonly pages: readonly ClosedSitePage[];\n readonly projections: ReportProjections;\n readonly problems: readonly ReportProblem[];\n}\n/**\n * Executes exactly one selected route. It intentionally delegates selection to\n * show-target.ts, whose parameterized branch never calls enumerate().\n */\nexport function executeReportTarget(input: {\n readonly sample: Sample;\n readonly report: ReportDefinition;\n readonly route?: string;\n}): Effect.Effect<ClosedTargetExecution, ReportExecutionError, Scope.Scope> {\n const request = showTargetRequestForRoute(input.report, input.route);\n if (isReportTargetRouteInvalid(request))\n return Effect.fail(request);\n return Effect.gen(function* () {\n const capture = yield* captureAnalysisIssues(input.sample);\n return yield* Effect.ensuring(Effect.flatMap(\n // show keeps the exact author declaration and never enumerates an\n // unselected parameterized Page.\n executeTarget({\n ...input,\n pages: input.report.pages,\n request,\n capture,\n }), (page) => {\n const costs = capturedProjectionCosts(capture, page.target.route, page.target.pageId);\n const pricingProfile = reportPricingProfileJson(input.report);\n const failure = reportProjectionFailure({ pricingProfile, costs });\n if (failure !== undefined)\n return Effect.fail(failure);\n return Effect.succeed(Object.freeze({\n page,\n // Every cost entry captured during this one Page execution binds\n // to that route/page and retains Analysis's measure/row/profile.\n projections: buildReportProjections({\n pricingProfile,\n costs,\n }),\n problems: analysisProblems(capture.issues(), page.target.pageId),\n }));\n }), Effect.sync(() => capture.close()));\n });\n}\n/** One normalized Page declaration owned by the selected Report. */\ntype ReportPageDefinition = ReportDefinition[\"pages\"][number];\n/** Enumerates and closes every page instance exactly once for view/static. */\nexport function executeReportSite(input: {\n readonly sample: Sample;\n readonly report: ReportDefinition;\n readonly budget: ReportBuildBudgetAnchor;\n}): Effect.Effect<ClosedReportSite, ReportExecutionError, Scope.Scope> {\n return Effect.gen(function* () {\n const { startedAtMs, baselineRssBytes } = input.budget;\n // The outer capture covers enumerate()/params encode phases for generic\n // Analysis issues only. Cost projections belong only to actual Page\n // executions, where the Host can bind a real route/pageId.\n const outerCapture = yield* captureAnalysisIssues(input.sample);\n return yield* Effect.ensuring(Effect.gen(function* () {\n const pages: ClosedSitePage[] = [];\n const routeOwners = new Map<string, string>();\n const siteIssues: AnalysisIssue[] = [];\n const projectionCosts: ReportProjectionCostInput[] = [];\n const pricingProfile = reportPricingProfileJson(input.report);\n // The Report declaration is the only page owner. A custom Report that\n // wants official drill-down Pages composes those exported Pages\n // explicitly; the Host never merges another Report by id.\n const definitions = input.report.pages;\n const plainCount = definitions.filter((page) => page.params === undefined).length;\n if (plainCount > REPORT_PAGES_MAX) {\n return yield* Effect.fail(reportBuildBudgetExceeded(\"pages\", REPORT_PAGES_MAX, plainCount));\n }\n for (const definition of definitions) {\n yield* checkBuildBudgets(input.budget);\n if (definition.params === undefined) {\n const { page, projectionCosts: pageCosts, issues } = yield* executePageWithCapture({\n ...input,\n pages: definitions,\n request: { kind: \"page\", pageId: definition.id },\n capturePage: (capture) => capturedProjectionCosts(capture, definition.path, definition.id),\n });\n yield* addSitePage(pages, routeOwners, page, definition.navigation);\n yield* registerProjectionCosts(pricingProfile, projectionCosts, pageCosts);\n siteIssues.push(...issues);\n continue;\n }\n const values = yield* invokeAuthor(definition.id, \"enumerate\", outerCapture, () => definition.params.enumerate(input.sample));\n if (values === null || values === undefined || typeof (values as Iterable<JsonValue>)[Symbol.iterator] !== \"function\") {\n return yield* Effect.fail(pageFailure(definition.id, \"enumerate\", \"params.enumerate() must return a finite Iterable\"));\n }\n for (const params of values as Iterable<JsonValue>) {\n if (pages.length >= REPORT_PAGES_MAX) {\n return yield* Effect.fail(reportBuildBudgetExceeded(\"pages\", REPORT_PAGES_MAX, pages.length + 1));\n }\n const key = yield* invokeAuthor(definition.id, \"params-encode\", outerCapture, () => definition.params.encode(params));\n const invalidKey = typeof key === \"string\" ? validateParameterKey(key) : undefined;\n if (typeof key !== \"string\" || invalidKey !== undefined) {\n return yield* Effect.fail(pageFailure(definition.id, \"params-encode\", invalidKey?.reason ?? \"params.encode() must return a canonical parameter key\"));\n }\n const route = routeWithParameterKey(definition.path, key);\n const routeIssue = validateReportRoute(route);\n if (routeIssue !== undefined) {\n return yield* Effect.fail(pageFailure(definition.id, \"params-encode\", routeIssue.reason));\n }\n // executeShowTarget supplies the required decode -> encode\n // canonical round trip, but does not enumerate this page again.\n const { page, projectionCosts: pageCosts, issues } = yield* executePageWithCapture({\n ...input,\n pages: definitions,\n request: {\n kind: \"parameterized-page\",\n pageId: definition.id,\n key,\n route,\n },\n capturePage: (capture) => capturedProjectionCosts(capture, route, definition.id),\n });\n yield* addSitePage(pages, routeOwners, page, false);\n yield* registerProjectionCosts(pricingProfile, projectionCosts, pageCosts);\n siteIssues.push(...issues);\n yield* checkBuildBudgets(input.budget);\n }\n }\n siteIssues.push(...outerCapture.issues());\n return Object.freeze({\n startedAtMs,\n baselineRssBytes,\n sampleIdentity: input.sample.snapshot.identity.id,\n reportIdentity: reportDefinitionIdentity(input.report),\n title: resolveReportTitle(input.report),\n ...(input.report.theme === undefined ? {} : { theme: input.report.theme }),\n pages: Object.freeze(pages),\n projections: buildReportProjections({\n pricingProfile,\n costs: projectionCosts,\n }),\n problems: analysisProblems(mergeAnalysisIssues(siteIssues)),\n });\n }), Effect.sync(() => outerCapture.close()));\n });\n}\n/** One Page execution with its own capture: page, bound projection costs, and issues. */\nfunction executePageWithCapture(input: {\n readonly sample: Sample;\n readonly report: ReportDefinition;\n readonly pages: readonly ReportPageDefinition[];\n readonly request: ShowTargetRequest;\n readonly capturePage: (capture: AnalysisIssueCapture) => ReportProjectionCostInput[];\n}): Effect.Effect<{\n readonly page: ResolvedPage;\n readonly projectionCosts: readonly ReportProjectionCostInput[];\n readonly issues: readonly AnalysisIssue[];\n}, ReportExecutionError, Scope.Scope> {\n return Effect.gen(function* () {\n const capture = yield* captureAnalysisIssues(input.sample);\n return yield* Effect.ensuring(Effect.map(executeTarget({ ...input, capture }), (page) => Object.freeze({\n page,\n projectionCosts: Object.freeze(input.capturePage(capture)),\n issues: capture.issues(),\n })), Effect.sync(() => capture.close()));\n });\n}\n/**\n * Validates one Page's capture before retaining it. Route ownership makes\n * capture keys page-local, so re-closing every prior Page here would only\n * repeat canonical JSON work quadratically; the final site closure performs\n * the one whole-site canonicalization.\n */\nfunction registerProjectionCosts(pricingProfile: JsonValue | null, output: ReportProjectionCostInput[], costs: readonly ReportProjectionCostInput[]): Effect.Effect<void, ReportProjectionBuildFailure> {\n const failure = reportProjectionFailure({ pricingProfile, costs });\n if (failure !== undefined)\n return Effect.fail(failure);\n output.push(...costs);\n return Effect.void;\n}\n/**\n * Reads the cost entries an Analysis execution capture recorded and binds them\n * to one Page execution. The Host never rebuilds a projection from a\n * MetricValue.value or from the built-in show data.\n */\nfunction capturedProjectionCosts(capture: AnalysisIssueCapture, route: string, pageId: string): 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 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/** Merges per-Page issue captures into the site-wide problem table input. */\nfunction mergeAnalysisIssues(issues: readonly AnalysisIssue[]): readonly AnalysisIssue[] {\n const unique = new Map<string, AnalysisIssue>();\n for (const issue of issues) {\n const key = `${issue.code}\\u0000${issue.message}\\u0000${issue.refs\n .map((ref) => ref.identity.locator).sort(compareUtf8).join(\"\\u0001\")}`;\n if (!unique.has(key))\n unique.set(key, issue);\n }\n return Object.freeze([...unique.values()].sort((left, right) => compareUtf8(left.code, right.code) || compareUtf8(left.message, right.message)));\n}\nfunction executeTarget(input: {\n readonly sample: Sample;\n readonly report: ReportDefinition;\n /** The target-visible Page set from the selected Report declaration. */\n readonly pages: readonly ReportPageDefinition[];\n readonly request: ShowTargetRequest;\n readonly capture: AnalysisIssueCapture;\n}): Effect.Effect<ResolvedPage, ReportExecutionError, Scope.Scope> {\n return executeShowTarget<ReportPageExecutionFailed, never>({\n definition: { pages: input.pages },\n sample: input.sample,\n request: input.request,\n evidence: (locator) => query(input.sample, {\n kind: \"domain-view\",\n view: attemptEvidenceView,\n locator,\n }),\n runAuthor: input.capture.run,\n close: (rendered, context) => closeRenderedPage({\n rendered: rendered as ReportNode,\n sample: input.sample,\n report: input.report,\n capture: input.capture,\n hrefPages: input.pages,\n page: context.page,\n route: context.target.route,\n }),\n });\n}\nfunction closeRenderedPage(input: {\n readonly rendered: ReportNode;\n readonly sample: Sample;\n readonly report: ReportDefinition;\n /** Keeps Analysis calls made while resolving component trees page-bound. */\n readonly capture: AnalysisIssueCapture;\n /** Link targets are resolved only against the selected Report declaration. */\n readonly hrefPages: readonly ReportPageDefinition[];\n readonly page: PageContext;\n readonly route: string;\n}): Effect.Effect<ResolvedPageOutput, ReportPageExecutionFailed> {\n return Effect.tryPromise({\n try: () => input.capture.run(async (): Promise<ResolvedPageOutput> => {\n const resolved = await resolveReportTree(input.rendered, {\n scope: input.sample,\n page: input.page,\n report: buildReportMeta(input.report),\n });\n validateReportTree(resolved);\n assertDocumentBudget(resolved, input.page.id, input.page.path);\n const text = WEB_LOCALES.map((locale) => {\n const pageDimensions = collectPageDimensions(resolved, input.report.dimensionPins, \"text\");\n const context = createTextContext({\n width: TEXT_WIDTH,\n locale,\n pageDimensions,\n command: (target) => commandForTarget(input.hrefPages, target),\n });\n return Object.freeze({\n locale,\n width: TEXT_WIDTH,\n text: renderNodeToText(resolved, context),\n });\n });\n const web = WEB_LOCALES.map((locale) => {\n const pageDimensions = collectPageDimensions(resolved, input.report.dimensionPins, \"web\");\n const context = withPageDimensions<WebContext>({\n locale,\n href: (target) => hrefForTarget(input.hrefPages, input.route, target),\n dimension: () => {\n throw new Error(\"a Report web face queried an undeclared dimension\");\n },\n }, pageDimensions);\n const html = runWithWebContext(Object.freeze(context), () => renderToStaticMarkup(createElement(ReactFragment, null, resolved as ReactNode)));\n return Object.freeze({ locale, html });\n });\n const downloads = collectDownloads(resolved).map((download) => Object.freeze({\n id: download.path,\n path: download.path,\n mediaType: download.mediaType,\n bytes: download.bytes,\n }));\n const rendererAssets = await materializeRendererAssets(collectRendererAssetDeclarations(resolved), async (path) => new Uint8Array(await readFile(path)));\n const assets: ResolvedPageAssetOutput[] = [\n ...rendererAssets.styles.map((asset) => Object.freeze({\n kind: \"style\" as const,\n path: asset.path,\n mediaType: \"text/css; charset=utf-8\",\n bytes: asset.content,\n sha256: asset.hash,\n })),\n ...rendererAssets.scripts.map((asset) => Object.freeze({\n kind: \"script\" as const,\n path: asset.path,\n mediaType: \"text/javascript; charset=utf-8\",\n bytes: asset.content,\n sha256: asset.hash,\n })),\n ];\n return Object.freeze({\n title: input.page.title,\n head: input.report.head as unknown as JsonValue,\n text: Object.freeze(text),\n web: Object.freeze(web),\n downloads: Object.freeze(downloads),\n assets: Object.freeze(assets),\n });\n }),\n catch: (cause): ReportPageExecutionFailed => pageFailure(input.page.id, classifyCloseFailure(cause), boundedReason(cause)),\n });\n}\nfunction invokeAuthor<Value>(pageId: string, phase: ReportPageExecutionFailed[\"phase\"], capture: AnalysisIssueCapture, callback: () => Value | PromiseLike<Value>): Effect.Effect<Value, ReportPageExecutionFailed> {\n return Effect.tryPromise({\n try: () => new Promise<Value>((resolve) => resolve(capture.run(callback))),\n catch: (cause) => pageFailure(pageId, phase, boundedReason(cause)),\n });\n}\nfunction addSitePage(pages: ClosedSitePage[], routeOwners: Map<string, string>, page: ResolvedPage, navigation: boolean): Effect.Effect<void, ReportSiteRouteConflict | ReportBuildBudgetExceeded> {\n const owner = routeOwners.get(page.target.route);\n if (owner !== undefined) {\n return Effect.fail(Object.freeze({\n code: \"report-site-route-conflict\" as const,\n route: page.target.route,\n pageIds: Object.freeze([owner, page.target.pageId]) as readonly [\n string,\n string\n ],\n }));\n }\n if (pages.length >= REPORT_PAGES_MAX) {\n return Effect.fail(reportBuildBudgetExceeded(\"pages\", REPORT_PAGES_MAX, pages.length + 1));\n }\n routeOwners.set(page.target.route, page.target.pageId);\n pages.push(Object.freeze({ page, navigation }));\n return Effect.void;\n}\nexport interface ReportBuildBudgetAnchor {\n readonly startedAtMs: number;\n readonly baselineRssBytes: number;\n}\n/** Starts the budget before Record selection opens the fixed Sample. */\nexport function startReportBuildBudget(): ReportBuildBudgetAnchor {\n return Object.freeze({\n startedAtMs: Date.now(),\n baselineRssBytes: process.memoryUsage().rss,\n });\n}\nfunction checkBuildBudgets(anchor: ReportBuildBudgetAnchor): Effect.Effect<void, ReportBuildBudgetExceeded> {\n const elapsed = Date.now() - anchor.startedAtMs;\n if (elapsed > REPORT_BUILD_TIME_MS_MAX) {\n return Effect.fail(reportBuildBudgetExceeded(\"build-time\", REPORT_BUILD_TIME_MS_MAX, elapsed));\n }\n const rssGrowth = Math.max(0, process.memoryUsage().rss - anchor.baselineRssBytes);\n if (rssGrowth > REPORT_BUILD_RSS_BYTES_MAX) {\n return Effect.fail(reportBuildBudgetExceeded(\"build-rss\", REPORT_BUILD_RSS_BYTES_MAX, rssGrowth));\n }\n return Effect.void;\n}\nfunction assertDocumentBudget(node: ReportNode, pageId: string, route: string): void {\n const observed = countDocument(node, 0);\n if (observed.nodes > REPORT_DOCUMENT_NODES_MAX) {\n throw reportBuildBudgetExceeded(\"document-nodes\", REPORT_DOCUMENT_NODES_MAX, observed.nodes, { pageId, route });\n }\n if (observed.depth > REPORT_DOCUMENT_DEPTH_MAX) {\n throw reportBuildBudgetExceeded(\"document-depth\", REPORT_DOCUMENT_DEPTH_MAX, observed.depth, { pageId, route });\n }\n}\nfunction countDocument(node: ReportNode, depth: number): {\n readonly nodes: number;\n readonly depth: number;\n} {\n if (node === null || node === undefined || typeof node === \"boolean\")\n return { nodes: 0, depth };\n if (Array.isArray(node)) {\n return node.reduce((total, child) => {\n const counted = countDocument(child, depth);\n return { nodes: total.nodes + counted.nodes, depth: Math.max(total.depth, counted.depth) };\n }, { nodes: 0, depth });\n }\n if (!isElement(node))\n return { nodes: 1, depth: depth + 1 };\n const currentDepth = depth + 1;\n if (node.type !== Fragment && typeof node.type === \"function\" &&\n (node.type as unknown as Record<symbol, unknown>)[COMPONENT_RAW_CHILDREN] === true) {\n return { nodes: 1, depth: currentDepth };\n }\n const child = countDocument(node.props.children as ReportNode, currentDepth);\n return { nodes: child.nodes + 1, depth: Math.max(currentDepth, child.depth) };\n}\nfunction isElement(value: unknown): value is ReportElement {\n if (typeof value !== \"object\" || value === null || Array.isArray(value))\n return false;\n const candidate = value as Partial<ReportElement>;\n return typeof candidate.$$typeof === \"symbol\" &&\n (candidate.$$typeof === Symbol.for(\"react.element\") || candidate.$$typeof === Symbol.for(\"react.transitional.element\")) &&\n typeof candidate.props === \"object\" && candidate.props !== null;\n}\nfunction routeForTarget(pages: readonly ReportPageDefinition[], target: ReportTarget): string | undefined {\n const page = pages.find((candidate) => candidate.id === target.page);\n if (page === undefined)\n return undefined;\n if (page.params === undefined)\n return target.params === undefined ? page.path : undefined;\n if (target.params === undefined)\n return undefined;\n try {\n const key = page.params.encode(target.params);\n return validateParameterKey(key) === undefined ? routeWithParameterKey(page.path, key) : undefined;\n }\n catch {\n return undefined;\n }\n}\nfunction hrefForTarget(pages: readonly ReportPageDefinition[], sourceRoute: string, target: ReportTarget): string | undefined {\n const source = staticPathForRoute(sourceRoute).posix;\n if (target.page === DOWNLOAD_TARGET_PAGE) {\n const path = isJsonRecord(target.params) ? target.params.path : undefined;\n if (typeof path !== \"string\" || validateDownloadPath(path) !== undefined)\n return undefined;\n return relativeHref(source, staticPathForDownload(path).posix);\n }\n const route = routeForTarget(pages, target);\n return route === undefined ? undefined : relativeHref(source, staticPathForRoute(route).posix);\n}\nfunction isJsonRecord(value: JsonValue | undefined): value is Readonly<Record<string, JsonValue>> {\n return typeof value === \"object\" && value !== null && !Array.isArray(value);\n}\nfunction relativeHref(sourceFile: string, targetFile: string): string {\n const sourceSegments = sourceFile.split(\"/\");\n sourceSegments.pop();\n const targetSegments = targetFile.split(\"/\");\n let common = 0;\n while (common < sourceSegments.length && common < targetSegments.length &&\n sourceSegments[common] === targetSegments[common])\n common += 1;\n const relative = [\n ...sourceSegments.slice(common).map(() => \"..\"),\n ...targetSegments.slice(common),\n ].join(\"/\");\n return relative || \"./\";\n}\nfunction commandForTarget(pages: readonly ReportPageDefinition[], target: ReportTarget): string | undefined {\n const route = routeForTarget(pages, target);\n return route === undefined ? undefined : `niceeval show --page ${shellQuote(route)}`;\n}\nfunction shellQuote(value: string): string {\n return `'${value.replaceAll(\"'\", `'\\\\''`)}'`;\n}\nfunction analysisProblems(issues: readonly AnalysisIssue[], pageId?: string): readonly ReportProblem[] {\n return Object.freeze(issues.map((issue) => Object.freeze({\n code: `analysis-${issue.code}`,\n path: Object.freeze(pageId === undefined ? [] : [\"page\", pageId]),\n refs: Object.freeze(issue.refs.map((reference) => String(reference.identity.locator)).sort(compareUtf8)),\n summary: issue.message,\n })));\n}\nexport function reportDefinitionIdentity(report: ReportDefinition): string {\n const closed = {\n title: resolveReportTitle(report),\n head: report.head,\n theme: report.theme ?? null,\n // The Analysis-computed pricing content identity joins the definition\n // identity, so a Profile change is a new Report execution.\n pricing: report.pricing === null ? null : report.pricing.contentIdentity,\n pages: report.pages.map((page) => ({\n id: page.id,\n path: page.path,\n title: page.title,\n navigation: page.navigation,\n parameterized: page.params !== undefined,\n load: page.load?.toString() ?? null,\n render: page.render.toString(),\n params: page.params === undefined\n ? null\n : {\n encode: page.params.encode.toString(),\n decode: page.params.decode.toString(),\n enumerate: page.params.enumerate.toString(),\n },\n })),\n };\n return createHash(\"sha256\").update(canonicalJson(closed)).digest(\"hex\");\n}\nfunction canonicalJson(value: unknown): string {\n if (value === null)\n return \"null\";\n if (typeof value === \"string\" || typeof value === \"boolean\")\n return JSON.stringify(value);\n if (typeof value === \"number\")\n return Number.isFinite(value) ? JSON.stringify(Object.is(value, -0) ? 0 : value) : \"null\";\n if (Array.isArray(value))\n return `[${value.map(canonicalJson).join(\",\")}]`;\n if (typeof value === \"object\") {\n return `{${Object.entries(value).filter(([, entry]) => entry !== undefined).sort(([left], [right]) => compareUtf8(left, right))\n .map(([key, entry]) => `${JSON.stringify(key)}:${canonicalJson(entry)}`).join(\",\")}}`;\n }\n return JSON.stringify(String(value));\n}\nfunction classifyCloseFailure(cause: unknown): ReportPageExecutionFailed[\"phase\"] {\n const message = boundedReason(cause).toLowerCase();\n if (message.includes(\"asset\") || message.includes(\"enoent\"))\n return \"assets\";\n if (message.includes(\"text\"))\n return \"text\";\n if (message.includes(\"web\") || message.includes(\"react\"))\n return \"web\";\n return \"resolve\";\n}\nfunction pageFailure(pageId: string, phase: ReportPageExecutionFailed[\"phase\"], reason: string): ReportPageExecutionFailed {\n return Object.freeze({ code: \"report-page-execution-failed\" as const, pageId, phase, reason });\n}\nfunction boundedReason(cause: unknown): string {\n const raw = cause instanceof Error ? cause.message : typeof cause === \"object\" && cause !== null &&\n typeof Reflect.get(cause, \"code\") === \"string\"\n ? String(Reflect.get(cause, \"code\"))\n : String(cause);\n return raw.replace(/[\\u0000-\\u001f\\u007f-\\u009f]/g, \" \").slice(0, 512).trim() || \"Report callback failed\";\n}\nfunction compareUtf8(left: string, right: string): number {\n return Buffer.compare(Buffer.from(left), Buffer.from(right));\n}\n/** Used by the site shell without re-running any author callback. */\nexport function closedPageTitle(page: ResolvedPage, locale: string): string {\n return resolveLocalizedText(page.title, locale);\n}\n"]}
1
+ {"version":3,"file":"execute.js","sourceRoot":"","sources":["execute.ts"],"names":[],"mappings":";;AAmEA,kDAwCC;AAID,8CA6FC;AA8ND,wDAKC;AA8GD,4DA0BC;AAwCD,0CAEC;AAjmBD,6CAAyC;AACzC,+CAA4C;AAC5C,mCAAgC;AAEhC,iCAAiF;AACjF,6CAAwD;AACxD,sDAA0K;AAC1K,8DAA+F;AAC/F,uDAA2I;AAC3I,mDAA0Q;AAC1Q,wEAAyE;AACzE,gEAAoE;AACpE,oDAAiO;AAEjO,oDAA2K;AAC3K,sDAAsG;AACtG,kDAA0D;AAI1D,qDAAoG;AACpG,uDAA0H;AAC1H,wDAA+M;AAC/M,MAAM,U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AS,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;AACD,qEAAqE;AACrE,SAAgB,eAAe,CAAC,IAAkB,EAAE,MAAc;IAC9D,OAAO,IAAA,gCAAoB,EAAC,IAAI,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;AACpD,CAAC","sourcesContent":["import { createHash } from \"node:crypto\";\nimport { readFile } from \"node:fs/promises\";\nimport { Effect } from \"effect\";\nimport type * as Scope from \"effect/Scope\";\nimport { createElement, Fragment as ReactFragment, type ReactNode } from \"react\";\nimport { renderToStaticMarkup } from \"react-dom/server\";\nimport { attemptEvidenceView, query, type AnalysisIssue, type AnalysisRequestError, type JsonValue, type Sample, type SampleClosedError, } from \"../../analysis/index.ts\";\nimport { captureAnalysisIssues, type AnalysisIssueCapture, } from \"../../sample/capability.ts\";\nimport { buildReportMeta, resolveReportTitle, type PageContext, type ReportDefinition, type ReportTarget, } from \"../definition/report.ts\";\nimport { COMPONENT_RAW_CHILDREN, Fragment, collectPageDimensions, createTextContext, renderNodeToText, resolveReportTree, runWithWebContext, validateReportTree, withPageDimensions, type ReportElement, type ReportNode, type WebContext, } from \"../definition/tree.ts\";\nimport { collectDownloads } from \"../definition/primitives/downloads.ts\";\nimport { DOWNLOAD_TARGET_PAGE } from \"../definition/primitives.tsx\";\nimport { REPORT_BUILD_RSS_BYTES_MAX, REPORT_BUILD_TIME_MS_MAX, REPORT_DOCUMENT_DEPTH_MAX, REPORT_DOCUMENT_NODES_MAX, REPORT_PAGES_MAX, reportBuildBudgetExceeded, type ReportBuildBudgetExceeded, } from \"../execution/model.ts\";\nimport type { ReportProblem } from \"../execution/machine.ts\";\nimport { routeWithParameterKey, staticPathForDownload, staticPathForRoute, validateDownloadPath, validateParameterKey, validateReportRoute, } from \"../execution/paths.ts\";\nimport { collectRendererAssetDeclarations, materializeRendererAssets, } from \"../extension/assets.ts\";\nimport { resolveLocalizedText } from \"../model/locale.ts\";\nimport type { PanelMode } from \"../model/panel.ts\";\nimport { type ResolvedPage, type ResolvedPageAssetOutput, type ResolvedPageClosureError, type ResolvedPageOutput, } from \"../runtime/resolved-page.ts\";\nimport type { ThemeDefinition } from \"../theme.ts\";\nimport { executeShowTarget, type ShowTargetError, type ShowTargetRequest, } from \"./show-target.ts\";\nimport { isReportTargetRouteInvalid, showTargetRequestForRoute, type ReportTargetRouteInvalid, } from \"./target-route.ts\";\nimport { buildReportProjections, closePricingProfileJson, reportProjectionFailure, type ReportProjectionBuildFailure, type ReportProjectionCostInput, type ReportProjections, } from \"../execution/machine.ts\";\nconst TEXT_WIDTH = 80;\nconst WEB_LOCALES = [\"en\", \"zh-CN\"] as const;\nexport interface ReportPageExecutionFailed {\n readonly code: \"report-page-execution-failed\";\n readonly pageId: string;\n readonly phase: \"enumerate\" | \"params-encode\" | \"resolve\" | \"text\" | \"web\" | \"assets\";\n readonly reason: string;\n}\nexport interface ReportSiteRouteConflict {\n readonly code: \"report-site-route-conflict\";\n readonly route: string;\n readonly pageIds: readonly [\n string,\n string\n ];\n}\nexport type ReportExecutionError = SampleClosedError | AnalysisRequestError | ShowTargetError | ResolvedPageClosureError | ReportTargetRouteInvalid | ReportPageExecutionFailed | ReportSiteRouteConflict | ReportProjectionBuildFailure | ReportBuildBudgetExceeded;\nexport interface ClosedTargetExecution {\n readonly page: ResolvedPage;\n readonly projections: ReportProjections;\n readonly problems: readonly ReportProblem[];\n}\nexport interface ClosedSitePage {\n readonly page: ResolvedPage;\n readonly navigation: boolean;\n}\n/** Host-private complete page closure used only while forming a revision. */\nexport interface ClosedReportSite {\n /** Monotonic-enough wall clock anchor for the full Sample-open + byte build budget. */\n readonly startedAtMs: number;\n /** Process RSS immediately before the Record-backed Sample is opened. */\n readonly baselineRssBytes: number;\n readonly sampleIdentity: string;\n readonly reportIdentity: string;\n readonly title: import(\"../model/locale.ts\").LocalizedText;\n readonly theme?: ThemeDefinition;\n readonly pages: readonly ClosedSitePage[];\n readonly projections: ReportProjections;\n readonly problems: readonly ReportProblem[];\n}\n/**\n * Executes exactly one selected route. It intentionally delegates selection to\n * show-target.ts, whose parameterized branch never calls enumerate().\n */\nexport function executeReportTarget(input: {\n readonly sample: Sample;\n readonly report: ReportDefinition;\n readonly route?: string;\n readonly textProjection?: {\n readonly width: number;\n readonly panelMode: PanelMode;\n };\n}): Effect.Effect<ClosedTargetExecution, ReportExecutionError, Scope.Scope> {\n const request = showTargetRequestForRoute(input.report, input.route);\n if (isReportTargetRouteInvalid(request))\n return Effect.fail(request);\n return Effect.gen(function* () {\n const capture = yield* captureAnalysisIssues(input.sample);\n return yield* Effect.ensuring(Effect.flatMap(\n // show keeps the exact author declaration and never enumerates an\n // unselected parameterized Page.\n executeTarget({\n ...input,\n pages: input.report.pages,\n request,\n capture,\n }), (page) => {\n const costs = capturedProjectionCosts(capture, page.target.route, page.target.pageId);\n const pricingProfile = reportPricingProfileJson(input.report);\n const failure = reportProjectionFailure({ pricingProfile, costs });\n if (failure !== undefined)\n return Effect.fail(failure);\n return Effect.succeed(Object.freeze({\n page,\n // Every cost entry captured during this one Page execution binds\n // to that route/page and retains Analysis's measure/row/profile.\n projections: buildReportProjections({\n pricingProfile,\n costs,\n }),\n problems: analysisProblems(capture.issues(), page.target.pageId),\n }));\n }), Effect.sync(() => capture.close()));\n });\n}\n/** One normalized Page declaration owned by the selected Report. */\ntype ReportPageDefinition = ReportDefinition[\"pages\"][number];\n/** Enumerates and closes every page instance exactly once for view/static. */\nexport function executeReportSite(input: {\n readonly sample: Sample;\n readonly report: ReportDefinition;\n readonly budget: ReportBuildBudgetAnchor;\n}): Effect.Effect<ClosedReportSite, ReportExecutionError, Scope.Scope> {\n return Effect.gen(function* () {\n const { startedAtMs, baselineRssBytes } = input.budget;\n // The outer capture covers enumerate()/params encode phases for generic\n // Analysis issues only. Cost projections belong only to actual Page\n // executions, where the Host can bind a real route/pageId.\n const outerCapture = yield* captureAnalysisIssues(input.sample);\n return yield* Effect.ensuring(Effect.gen(function* () {\n const pages: ClosedSitePage[] = [];\n const routeOwners = new Map<string, string>();\n const siteIssues: AnalysisIssue[] = [];\n const projectionCosts: ReportProjectionCostInput[] = [];\n const pricingProfile = reportPricingProfileJson(input.report);\n // The Report declaration is the only page owner. A custom Report that\n // wants official drill-down Pages composes those exported Pages\n // explicitly; the Host never merges another Report by id.\n const definitions = input.report.pages;\n const plainCount = definitions.filter((page) => page.params === undefined).length;\n if (plainCount > REPORT_PAGES_MAX) {\n return yield* Effect.fail(reportBuildBudgetExceeded(\"pages\", REPORT_PAGES_MAX, plainCount));\n }\n for (const definition of definitions) {\n yield* checkBuildBudgets(input.budget);\n if (definition.params === undefined) {\n const { page, projectionCosts: pageCosts, issues } = yield* executePageWithCapture({\n ...input,\n pages: definitions,\n request: { kind: \"page\", pageId: definition.id },\n capturePage: (capture) => capturedProjectionCosts(capture, definition.path, definition.id),\n });\n yield* addSitePage(pages, routeOwners, page, definition.navigation);\n yield* registerProjectionCosts(pricingProfile, projectionCosts, pageCosts);\n siteIssues.push(...issues);\n continue;\n }\n const values = yield* invokeAuthor(definition.id, \"enumerate\", outerCapture, () => definition.params.enumerate(input.sample));\n if (values === null || values === undefined || typeof (values as Iterable<JsonValue>)[Symbol.iterator] !== \"function\") {\n return yield* Effect.fail(pageFailure(definition.id, \"enumerate\", \"params.enumerate() must return a finite Iterable\"));\n }\n for (const params of values as Iterable<JsonValue>) {\n if (pages.length >= REPORT_PAGES_MAX) {\n return yield* Effect.fail(reportBuildBudgetExceeded(\"pages\", REPORT_PAGES_MAX, pages.length + 1));\n }\n const key = yield* invokeAuthor(definition.id, \"params-encode\", outerCapture, () => definition.params.encode(params));\n const invalidKey = typeof key === \"string\" ? validateParameterKey(key) : undefined;\n if (typeof key !== \"string\" || invalidKey !== undefined) {\n return yield* Effect.fail(pageFailure(definition.id, \"params-encode\", invalidKey?.reason ?? \"params.encode() must return a canonical parameter key\"));\n }\n const route = routeWithParameterKey(definition.path, key);\n const routeIssue = validateReportRoute(route);\n if (routeIssue !== undefined) {\n return yield* Effect.fail(pageFailure(definition.id, \"params-encode\", routeIssue.reason));\n }\n // executeShowTarget supplies the required decode -> encode\n // canonical round trip, but does not enumerate this page again.\n const { page, projectionCosts: pageCosts, issues } = yield* executePageWithCapture({\n ...input,\n pages: definitions,\n request: {\n kind: \"parameterized-page\",\n pageId: definition.id,\n key,\n route,\n },\n capturePage: (capture) => capturedProjectionCosts(capture, route, definition.id),\n });\n yield* addSitePage(pages, routeOwners, page, false);\n yield* registerProjectionCosts(pricingProfile, projectionCosts, pageCosts);\n siteIssues.push(...issues);\n yield* checkBuildBudgets(input.budget);\n }\n }\n siteIssues.push(...outerCapture.issues());\n return Object.freeze({\n startedAtMs,\n baselineRssBytes,\n sampleIdentity: input.sample.snapshot.identity.id,\n reportIdentity: reportDefinitionIdentity(input.report),\n title: resolveReportTitle(input.report),\n ...(input.report.theme === undefined ? {} : { theme: input.report.theme }),\n pages: Object.freeze(pages),\n projections: buildReportProjections({\n pricingProfile,\n costs: projectionCosts,\n }),\n problems: analysisProblems(mergeAnalysisIssues(siteIssues)),\n });\n }), Effect.sync(() => outerCapture.close()));\n });\n}\n/** One Page execution with its own capture: page, bound projection costs, and issues. */\nfunction executePageWithCapture(input: {\n readonly sample: Sample;\n readonly report: ReportDefinition;\n readonly pages: readonly ReportPageDefinition[];\n readonly request: ShowTargetRequest;\n readonly capturePage: (capture: AnalysisIssueCapture) => ReportProjectionCostInput[];\n}): Effect.Effect<{\n readonly page: ResolvedPage;\n readonly projectionCosts: readonly ReportProjectionCostInput[];\n readonly issues: readonly AnalysisIssue[];\n}, ReportExecutionError, Scope.Scope> {\n return Effect.gen(function* () {\n const capture = yield* captureAnalysisIssues(input.sample);\n return yield* Effect.ensuring(Effect.map(executeTarget({ ...input, capture }), (page) => Object.freeze({\n page,\n projectionCosts: Object.freeze(input.capturePage(capture)),\n issues: capture.issues(),\n })), Effect.sync(() => capture.close()));\n });\n}\n/**\n * Validates one Page's capture before retaining it. Route ownership makes\n * capture keys page-local, so re-closing every prior Page here would only\n * repeat canonical JSON work quadratically; the final site closure performs\n * the one whole-site canonicalization.\n */\nfunction registerProjectionCosts(pricingProfile: JsonValue | null, output: ReportProjectionCostInput[], costs: readonly ReportProjectionCostInput[]): Effect.Effect<void, ReportProjectionBuildFailure> {\n const failure = reportProjectionFailure({ pricingProfile, costs });\n if (failure !== undefined)\n return Effect.fail(failure);\n output.push(...costs);\n return Effect.void;\n}\n/**\n * Reads the cost entries an Analysis execution capture recorded and binds them\n * to one Page execution. The Host never rebuilds a projection from a\n * MetricValue.value or from the built-in show data.\n */\nfunction capturedProjectionCosts(capture: AnalysisIssueCapture, route: string, pageId: string): 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 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/** Merges per-Page issue captures into the site-wide problem table input. */\nfunction mergeAnalysisIssues(issues: readonly AnalysisIssue[]): readonly AnalysisIssue[] {\n const unique = new Map<string, AnalysisIssue>();\n for (const issue of issues) {\n const key = `${issue.code}\\u0000${issue.message}\\u0000${issue.refs\n .map((ref) => ref.identity.locator).sort(compareUtf8).join(\"\\u0001\")}`;\n if (!unique.has(key))\n unique.set(key, issue);\n }\n return Object.freeze([...unique.values()].sort((left, right) => compareUtf8(left.code, right.code) || compareUtf8(left.message, right.message)));\n}\nfunction executeTarget(input: {\n readonly sample: Sample;\n readonly report: ReportDefinition;\n /** The target-visible Page set from the selected Report declaration. */\n readonly pages: readonly ReportPageDefinition[];\n readonly request: ShowTargetRequest;\n readonly capture: AnalysisIssueCapture;\n readonly textProjection?: {\n readonly width: number;\n readonly panelMode: PanelMode;\n };\n}): Effect.Effect<ResolvedPage, ReportExecutionError, Scope.Scope> {\n return executeShowTarget<ReportPageExecutionFailed, never>({\n definition: { pages: input.pages },\n sample: input.sample,\n request: input.request,\n evidence: (locator) => query(input.sample, {\n kind: \"domain-view\",\n view: attemptEvidenceView,\n locator,\n }),\n runAuthor: input.capture.run,\n close: (rendered, context) => closeRenderedPage({\n rendered: rendered as ReportNode,\n sample: input.sample,\n report: input.report,\n capture: input.capture,\n hrefPages: input.pages,\n page: context.page,\n route: context.target.route,\n ...(input.textProjection === undefined ? {} : { textProjection: input.textProjection }),\n }),\n });\n}\nfunction closeRenderedPage(input: {\n readonly rendered: ReportNode;\n readonly sample: Sample;\n readonly report: ReportDefinition;\n /** Keeps Analysis calls made while resolving component trees page-bound. */\n readonly capture: AnalysisIssueCapture;\n /** Link targets are resolved only against the selected Report declaration. */\n readonly hrefPages: readonly ReportPageDefinition[];\n readonly page: PageContext;\n readonly route: string;\n readonly textProjection?: {\n readonly width: number;\n readonly panelMode: PanelMode;\n };\n}): Effect.Effect<ResolvedPageOutput, ReportPageExecutionFailed> {\n return Effect.tryPromise({\n try: () => input.capture.run(async (): Promise<ResolvedPageOutput> => {\n const resolved = await resolveReportTree(input.rendered, {\n scope: input.sample,\n page: input.page,\n report: buildReportMeta(input.report),\n });\n validateReportTree(resolved);\n assertDocumentBudget(resolved, input.page.id, input.page.path);\n const requestedTextProjections = [\n { width: TEXT_WIDTH, panelMode: \"plain\" as const },\n ...(input.textProjection === undefined ||\n (input.textProjection.width === TEXT_WIDTH && input.textProjection.panelMode === \"plain\")\n ? []\n : [input.textProjection]),\n ];\n const text = WEB_LOCALES.flatMap((locale) => requestedTextProjections.map((projection) => {\n const pageDimensions = collectPageDimensions(resolved, input.report.dimensionPins, \"text\");\n const context = createTextContext({\n width: projection.width,\n locale,\n panelMode: projection.panelMode,\n pageDimensions,\n command: (target) => commandForTarget(input.hrefPages, target),\n });\n return Object.freeze({\n locale,\n width: projection.width,\n panelMode: projection.panelMode,\n text: renderNodeToText(resolved, context),\n });\n }));\n const web = WEB_LOCALES.map((locale) => {\n const pageDimensions = collectPageDimensions(resolved, input.report.dimensionPins, \"web\");\n const context = withPageDimensions<WebContext>({\n locale,\n href: (target) => hrefForTarget(input.hrefPages, input.route, target),\n dimension: () => {\n throw new Error(\"a Report web face queried an undeclared dimension\");\n },\n }, pageDimensions);\n const html = runWithWebContext(Object.freeze(context), () => renderToStaticMarkup(createElement(ReactFragment, null, resolved as ReactNode)));\n return Object.freeze({ locale, html });\n });\n const downloads = collectDownloads(resolved).map((download) => Object.freeze({\n id: download.path,\n path: download.path,\n mediaType: download.mediaType,\n bytes: download.bytes,\n }));\n const rendererAssets = await materializeRendererAssets(collectRendererAssetDeclarations(resolved), async (path) => new Uint8Array(await readFile(path)));\n const assets: ResolvedPageAssetOutput[] = [\n ...rendererAssets.styles.map((asset) => Object.freeze({\n kind: \"style\" as const,\n path: asset.path,\n mediaType: \"text/css; charset=utf-8\",\n bytes: asset.content,\n sha256: asset.hash,\n })),\n ...rendererAssets.scripts.map((asset) => Object.freeze({\n kind: \"script\" as const,\n path: asset.path,\n mediaType: \"text/javascript; charset=utf-8\",\n bytes: asset.content,\n sha256: asset.hash,\n })),\n ];\n return Object.freeze({\n title: input.page.title,\n head: input.report.head as unknown as JsonValue,\n text: Object.freeze(text),\n web: Object.freeze(web),\n downloads: Object.freeze(downloads),\n assets: Object.freeze(assets),\n });\n }),\n catch: (cause): ReportPageExecutionFailed => pageFailure(input.page.id, classifyCloseFailure(cause), boundedReason(cause)),\n });\n}\nfunction invokeAuthor<Value>(pageId: string, phase: ReportPageExecutionFailed[\"phase\"], capture: AnalysisIssueCapture, callback: () => Value | PromiseLike<Value>): Effect.Effect<Value, ReportPageExecutionFailed> {\n return Effect.tryPromise({\n try: () => new Promise<Value>((resolve) => resolve(capture.run(callback))),\n catch: (cause) => pageFailure(pageId, phase, boundedReason(cause)),\n });\n}\nfunction addSitePage(pages: ClosedSitePage[], routeOwners: Map<string, string>, page: ResolvedPage, navigation: boolean): Effect.Effect<void, ReportSiteRouteConflict | ReportBuildBudgetExceeded> {\n const owner = routeOwners.get(page.target.route);\n if (owner !== undefined) {\n return Effect.fail(Object.freeze({\n code: \"report-site-route-conflict\" as const,\n route: page.target.route,\n pageIds: Object.freeze([owner, page.target.pageId]) as readonly [\n string,\n string\n ],\n }));\n }\n if (pages.length >= REPORT_PAGES_MAX) {\n return Effect.fail(reportBuildBudgetExceeded(\"pages\", REPORT_PAGES_MAX, pages.length + 1));\n }\n routeOwners.set(page.target.route, page.target.pageId);\n pages.push(Object.freeze({ page, navigation }));\n return Effect.void;\n}\nexport interface ReportBuildBudgetAnchor {\n readonly startedAtMs: number;\n readonly baselineRssBytes: number;\n}\n/** Starts the budget before Record selection opens the fixed Sample. */\nexport function startReportBuildBudget(): ReportBuildBudgetAnchor {\n return Object.freeze({\n startedAtMs: Date.now(),\n baselineRssBytes: process.memoryUsage().rss,\n });\n}\nfunction checkBuildBudgets(anchor: ReportBuildBudgetAnchor): Effect.Effect<void, ReportBuildBudgetExceeded> {\n const elapsed = Date.now() - anchor.startedAtMs;\n if (elapsed > REPORT_BUILD_TIME_MS_MAX) {\n return Effect.fail(reportBuildBudgetExceeded(\"build-time\", REPORT_BUILD_TIME_MS_MAX, elapsed));\n }\n const rssGrowth = Math.max(0, process.memoryUsage().rss - anchor.baselineRssBytes);\n if (rssGrowth > REPORT_BUILD_RSS_BYTES_MAX) {\n return Effect.fail(reportBuildBudgetExceeded(\"build-rss\", REPORT_BUILD_RSS_BYTES_MAX, rssGrowth));\n }\n return Effect.void;\n}\nfunction assertDocumentBudget(node: ReportNode, pageId: string, route: string): void {\n const observed = countDocument(node, 0);\n if (observed.nodes > REPORT_DOCUMENT_NODES_MAX) {\n throw reportBuildBudgetExceeded(\"document-nodes\", REPORT_DOCUMENT_NODES_MAX, observed.nodes, { pageId, route });\n }\n if (observed.depth > REPORT_DOCUMENT_DEPTH_MAX) {\n throw reportBuildBudgetExceeded(\"document-depth\", REPORT_DOCUMENT_DEPTH_MAX, observed.depth, { pageId, route });\n }\n}\nfunction countDocument(node: ReportNode, depth: number): {\n readonly nodes: number;\n readonly depth: number;\n} {\n if (node === null || node === undefined || typeof node === \"boolean\")\n return { nodes: 0, depth };\n if (Array.isArray(node)) {\n return node.reduce((total, child) => {\n const counted = countDocument(child, depth);\n return { nodes: total.nodes + counted.nodes, depth: Math.max(total.depth, counted.depth) };\n }, { nodes: 0, depth });\n }\n if (!isElement(node))\n return { nodes: 1, depth: depth + 1 };\n const currentDepth = depth + 1;\n if (node.type !== Fragment && typeof node.type === \"function\" &&\n (node.type as unknown as Record<symbol, unknown>)[COMPONENT_RAW_CHILDREN] === true) {\n return { nodes: 1, depth: currentDepth };\n }\n const child = countDocument(node.props.children as ReportNode, currentDepth);\n return { nodes: child.nodes + 1, depth: Math.max(currentDepth, child.depth) };\n}\nfunction isElement(value: unknown): value is ReportElement {\n if (typeof value !== \"object\" || value === null || Array.isArray(value))\n return false;\n const candidate = value as Partial<ReportElement>;\n return typeof candidate.$$typeof === \"symbol\" &&\n (candidate.$$typeof === Symbol.for(\"react.element\") || candidate.$$typeof === Symbol.for(\"react.transitional.element\")) &&\n typeof candidate.props === \"object\" && candidate.props !== null;\n}\nfunction routeForTarget(pages: readonly ReportPageDefinition[], target: ReportTarget): string | undefined {\n const page = pages.find((candidate) => candidate.id === target.page);\n if (page === undefined)\n return undefined;\n if (page.params === undefined)\n return target.params === undefined ? page.path : undefined;\n if (target.params === undefined)\n return undefined;\n try {\n const key = page.params.encode(target.params);\n return validateParameterKey(key) === undefined ? routeWithParameterKey(page.path, key) : undefined;\n }\n catch {\n return undefined;\n }\n}\nfunction hrefForTarget(pages: readonly ReportPageDefinition[], sourceRoute: string, target: ReportTarget): string | undefined {\n const source = staticPathForRoute(sourceRoute).posix;\n if (target.page === DOWNLOAD_TARGET_PAGE) {\n const path = isJsonRecord(target.params) ? target.params.path : undefined;\n if (typeof path !== \"string\" || validateDownloadPath(path) !== undefined)\n return undefined;\n return relativeHref(source, staticPathForDownload(path).posix);\n }\n const route = routeForTarget(pages, target);\n return route === undefined ? undefined : relativeHref(source, staticPathForRoute(route).posix);\n}\nfunction isJsonRecord(value: JsonValue | undefined): value is Readonly<Record<string, JsonValue>> {\n return typeof value === \"object\" && value !== null && !Array.isArray(value);\n}\nfunction relativeHref(sourceFile: string, targetFile: string): string {\n const sourceSegments = sourceFile.split(\"/\");\n sourceSegments.pop();\n const targetSegments = targetFile.split(\"/\");\n let common = 0;\n while (common < sourceSegments.length && common < targetSegments.length &&\n sourceSegments[common] === targetSegments[common])\n common += 1;\n const relative = [\n ...sourceSegments.slice(common).map(() => \"..\"),\n ...targetSegments.slice(common),\n ].join(\"/\");\n return relative || \"./\";\n}\nfunction commandForTarget(pages: readonly ReportPageDefinition[], target: ReportTarget): string | undefined {\n const route = routeForTarget(pages, target);\n return route === undefined ? undefined : `niceeval show --page ${shellQuote(route)}`;\n}\nfunction shellQuote(value: string): string {\n return `'${value.replaceAll(\"'\", `'\\\\''`)}'`;\n}\nfunction analysisProblems(issues: readonly AnalysisIssue[], pageId?: string): readonly ReportProblem[] {\n return Object.freeze(issues.map((issue) => Object.freeze({\n code: `analysis-${issue.code}`,\n path: Object.freeze(pageId === undefined ? [] : [\"page\", pageId]),\n refs: Object.freeze(issue.refs.map((reference) => String(reference.identity.locator)).sort(compareUtf8)),\n summary: issue.message,\n })));\n}\nexport function reportDefinitionIdentity(report: ReportDefinition): string {\n const closed = {\n title: resolveReportTitle(report),\n head: report.head,\n theme: report.theme ?? null,\n // The Analysis-computed pricing content identity joins the definition\n // identity, so a Profile change is a new Report execution.\n pricing: report.pricing === null ? null : report.pricing.contentIdentity,\n pages: report.pages.map((page) => ({\n id: page.id,\n path: page.path,\n title: page.title,\n navigation: page.navigation,\n parameterized: page.params !== undefined,\n load: page.load?.toString() ?? null,\n render: page.render.toString(),\n params: page.params === undefined\n ? null\n : {\n encode: page.params.encode.toString(),\n decode: page.params.decode.toString(),\n enumerate: page.params.enumerate.toString(),\n },\n })),\n };\n return createHash(\"sha256\").update(canonicalJson(closed)).digest(\"hex\");\n}\nfunction canonicalJson(value: unknown): string {\n if (value === null)\n return \"null\";\n if (typeof value === \"string\" || typeof value === \"boolean\")\n return JSON.stringify(value);\n if (typeof value === \"number\")\n return Number.isFinite(value) ? JSON.stringify(Object.is(value, -0) ? 0 : value) : \"null\";\n if (Array.isArray(value))\n return `[${value.map(canonicalJson).join(\",\")}]`;\n if (typeof value === \"object\") {\n return `{${Object.entries(value).filter(([, entry]) => entry !== undefined).sort(([left], [right]) => compareUtf8(left, right))\n .map(([key, entry]) => `${JSON.stringify(key)}:${canonicalJson(entry)}`).join(\",\")}}`;\n }\n return JSON.stringify(String(value));\n}\nfunction classifyCloseFailure(cause: unknown): ReportPageExecutionFailed[\"phase\"] {\n const message = boundedReason(cause).toLowerCase();\n if (message.includes(\"asset\") || message.includes(\"enoent\"))\n return \"assets\";\n if (message.includes(\"text\"))\n return \"text\";\n if (message.includes(\"web\") || message.includes(\"react\"))\n return \"web\";\n return \"resolve\";\n}\nfunction pageFailure(pageId: string, phase: ReportPageExecutionFailed[\"phase\"], reason: string): ReportPageExecutionFailed {\n return Object.freeze({ code: \"report-page-execution-failed\" as const, pageId, phase, reason });\n}\nfunction boundedReason(cause: unknown): string {\n const raw = cause instanceof Error ? cause.message : typeof cause === \"object\" && cause !== null &&\n typeof Reflect.get(cause, \"code\") === \"string\"\n ? String(Reflect.get(cause, \"code\"))\n : String(cause);\n return raw.replace(/[\\u0000-\\u001f\\u007f-\\u009f]/g, \" \").slice(0, 512).trim() || \"Report callback failed\";\n}\nfunction compareUtf8(left: string, right: string): number {\n return Buffer.compare(Buffer.from(left), Buffer.from(right));\n}\n/** Used by the site shell without re-running any author callback. */\nexport function closedPageTitle(page: ResolvedPage, locale: string): string {\n return resolveLocalizedText(page.title, locale);\n}\n"]}