@botiverse/porthole 0.5.1 → 0.6.0

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 (73) hide show
  1. package/README.md +25 -0
  2. package/dist/bridge/bridge.js +8 -5
  3. package/dist/bridge/navigation.d.ts +1 -6
  4. package/dist/bridge/navigation.js +11 -0
  5. package/dist/check/check.d.ts +12 -3
  6. package/dist/check/check.js +54 -8
  7. package/dist/check/files.d.ts +26 -0
  8. package/dist/check/files.js +307 -0
  9. package/dist/check/lint.js +27 -10
  10. package/dist/check/page-source.js +1 -1
  11. package/dist/check/tools.d.ts +23 -0
  12. package/dist/check/tools.js +25 -0
  13. package/dist/compile/policy.d.ts +15 -0
  14. package/dist/compile/policy.js +32 -0
  15. package/dist/config/schema.d.ts +8 -0
  16. package/dist/config/validate.js +8 -1
  17. package/dist/conformance/harness-source.js +1 -1
  18. package/dist/files/paths.d.ts +99 -0
  19. package/dist/files/paths.js +263 -0
  20. package/dist/files/types.d.ts +24 -0
  21. package/dist/files/types.js +83 -0
  22. package/dist/guide/guide.js +11 -1
  23. package/dist/host/create-host.js +21 -0
  24. package/dist/index.d.ts +6 -3
  25. package/dist/index.js +8 -3
  26. package/dist/protocol/adapter.d.ts +4 -0
  27. package/dist/protocol/mcp-apps.d.ts +6 -0
  28. package/dist/protocol/mcp-apps.js +6 -0
  29. package/dist/protocol/shell-adapter.js +5 -1
  30. package/dist/server/files.d.ts +44 -0
  31. package/dist/server/files.js +244 -0
  32. package/dist/server/host.d.ts +38 -1
  33. package/dist/server/host.js +37 -2
  34. package/dist/server/index.d.ts +4 -2
  35. package/dist/server/index.js +4 -1
  36. package/dist/server/keys.d.ts +8 -0
  37. package/dist/server/keys.js +34 -0
  38. package/dist/server/server.js +287 -22
  39. package/dist/server/types.d.ts +49 -5
  40. package/dist/shell/document.d.ts +19 -0
  41. package/dist/shell/document.js +30 -0
  42. package/dist/shell/runtime.d.ts +2 -1
  43. package/dist/shell/runtime.js +85 -4
  44. package/docs/ADOPTING.md +56 -4
  45. package/docs/ARCHITECTURE.md +13 -3
  46. package/docs/DECISIONS.md +304 -4
  47. package/docs/DESIGN.md +31 -3
  48. package/package.json +1 -1
  49. package/src/bridge/bridge.ts +8 -5
  50. package/src/bridge/navigation.ts +12 -0
  51. package/src/check/check.ts +92 -14
  52. package/src/check/files.ts +384 -0
  53. package/src/check/lint.ts +29 -10
  54. package/src/check/tools.ts +50 -0
  55. package/src/compile/policy.ts +38 -0
  56. package/src/config/schema.ts +8 -0
  57. package/src/config/validate.ts +8 -1
  58. package/src/files/paths.ts +323 -0
  59. package/src/files/types.ts +101 -0
  60. package/src/guide/guide.ts +20 -0
  61. package/src/host/create-host.ts +21 -0
  62. package/src/index.ts +32 -0
  63. package/src/protocol/adapter.ts +3 -1
  64. package/src/protocol/mcp-apps.ts +7 -0
  65. package/src/protocol/shell-adapter.ts +5 -0
  66. package/src/server/files.ts +312 -0
  67. package/src/server/host.ts +72 -3
  68. package/src/server/index.ts +19 -0
  69. package/src/server/keys.ts +53 -0
  70. package/src/server/server.ts +353 -24
  71. package/src/server/types.ts +56 -4
  72. package/src/shell/document.ts +53 -0
  73. package/src/shell/runtime.ts +85 -4
package/docs/DESIGN.md CHANGED
@@ -184,6 +184,7 @@ functions not built yet throw `NotBuiltYet` naming their milestone.
184
184
  | React: `PortholeProvider`, `PortholeFrame`, `ConfirmDialog`, `admitFrame` | `src/react/` | core (M4, built) | first host |
185
185
  | Conformance: `ConformanceHost`, `LaunchSpec`, `LaunchedDisplay`, `defineLeakSuite`, `PROBES`, the oracles; `defineServedSuite`, `ServedConformanceHost` | `src/conformance/` | core (M2, built); served modes (done) | any host |
186
186
  | Server: `createServer`, `PortholeServer`, `TicketStore`, `ArtifactStore`, `ContentDomain`, `Grant`, `Access`, `Upstream`, `proxyTo`, `memoryTicketStore` | `src/server/` | served modes (done) | host backends |
187
+ | Files (P081): `checkFileSet`, `filePathProblem`, `fileLimits`, `requestFilePath`, `lookupFile`, `fileTypeOf`, `servesFiles`; `StoredFiles`, `FileAddress`, `versionedAddress`; `lintFiles`, `admitFiles` | `src/files/`, `src/server/files.ts`, `src/check/files.ts` | 0.6 (done) | host backends, publish tools |
187
188
 
188
189
  ### Host API
189
190
 
@@ -241,6 +242,20 @@ and calls `PortholeServer.issue`.
241
242
  - **What a served frame loads** is a `ServedDocument`: the shell (content then
242
243
  arrives over the transport, as for opaque frames), a stored artifact version, the
243
244
  MCP Apps sandbox proxy, or an external app (url mode).
245
+ - **A version made of files** (P081–P084). The store answers a manifest (`files`: path →
246
+ `{ size, sha256, type? }`, an `entry`, `spa`) and `read(path)`; `{ html }` stays one page. Every
247
+ file is looked up in the manifest only, by the path below the version's base, decoded once
248
+ (`requestFilePath`, `lookupFile`: `dir/` is its `index.html`, `name` is `name.html`, the nearest
249
+ `404.html`, the entry for a single-page app's navigations). Its answer is typed by Porthole's
250
+ table (`fileTypeOf`; unknown: a download), `nosniff`, with its CSP (a page's and a script's: the
251
+ frame's plus the version's own path, P082; anything else `default-src 'none'; sandbox`), a
252
+ strong ETag and 304, ranges, `Cross-Origin-Resource-Policy: same-origin` (files), and the cache
253
+ rule of its address (files immutable, pages revalidated); a service worker's script is refused.
254
+ Every page is in the shell. Its address: in a frame, `/__porthole/f/<sealed access>/<path>` (the
255
+ ticket's answer is the entry, whose shell moves to that address first, P083); on a tab, the
256
+ version's own clean address, `entry.at`'s `base` (`/v/3/`), where an address that means the
257
+ latest (`/`, `/style.css`) is redeemed (P081). So a page never mixes versions: its relative
258
+ addresses are its version's. A set's pages open each other in the frame (P084).
244
259
  - **Tickets** are minted by `issue` (one-time, short-lived, bound to an instance and
245
260
  a viewer, stored as their hash), carried once in the frame's URL, and taken by the
246
261
  content origin. A served document (at `/__porthole/d/<instance key>`) comes back in
@@ -363,8 +378,9 @@ with redirect entry):
363
378
  - `instance`: the instance an issue request proposes, as the app means it;
364
379
  - `access`: may this viewer see it, and with what grant;
365
380
  - `authorize`: may this cookie still see it, on each request (P050);
366
- - `source`: a stored page by id and version;
367
- - `entry.at`: the instance a clean address's path names (redirect entry).
381
+ - `source`: a stored version by id and version: one page (`{ html }`), or a set of files (P081);
382
+ - `entry.at`: the instance a clean address's path names (redirect entry), or, for a set of files,
383
+ the instance with its version's own address (`{ instance, base, file }`, P081).
368
384
 
369
385
  **An adopter's whole wiring** (the package's `examples/app.mjs` is this, runnable on Node and
370
386
  Workers; docs/ADOPTING.md walks through it):
@@ -381,7 +397,7 @@ const content = createContentHost<Viewer>({
381
397
  access: async (instance, viewer) =>
382
398
  viewer !== null && (await canSee(viewer, instance)) ? { viewer: viewer.id, subject: viewer.id } : null,
383
399
  authorize: ({ subject }) => (revoked(subject) ? { allow: false, code: "revoked" } : { allow: true }),
384
- source: (id, version) => store.page(id, version), // { html } | null
400
+ source: (id, version) => store.page(id, version), // { html } | { files, read } | null
385
401
  entry: {
386
402
  authorizeUrl: `${env.APP_ORIGIN}/porthole/authorize`,
387
403
  at: (scope, path) => pageAt(scope, path), // "/" → latest, "/v/3" → version 3
@@ -577,6 +593,14 @@ What both adopters still wrote after 0.2 moves into Porthole (ADOPTING.md is the
577
593
  - **`admitContent(config, content, { refuseOn })`**: the show tool's gate. It refuses errors by
578
594
  default with a text that says what to change; otherwise it shows the content (a widget's
579
595
  document taken as its body) and returns the warnings as a note.
596
+ - **A page with files** (P081): `lintFiles(config, files)` lints each page as `lintContent` does
597
+ (findings name their `path`), holds the set to `checkFileSet`'s rules and the config's limits,
598
+ and looks each relative reference up in the set (markup, CSS, module imports, workers,
599
+ fetches): a page's reference that starts with `/` is an error (it names the address's root, not
600
+ the version: a Vite build without `base: "./"`), one that isn't in the set a warning.
601
+ `admitFiles` is the publish tool's gate, as `admitContent` is the show tool's. `checkPage({
602
+ config, files, driver })` serves the whole set and runs its entry (a served artifact config and
603
+ a driver that serves).
580
604
  - **`checkPage({ config, content, driver })`** (`/check`): the content in the real sandbox at each
581
605
  width and scheme (defaults: the manual's phone and desktop widths, light and dark unless
582
606
  unthemed). The check page (`src/check/page.ts`, bundled and shipped as `/check/page`, a module
@@ -841,6 +865,10 @@ for that to lapse and click with raw input.
841
865
  | Url-mode delegation (P049) | `allow` from `permissions`, `""` by default | `leak/served/permissions.spec.ts`: full screen follows it on all three; clipboard writes on Chromium only (WebKit and Firefox let any frame write in a click) | `url-permissions` → the default case (all three) |
842
866
  | Porthole's libraries (P079) | `egress.libraries` (domain isolation; on in `presets.liveWidget`): `script-src <content origin>/__porthole/lib/`; `/server` serves Chart.js 4.5.1 and D3 7.9.0, npm's bytes, on every content origin, without a ticket, immutable | `test/libraries.test.ts` (npm's bytes, pinned, licenses; headers; nothing else under the path); `leak/served/live.spec.ts` (both load and draw in a live widget whose every other load and fetch reaches no oracle) | — (rows 1–2) |
843
867
  | Library CDNs for artifacts (P048, P078) | `egress: LIBRARY_CDNS` in the host's artifact config; closed by default (P022); Tailwind's, jQuery's and Plotly's own CDNs for scripts only | `leak/cdn.spec.ts`: opaque and served, a CDN library loads only when opened; another origin never; a stylesheet, an image and a fetch never reach the libraries' own CDNs | — (the CSP of rows 1–2) |
868
+ | Files: serving (P081) | `StoredFiles`; the manifest only, decoded once; Porthole's type table, `nosniff`, a CSP on every answer, ETag/304, ranges, CORP `same-origin`, service workers refused; every page in the shell | `test/files.test.ts`; `leak/served/files.spec.ts`: many files by relative path (framed, on a tab), the Vite + React build, a newer version never reaches a running page, traversal 404s, `.html` as `.txt` is text, another origin reads nothing, no service worker | `service-worker` → "no service worker ever registers" (all three); `file-corp` → "another origin reads none of the files" (a page elsewhere runs the script, all three) |
869
+ | Files: the version's own path in the CSP (P082) | `fileSetCspDirectives`: `<origin><base>` (tab) or `<origin>/__porthole/f/` (frame) in the seven loading directives; never `'self'` | `leak/served/files.spec.ts`: a page loads no other version's files; a way out past the base is blocked | `file-self` → those two cases (another version's data and module load; `%2e%2e` past the base reaches the server; all three) |
870
+ | Files in a frame: access in the path (P083) | the ticket's answer is the entry; `/__porthole/f/<AES-GCM sealed session>/`; `history.replaceState` before anything loads; the host's check per file; an address opens on its own for an hour (then only the running page's own same-origin loads, till the session ends), renewed by the shell; reported as `./`, never whole | `test/files.test.ts` (sealed: no viewer or subject in it; another origin, a tampered or ended one: 401; revoked: 403; its hour, the page's own loads after it, renewal; redaction); `test/workers.test.ts` (workerd); every framed case of `leak/served/files.spec.ts` on WebKit (no cookie in frames), its reports never naming the address, its renewal under a moved clock | — |
871
+ | Files: pages navigate within the set (P084) | the guard lets a navigation to a page under `files.base` go, after `porthole/navigating`; the host takes the next load as that page | `leak/served/files.spec.ts`: a link opens another page in the frame, the display goes on; a non-page file, `/`, `/__porthole/d/…` never open | `navigate-guard` → both cases (all three) |
844
872
  | Workers (P044, P045) | no Node module in `/server`; D1 tickets taken by one `DELETE … RETURNING` | `test/workers.test.ts` (workerd, no `nodejs_compat`, real D1: once per ticket, a race, anonymous, a revocation, flat names, reserved namespaces) | — |
845
873
 
846
874
  ### The clipboard, and copy buttons
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@botiverse/porthole",
3
- "version": "0.5.1",
3
+ "version": "0.6.0",
4
4
  "description": "A host-side sandbox for agent-made HTML: isolation, egress hardening, a themed shell, gated host functions, and the agent manual, from one config.",
5
5
  "license": "Apache-2.0",
6
6
  "bin": {
@@ -9,7 +9,7 @@ import type { AnnotationReport } from "../annotate/types.ts";
9
9
  import { parseReport } from "../annotate/validate.ts";
10
10
  import type { PortholeConfig } from "../config/schema.ts";
11
11
  import { effectiveGates } from "../compile/policy.ts";
12
- import { blockedNavigationMessage } from "./navigation.ts";
12
+ import { blockedNavigationMessage, withoutSealedAddresses } from "./navigation.ts";
13
13
  import {
14
14
  defaultReason,
15
15
  isRefused,
@@ -158,15 +158,18 @@ const VALIDATORS: { readonly [N in CapabilityName]: Validator<N> } = {
158
158
  reportError: (args, config) => {
159
159
  // A navigation the shell cancelled (P080): Porthole words it, naming the address without its
160
160
  // query; the address itself goes to the host whole.
161
+ // A frame's sealed files' address never reaches the host from here (P083): `./` instead.
161
162
  const blocked = isRecord(args) ? args.navigationBlocked : undefined;
162
163
  if (blocked !== undefined) {
163
- return typeof blocked === "string" && blocked !== "" && blocked.length <= MAX_URL
164
- ? { message: blockedNavigationMessage(blocked, config), navigationBlocked: blocked }
165
- : null;
164
+ if (typeof blocked !== "string" || blocked === "" || blocked.length > MAX_URL) {
165
+ return null;
166
+ }
167
+ const url = withoutSealedAddresses(blocked);
168
+ return { message: blockedNavigationMessage(url, config), navigationBlocked: url };
166
169
  }
167
170
  const message = isRecord(args) ? args.message : undefined;
168
171
  return typeof message === "string" && message !== ""
169
- ? { message: message.slice(0, 2_000) }
172
+ ? { message: withoutSealedAddresses(message).slice(0, 2_000) }
170
173
  : null;
171
174
  },
172
175
  copyText: (args) => {
@@ -7,8 +7,20 @@ import type { PortholeConfig } from "../config/schema.ts";
7
7
  * its query or fragment, where a viewer's data would be.
8
8
  */
9
9
 
10
+ /**
11
+ * A frame's sealed files' address (P083) is its access: whatever content says, the host is told
12
+ * it as `./`, the page's own files (the shell says it so already; content may not).
13
+ */
14
+ const SEALED = /(?:https?:\/\/[^\s"'<>/]+)?\/__porthole\/f\/[A-Za-z0-9_-]{20,}\//gu;
15
+ export const withoutSealedAddresses = (text: string): string => text.replace(SEALED, "./");
16
+
10
17
  /** An address without what could carry data: an http(s) one's origin and path, else its scheme. */
11
18
  export function addressWithoutQuery(url: string): string {
19
+ // A page's own file (P084), as the shell names it: its path, without query or fragment.
20
+ if (url.startsWith("./")) {
21
+ const path = url.split(/[?#]/u)[0] ?? "./";
22
+ return path === url ? path : `${path}?…`;
23
+ }
12
24
  let parsed: URL;
13
25
  try {
14
26
  parsed = new URL(url);
@@ -3,7 +3,11 @@ import type { InstanceRef } from "../isolation/types.ts";
3
3
  import { presets } from "../presets/presets.ts";
4
4
  import { createServer } from "../server/server.ts";
5
5
  import { CHECK_CONTENT_DOMAIN, CHECK_ORIGIN } from "./drivers.ts";
6
- import { lintContent, type Finding } from "./lint.ts";
6
+ import { lintContent } from "./lint.ts";
7
+ import { lintFiles, whereOf, type FileContents, type FileFinding } from "./files.ts";
8
+ import { DEFAULT_ENTRY, servesFiles } from "../files/paths.ts";
9
+ import { sha256 } from "../server/crypto.ts";
10
+ import type { StoredFiles } from "../server/types.ts";
7
11
  // The check page's script, imported as a module so a bundler takes it in (P075): no file is
8
12
  // looked up beside this one at run time.
9
13
  import PAGE_SCRIPT from "./page-source.ts";
@@ -55,7 +59,15 @@ export interface CheckDriver {
55
59
  export interface CheckOptions {
56
60
  readonly config: PortholeConfig;
57
61
  /** The content as the agent would send it: a fragment, or a whole document. */
58
- readonly content: string;
62
+ readonly content?: string;
63
+ /**
64
+ * A page that comes with files (P081), in place of `content`: every file by its path. The whole
65
+ * set is served, as people's browsers get it, and its entry is run and measured. Needs a served
66
+ * artifact config and a driver that serves (`playwrightDriver`).
67
+ */
68
+ readonly files?: FileContents;
69
+ /** The page a set opens at (default `index.html`). */
70
+ readonly entry?: string;
59
71
  readonly driver: CheckDriver;
60
72
  /** Widths, px. Default: the manual's phone and desktop widths (`config.layout`). */
61
73
  readonly widths?: readonly number[];
@@ -106,7 +118,8 @@ export interface CheckReport {
106
118
  * refuses, overflow or cut, no lint error.
107
119
  */
108
120
  readonly ok: boolean;
109
- readonly lint: readonly Finding[];
121
+ /** What the lint found (for a page with files, each finding names its file, `path`). */
122
+ readonly lint: readonly FileFinding[];
110
123
  readonly runs: readonly CheckRun[];
111
124
  /** One short summary for the agent: each problem once, with where it happened. */
112
125
  readonly text: string;
@@ -130,9 +143,53 @@ function checkedAs(config: PortholeConfig): PortholeConfig {
130
143
 
131
144
  const escapeScript = (code: string) => code.replace(/<\/script/giu, "<\\/script");
132
145
 
146
+ /** A set's own files named by their path, as the agent wrote them, not the frame's address. */
147
+ const ownPaths = (text: string): string =>
148
+ text.replace(/https:\/\/[a-z0-9.-]+\/__porthole\/f\/[\w-]+\//gu, "");
149
+
150
+ const hex = (bytes: Uint8Array): string =>
151
+ Array.from(bytes, (byte) => byte.toString(16).padStart(2, "0")).join("");
152
+
153
+ /** A set's files as the check's server stores them, its entry instrumented (P081). */
154
+ function checkedFiles(files: FileContents, entry: string, page: string): StoredFiles {
155
+ const bytes = (body: string | Uint8Array): Uint8Array =>
156
+ typeof body === "string" ? new TextEncoder().encode(body) : body;
157
+ const served = new Map<string, Uint8Array>(
158
+ Object.entries(files).map(([path, body]) => [path, path === entry ? bytes(page) : bytes(body)]),
159
+ );
160
+ return {
161
+ files: Object.fromEntries(
162
+ [...served].map(([path, body]) => [
163
+ path,
164
+ { size: body.byteLength, sha256: hex(sha256(body)) },
165
+ ]),
166
+ ),
167
+ entry,
168
+ read: (path) => Promise.resolve(served.get(path) ?? null),
169
+ };
170
+ }
171
+
133
172
  export async function checkPage(options: CheckOptions): Promise<CheckReport> {
134
173
  const { config } = options;
135
- const lint = lintContent(config, options.content);
174
+ const entry = options.entry ?? DEFAULT_ENTRY;
175
+ const files = options.files;
176
+ if ((files === undefined) === (options.content === undefined)) {
177
+ throw new TypeError("checkPage takes content, or files: one of them");
178
+ }
179
+ if (files !== undefined && !servesFiles(config)) {
180
+ throw new TypeError("A page with files is checked under a served artifact config");
181
+ }
182
+ const entryText = (): string => {
183
+ const body = files?.[entry];
184
+ return body === undefined
185
+ ? ""
186
+ : typeof body === "string"
187
+ ? body
188
+ : new TextDecoder().decode(body);
189
+ };
190
+ const written = files === undefined ? (options.content ?? "") : entryText();
191
+ const lint: FileFinding[] =
192
+ files === undefined ? lintContent(config, written) : lintFiles(config, files, { entry });
136
193
  if (config.mode === "url") {
137
194
  return {
138
195
  ok: true,
@@ -149,9 +206,13 @@ export async function checkPage(options: CheckOptions): Promise<CheckReport> {
149
206
  const script = options.page ?? PAGE_SCRIPT;
150
207
  const html = `<!doctype html><html><head><meta charset="utf-8"><title>Porthole check</title><style>body{margin:0;padding:8px}section{margin-bottom:16px}</style></head><body><script>${escapeScript(script)}</script></body></html>`;
151
208
  // Its inline scripts named, so an error says the line in the content as written (P074).
152
- const { content, scriptLines } = namedScripts(options.content);
209
+ const { content, scriptLines } = namedScripts(written);
153
210
 
154
211
  const session = await options.driver.open();
212
+ if (files !== undefined && session.serve === undefined) {
213
+ await session.close();
214
+ throw new TypeError("A page with files is checked served: this driver can't serve (no serve)");
215
+ }
155
216
  // A served config runs served, on a content origin the driver answers, under Porthole's own
156
217
  // server: its CSP in headers, its shell, its storage and cookies (P074). Else opaque.
157
218
  const servedHere =
@@ -163,7 +224,14 @@ export async function checkPage(options: CheckOptions): Promise<CheckReport> {
163
224
  secret: crypto.getRandomValues(new Uint8Array(32)),
164
225
  hostOrigins: [CHECK_ORIGIN],
165
226
  configs: { check: servedConfig },
166
- artifacts: { get: () => Promise.resolve({ html: instrumented(content) }) },
227
+ artifacts: {
228
+ get: () =>
229
+ Promise.resolve(
230
+ files === undefined
231
+ ? { html: instrumented(content) }
232
+ : checkedFiles(files, entry, instrumented(content)),
233
+ ),
234
+ },
167
235
  })
168
236
  : null;
169
237
  const handler = async (request: Request): Promise<Response> => {
@@ -240,10 +308,19 @@ export async function checkPage(options: CheckOptions): Promise<CheckReport> {
240
308
  data?.scrollWidth !== undefined &&
241
309
  data.clientWidth !== null &&
242
310
  data.scrollWidth > data.clientWidth + 1,
243
- errors: unique(data?.errors ?? []),
244
- blocked: uniqueBy(data?.blocked ?? [], (each) => `${each.url} ${each.directive}`),
245
- failedLoads: uniqueBy(data?.failedLoads ?? [], (each) => each.url),
246
- console: uniqueBy(data?.console ?? [], (each) => `${each.level} ${each.text}`),
311
+ errors: unique((data?.errors ?? []).map(ownPaths)),
312
+ blocked: uniqueBy(
313
+ (data?.blocked ?? []).map((each) => ({ ...each, url: ownPaths(each.url) })),
314
+ (each) => `${each.url} ${each.directive}`,
315
+ ),
316
+ failedLoads: uniqueBy(
317
+ (data?.failedLoads ?? []).map((each) => ({ ...each, url: ownPaths(each.url) })),
318
+ (each) => each.url,
319
+ ),
320
+ console: uniqueBy(
321
+ (data?.console ?? []).map((each) => ({ ...each, text: ownPaths(each.text) })),
322
+ (each) => `${each.level} ${each.text}`,
323
+ ),
247
324
  calls: uniqueBy(data?.calls ?? [], (each) => `${each.capability} ${each.outcome}`),
248
325
  ...(screenshot === undefined ? {} : { screenshot }),
249
326
  });
@@ -297,7 +374,7 @@ const clip = (text: string, most = 200) =>
297
374
  */
298
375
  function summary(
299
376
  config: PortholeConfig,
300
- lint: readonly Finding[],
377
+ lint: readonly FileFinding[],
301
378
  runs: readonly CheckRun[],
302
379
  most: number,
303
380
  ): string {
@@ -348,9 +425,10 @@ function summary(
348
425
  }
349
426
  }
350
427
  const lines = [
351
- ...lint.map(
352
- (each) =>
353
- `${each.severity === "error" ? "Error" : "Warning"}${each.line === undefined ? "" : ` (line ${each.line})`}: ${each.message}`,
428
+ ...lint.map((each) =>
429
+ each.path === undefined
430
+ ? `${each.severity === "error" ? "Error" : "Warning"}${each.line === undefined ? "" : ` (line ${each.line})`}: ${each.message}`
431
+ : `${each.severity === "error" ? "Error" : "Warning"} (${whereOf(each).replace(/: $/u, "")}): ${each.message}`,
354
432
  ),
355
433
  ...[...where].map(
356
434
  ([problem, at]) =>