Beautiful, AI-native markdown IDE and LLM wiki
TypeScript 2nd-brainagent-skillsclaudecodexcompany-braindocsknowledge-knowledge-baseknowledge-managementllmllm-wikillm-wiki-karpathymarkdownmarkdown-editormdmdxnotespkmsecond-brainskills
Move Open Knowledge to the TypeScript 7 toolchain (#4146)
Nick Gomeza233e89c594c
diff --git a/.changeset/calendar-month-grid-classnames.md b/.changeset/calendar-month-grid-classnames.mdnew file mode 100644index 000000000..095dd3085--- /dev/null+++ b/.changeset/calendar-month-grid-classnames.md@@ -0,0 +1,7 @@+---+"@inkeep/open-knowledge": patch+---++The calendar's month grid now receives its intended layout classes. react-day-picker v9 renamed the `table` slot to `month_grid`, so the `w-full border-collapse` this component had been passing under the old key was silently dropped for the whole v9 line. The classes now reach the grid, and they are merged with the library's own defaults rather than replacing them, matching the other slots in the same object.++The class list on the grid gains exactly `w-full border-collapse`. `rdp-month_grid` is not added by this change: v9 merges `classNames` over `getDefaultClassNames()` per key, so a slot keeps its default for any key the object does not override, and `table` was never one of its keys. Both added utilities are no-ops in this layout, so nothing should move visually. Tailwind's preflight already sets `border-collapse: collapse` on every `table`, and the grid is a flex item of the `flex w-full flex-col` month slot, so it already stretched to full width. The class list on the element still changes, which is why this carries a note rather than passing silently.diff --git a/.changeset/cli-declarations-from-sibling-dist.md b/.changeset/cli-declarations-from-sibling-dist.mdnew file mode 100644index 000000000..3e1372f74--- /dev/null+++ b/.changeset/cli-declarations-from-sibling-dist.md@@ -0,0 +1,9 @@+---+"@inkeep/open-knowledge": patch+---++The published TypeScript declarations (`dist/index.d.mts`) are now bundled from the declarations that `@inkeep/open-knowledge-core` and `@inkeep/open-knowledge-server` emit for themselves, rather than re-emitted from those packages' sources inside the CLI's own build.++Nothing about the declared API changes: the file exports the same 107 symbols, keeps the same `any` and `unknown` counts, and stays self-contained with no imports from sibling `@inkeep/*` packages. The only consumer-visible difference is three additional import statements for Node built-ins (`node:fs`, `node:fs/promises`, `node:stream`) that no exported type references. The published tarball still excludes `dist/**/*.map`.++The published file is now type-checked as a standalone declaration file on every run of the repo's check lane, and the same check compares its exported-symbol set, its `any`/`unknown` counts and its freedom from `@inkeep/*` specifiers against the captured 5.9.3 baseline. A dropped export, a sibling type that degraded to `any`, or an unresolvable sibling import fails the build instead of shipping.diff --git a/.changeset/lint-and-write-warnings-plural-only.md b/.changeset/lint-and-write-warnings-plural-only.mdnew file mode 100644index 000000000..cf2a35b1a--- /dev/null+++ b/.changeset/lint-and-write-warnings-plural-only.md@@ -0,0 +1,15 @@+---+"@inkeep/open-knowledge": minor+---++The success responses of `/api/agent-write`, `/api/agent-write-md`, `/api/agent-patch`, `/api/frontmatter-patch`, `/api/rollback` and `/api/lint/fix` remove the deprecated singular `warning` field. Write and rollback advisories use the plural `warnings` array; every advisory the singular carried was already present in `warnings` on the same response, so a caller that reads the plural sees no change.++For `/api/lint/fix`, a durable fix whose post-write re-lint throws or loses a lint source that succeeded before the fix returns `diagnosticsArePreFix: true` and `reLintFailure: { reason, message }`, where `reason` is the closed discriminant `re-lint-threw` or `source-went-blind` and `message` is the prose explanation. The reported `diagnostics` and their `errorCount`/`warningCount` are the pre-fix set and may overstate what remains. `fixedCount` is 0 because the post-fix count could not be determined, not because nothing was fixed. Treat the fix as applied and re-run `lint` to confirm. Configuration and plugin warnings remain in `warnings`; the endpoint no longer emits a `Re-lint after fix failed: ` entry.++The MCP lint text renderer is the reader this change migrates. The editor's Problems panel calls the same endpoint for `Fix all`, discards the response body and re-audits the project when the sweep settles, so it never read the singular field and does not read the new flag.++The MCP `lint` renderer recognizes the boolean, the typed `reLintFailure`, and legacy prefixed entries in either `warnings` or singular `warning` as pre-fix signals. It emits `diagnosticsArePreFix: true` for any of these signals and puts a trimmed, non-empty explanation in `reLintFailure.message` with the discriminant in `reLintFailure.reason`, preferring the typed server failure over legacy entries; a legacy entry normalizes to `reason: 're-lint-threw'`. The flag can be present without `reLintFailure` when no non-empty message is available. Both the structured `warnings` array and the human warning block exclude legacy prefixed entries and retain ordinary warnings.++The reverse pairing is the one that degrades, and it is reachable because `ok mcp` attaches to whatever server is already running rather than pinning one. An `ok mcp` published before this release, pointed at a server from this release or later, reads only the removed singular field, so it loses the pre-fix header and reports the pre-fix diagnostics as remaining work. Upgrade both together.++Restart the server and MCP client after upgrading to load both updated components. `ok stop` declines while an editor window or agent is still connected, so close them first or run `ok stop --force`, then `ok start`. Run it from anywhere inside the project; `ok stop` anchors to the enclosing project root. From outside, name the target with `ok stop <path>`, or `ok stop all` to stop every running server. If the desktop app is hosting the server, quit and reopen it.diff --git a/.changeset/pre.json b/.changeset/pre.jsonindex 64ea90020..e574e5169 100644--- a/.changeset/pre.json+++ b/.changeset/pre.json@@ -9,6 +9,7 @@"@inkeep/open-knowledge-desktop": "0.68.24","@inkeep/md-conformance": "0.0.186","@inkeep/open-knowledge-native-config": "0.0.0",+ "@inkeep/open-knowledge-md-audit": "0.0.0","@inkeep/open-knowledge-plugin": "0.3.1","@inkeep/open-knowledge-server": "0.68.24"},diff --git a/CONTRIBUTING.md b/CONTRIBUTING.mdindex 97d0a5be4..4fc3919a9 100644--- a/CONTRIBUTING.md+++ b/CONTRIBUTING.md@@ -34,6 +34,10 @@ See `.env.example` for optional settings (OpenTelemetry, a custom dev port).The repo pins **Node.js 24+** and **pnpm 10+** (via `.node-version`, the `packageManager` field, and `engines`). Enable pnpm with `corepack enable pnpm`, or install it standalone (`npm install -g pnpm@10`). With a Node version manager, use `fnm install`, `mise install`, or `volta install node@24`. pnpm enforces the engine range (`engine-strict`), so on older Node `pnpm install` fails fast — pin Node 24+ first.+TypeScript is pinned twice on purpose. `@typescript/native` is this repo's alias for `typescript@~7.0.2`, the Go compiler the gates run; it owns the `tsc` binary, so `node_modules/.bin/tsc --version` at the root reports 7. The root's own `typescript` stays on `~6.0.3` only to supply tsserver to your editor, because TypeScript 7 ships none — that is an API resolution, not the compiler. The split means 7.0-only lib typings or an unchecked side-effect import can red a gate your editor calls clean. Open your editor at the repo root, not inside a package, or its language server falls back to a machine-global TypeScript. Any package that runs `tsc` in a script declares `"typescript": "~7.0.2"` of its own; `node scripts/check-typescript-resolution.mjs`, which `pnpm run check:drift:guards` runs, enforces the *resolved* 7.0 line rather than the declared range; the range is a tilde for that reason, because a caret installs clean today and reds once 7.1 ships. Its errors say why.++The base `tsconfig.json` carries three settings that red a first build. `erasableSyntaxOnly: true` makes constructor parameter properties (`constructor(private foo: string)`) an error; write the assignment out. `verbatimModuleSyntax: true` makes a plain `import { SomeType }` an error; write `import type`. `types: []` turns off automatic `@types/*` inclusion, so a package that uses Node globals lists `"types": ["node"]` in its own `tsconfig.json` and `@types/node` in its own `package.json`.+Patched dependencies (listed under `patchedDependencies` in `pnpm-workspace.yaml`, with the diffs in `patches/`) are authored with pnpm: run `pnpm patch <name>@<version>`, edit the printed temp directory, then `pnpm patch-commit <temp-dir>` to write the patch file and register it. A patch that fails to apply fails the install closed — it is never silently skipped.## Common commands@@ -45,6 +49,7 @@ pnpm run typecheck # TypeScriptpnpm run test # testspnpm run build # build all packagespnpm run check # lint + typecheck + test+pnpm run check:drift:guards # unused deps/exports, generated-artifact freshness, toolchain pins (not part of `check`)```Run a single package's scripts from its directory, e.g. `cd packages/app && pnpm run test`.@@ -64,8 +69,8 @@ First-time contributors are asked to sign our [Contributor License Agreement](./- Keep PRs focused and small enough to review.- Add tests — or a clear manual-verification note — for behavior changes.- Write no code comments outside the allowlist above — `pnpm run lint` fails on the rest.-- Add a changeset by running `pnpm run changeset` if your pull request changes user-facing or programmatic behavior.-- Run `pnpm run check` and confirm it passes.+- Add a changeset by running `pnpm run changeset` if your pull request changes user-facing or programmatic behavior. Open Knowledge is pre-1.0, so a breaking change rides as `minor` and a `major` changeset is rejected — reaching 1.0.0 is a team decision, not one a single changeset makes.+- Run `pnpm run check` and `pnpm run check:drift:guards` and confirm both pass.- Commit `pnpm-lock.yaml` when dependencies change, and run `pnpm run notices` to refresh `THIRD_PARTY_NOTICES.md` if third-party packages changed.- Never include secrets, credentials, customer data, or local machine paths.- Enable **Allow edits from maintainers** so reviewers can push fixes to your branch.diff --git a/biome.jsonc b/biome.jsoncindex 1b0994580..d2f5efacc 100644--- a/biome.jsonc+++ b/biome.jsonc@@ -1,5 +1,5 @@{- "$schema": "https://biomejs.dev/schemas/2.4.15/schema.json",+ "$schema": "https://biomejs.dev/schemas/2.5.11/schema.json","plugins": ["./biome-plugins/microcopy-ellipsis.grit","./biome-plugins/no-hand-rolled-spinner.grit",@@ -29,7 +29,7 @@"linter": {"enabled": true,"rules": {- "recommended": true,+ "preset": "recommended","suspicious": {"noReactForwardRef": "error"},@@ -443,6 +443,19 @@"biome-plugins/__fixtures__/no-inline-tolerance-class.fixture.tsx"],"plugins": ["./biome-plugins/no-inline-tolerance-class.grit"]+ },+ {+ // Biome 2.5 started parsing and linting standalone `.svg` files, which+ // brings the JSX/HTML a11y rule set to bear on static assets. An asset+ // file has no accessible name of its own: it gets one from whatever+ // references it (`<img alt>`, a `role="img"` + `aria-label` wrapper, or+ // `aria-hidden` when decorative), so requiring an inline `<title>` in the+ // file is a category error. The nine files in scope are a favicon, docs+ // page art, an app icon asset and two markdown-pipeline fixtures. The+ // rule stays on for inline SVG in `.tsx`, which is where it means+ // something.+ "includes": ["**/*.svg"],+ "linter": { "rules": { "a11y": { "noSvgWithoutTitle": "off" } } }}],"files": {diff --git a/docs/content/advanced/content-rules/overview.mdx b/docs/content/advanced/content-rules/overview.mdxindex 45e961f88..a8b69e18c 100644--- a/docs/content/advanced/content-rules/overview.mdx+++ b/docs/content/advanced/content-rules/overview.mdx@@ -192,16 +192,19 @@ Checks run: frontmatter.With no linter enabled the report closes with `No checks ran.` instead, the same string `ok lint` prints.-The structured content is close to `ok lint --json`, with three differences:+The structured content is close to `ok lint --json`, with four differences:| | `ok lint --json` | MCP `lint` || --- | --- | --- || Project path | `contentDir` | `cwd` || `fixedCount` counts | files rewritten | **problems** resolved || Cap fields | — | `omittedFileCount`, per-file `omittedDiagnosticCount`, `omittedWarningCount` |+| Fix-mode keys | — | `diagnosticsArePreFix`, `reLintFailure` (only when the post-write re-lint could not report) |Everything else matches: `files[].diagnostics` with 0-based `range`, `severity`, `source`, `code`, `message`, plus `errorCount`, `warningCount`, `fileCount` on an audit, configuration or degradation `warnings`, and `ran` for the selected source families. Audit output is capped project-wide at 10 warnings, plus 10 files × 10 diagnostics per file — the text channel marks the remainder with "… and N more", the structured channel with the three cap fields above. Counts always reflect the full scan, and re-running with a narrower `path` recovers the detail. With `fix: true` the summary reports what was applied and what remains: `Fixed 1 problem in docs/guide.md.` followed by the unfixable findings.+When the fix landed but the post-write re-lint could not report, the response carries `diagnosticsArePreFix: true` and explains itself in `reLintFailure`: `reason` is the machine-readable discriminant (`re-lint-threw` or `source-went-blind`) and `message` is the prose. The diagnostics and counts are then the PRE-fix set and `fixedCount` is 0, so re-run `lint` to see what remains rather than reading 0 as nothing fixed.+### The `audit` toolThe agent-side `ok audit` — content-rule problems and broken links in one read-only call, grouped by file, same 10 × 10 + 10-warning cap with `omittedWarningCount` when warnings are dropped, no fix shape. Its text and structured results both report `ran`. If a selected validator degrades, its family remains in `ran` and the `warnings` channel explains why; a partial degradation may still have contributed findings.diff --git a/docs/content/reference/mcp.mdx b/docs/content/reference/mcp.mdxindex f32792728..1163b790e 100644--- a/docs/content/reference/mcp.mdx+++ b/docs/content/reference/mcp.mdx@@ -19,7 +19,7 @@ To point an MCP client at this server, locally or over a tunnel from another mac| `exec` | Read-only shell (`cat`, `ls`, `grep`, `find`, `head`, `tail`, `wc`, `sort`, `uniq`, `cut`); reads return frontmatter, backlinks, recent history, and any unresolved [comments](/docs/features/comments) left on the doc. When the [frontmatter schemas](/docs/advanced/content-rules/frontmatter) plugin is on, doc and folder entries also carry `schemas: …` naming the JSON Schema files that govern them — the contract to read before writing. Fs-direct; works without the server. || `search` | Ranked workspace search (title boost + body BM25 + recency; same engine the cmd-K palette uses). `intent: "omnibar"` narrows to fast title/path matching (`full_text`, the default, includes the body); `scopes` filters hit kinds; `limit` caps rows (default 20, max 100). When [semantic search](/docs/reference/configuration#semantic-search) is enabled, an embeddings signal is additionally fused into `full_text` ranking (opt-in, content egress) — pass `semantic: false` to force pure-lexical. Right after boot, an empty result set with `ready: false` means the index is still building — retry after a couple of seconds rather than treating it as no matches. || `links` | Wiki-link graph. `kind` selects: `backlinks`, `forward`, `dead`, `orphans`, `hubs`, or `suggest`. Accepts an array (e.g. `["dead", "orphans", "hubs"]`) to fetch several views in one call; each view nests under its own key in the response. `dead` is the raw graph view: unlike `audit`, it still lists unresolved links whose source is a skill document |-| `lint` | Report content-rule problems (markdownlint style rules, frontmatter schema validation, document-level OKF checks) for one `document` or a whole-project audit (`path` scopes it); each finding carries `source`/`code`/`message`/`range`/`severity`, audit capped at 10 files × 10 diagnostics and project-wide at 10 warnings with accurate totals; configuration or runtime degradation problems ride a separate `warnings` channel, with `omittedWarningCount` when warnings are dropped. Successful responses include `ran`, the enabled document-lint source families selected for that call (`markdownlint`, `frontmatter`, and/or document-level `okf`). A family absent from `ran` was not checked, and `[]` means no checks were selected at all. Pass `fix: true` with `document` to auto-fix fixable rules in place — the fix lands through the collaborative document (attributed, live preview), not a shell edit; the rest need `edit`/`write`. Example output: [content rules overview](/docs/advanced/content-rules/overview#ai-agents) |+| `lint` | Report content-rule problems (markdownlint style rules, frontmatter schema validation, document-level OKF checks) for one `document` or a whole-project audit (`path` scopes it); each finding carries `source`/`code`/`message`/`range`/`severity`, audit capped at 10 files × 10 diagnostics and project-wide at 10 warnings with accurate totals; configuration or runtime degradation problems ride a separate `warnings` channel, with `omittedWarningCount` when warnings are dropped. Successful responses include `ran`, the enabled document-lint source families selected for that call (`markdownlint`, `frontmatter`, and/or document-level `okf`). A family absent from `ran` was not checked, and `[]` means no checks were selected at all. Pass `fix: true` with `document` to auto-fix fixable rules in place — the fix lands through the collaborative document (attributed, live preview), not a shell edit; the rest need `edit`/`write`. A fix that landed but could not be re-verified sets `diagnosticsArePreFix` (branch on it) and explains itself in `reLintFailure`, whose `reason` is a closed discriminant and whose `message` is the prose. Example output: [content rules overview](/docs/advanced/content-rules/overview#ai-agents) || `audit` | Unified read-only validation audit: every content problem — content-rule violations (markdownlint, frontmatter schemas, OKF) **and** broken internal links — in one call, grouped by the file to fix (`path` scopes to a folder or doc). Each finding is tagged with its validator; broken links report under the source doc that contains them, at the offending line, as warnings by default (the project's `validation.links` setting can raise them to errors or hide them). Skill documents are excluded from the broken-link half: a skill's links routinely name files it creates only at runtime (use `links({ kind: "dead" })` to see them; links from other documents to a skill still validate; documents that merely sit under a dot directory, such as `.github/CI_RUNBOOK.md`, keep their findings). Successful responses include `ran`: enabled document-lint families plus `links` unless link validation is off. Document and project-tree OKF checks share the `okf` family, and a family absent from `ran` was not checked. A selected family remains in `ran` if it degrades, with the reason explained in `warnings`; a partial degradation may still have contributed findings. Same 10 × 10 output cap as `lint`'s audit, plus a warning cap set project-wide at 10 warnings, with accurate totals and `omittedWarningCount` when warnings are dropped. No fix shape — lint fixes go through `lint`, link repairs through `edit`/`write` || `history` | Version timeline for a `document`, `folder`, or `skill`. Each entry carries a `version` (commit SHA) you pass to `restore_version`. Filter with `kind` (`checkpoint` / `wip` / `upstream`), `author` / `excludeAuthor`, and `branch`; paginate with `limit` / `offset` (default 50, max 200). `folder: ""` selects the project-root timeline || `skills` | Find skills. Pass `query` to search skills.sh and return import-ready rows (`name`, `source`, installs, publisher); omit `name` to list every managed skill across Project + Global (rows carry `installed` + `hosts`); pass `name` to read one (addressed by `name`+`scope`, never by path); pass `name` + `file` to read one bundle file's text — the read path for `references/` and `scripts/` content |diff --git a/docs/package.json b/docs/package.jsonindex 9e2ddcb5d..d2f578649 100644--- a/docs/package.json+++ b/docs/package.json@@ -66,6 +66,6 @@"sharp": "^0.35.3","tailwind-scrollbar": "^4.0.2","tailwindcss": "^4",- "typescript": "^5.7"+ "typescript": "~7.0.2"}}diff --git a/docs/src/app/llms.mdx/[...slug]/route.test.ts b/docs/src/app/llms.mdx/[...slug]/route.test.tsindex 2e2e7dc15..59fecd074 100644--- a/docs/src/app/llms.mdx/[...slug]/route.test.ts+++ b/docs/src/app/llms.mdx/[...slug]/route.test.ts@@ -72,27 +72,29 @@ describe('GET /docs/<slug>.md (markdown route handler)', () => {expect(missing).not.toBe(real);});- test.each(- NO_MARKDOWN_PREFIXES,- )('%s tells a real page apart from a URL no page holds', async (prefix) => {- const slug = [...prefix.replace('/docs/', '').split('/'), 'some-page'];- const [subtree, missing] = await Promise.all([- get(slug).then((r) => r.text()),- get(['nope']).then((r) => r.text()),- ]);-- expect(subtree).not.toBe(missing);- expect(subtree).not.toContain('No OpenKnowledge documentation page exists');- expect(subtree).toContain(`https://openknowledge.ai${prefix}`);- });-- test.each(- NO_MARKDOWN_PREFIXES,- )('%s still answers with a hard 404 carrying the contract', async (prefix) => {- const res = await get([...prefix.replace('/docs/', '').split('/'), 'some-page']);- expect(res.status).toBe(404);- expect(res.headers.get('content-type')).toBe('text/markdown; charset=utf-8');- });+ test.each(NO_MARKDOWN_PREFIXES)(+ '%s tells a real page apart from a URL no page holds',+ async (prefix) => {+ const slug = [...prefix.replace('/docs/', '').split('/'), 'some-page'];+ const [subtree, missing] = await Promise.all([+ get(slug).then((r) => r.text()),+ get(['nope']).then((r) => r.text()),+ ]);++ expect(subtree).not.toBe(missing);+ expect(subtree).not.toContain('No OpenKnowledge documentation page exists');+ expect(subtree).toContain(`https://openknowledge.ai${prefix}`);+ },+ );++ test.each(NO_MARKDOWN_PREFIXES)(+ '%s still answers with a hard 404 carrying the contract',+ async (prefix) => {+ const res = await get([...prefix.replace('/docs/', '').split('/'), 'some-page']);+ expect(res.status).toBe(404);+ expect(res.headers.get('content-type')).toBe('text/markdown; charset=utf-8');+ },+ );test('generateStaticParams delegates to the loader and yields slug-shaped params', () => {const params = generateStaticParams();diff --git a/docs/src/lib/marketing-blog-index.test.ts b/docs/src/lib/marketing-blog-index.test.tsindex 483f99728..42b162a5e 100644--- a/docs/src/lib/marketing-blog-index.test.ts+++ b/docs/src/lib/marketing-blog-index.test.ts@@ -449,14 +449,14 @@ describe('failure posture', () => {expect(await settle(blogPostLinks(3600))).toEqual([]);});- test.each([- 'preview',- 'development',- ])('still builds without the posts on a %s deployment', async (env) => {- vi.spyOn(console, 'warn').mockImplementation(() => {});- building({ VERCEL_ENV: env });- refuseConnection();-- expect(await settle(blogPostLinks(3600))).toEqual([]);- });+ test.each(['preview', 'development'])(+ 'still builds without the posts on a %s deployment',+ async (env) => {+ vi.spyOn(console, 'warn').mockImplementation(() => {});+ building({ VERCEL_ENV: env });+ refuseConnection();++ expect(await settle(blogPostLinks(3600))).toEqual([]);+ },+ );});diff --git a/docs/src/lib/marketing-blog-index.ts b/docs/src/lib/marketing-blog-index.tsindex 5402dd184..6e4c91ce8 100644--- a/docs/src/lib/marketing-blog-index.ts+++ b/docs/src/lib/marketing-blog-index.ts@@ -78,8 +78,10 @@ function quoteForMessage(value: string): string {class FeedStatusError extends Error {override readonly name = 'FeedStatusError';- constructor(readonly status: number) {+ readonly status: number;+ constructor(status: number) {super(`${BLOG_FEED_URL} responded ${status}`);+ this.status = status;}}diff --git a/docs/src/lib/mdx-attribute-literal.ts b/docs/src/lib/mdx-attribute-literal.tsindex 65f362047..0e8a69933 100644--- a/docs/src/lib/mdx-attribute-literal.ts+++ b/docs/src/lib/mdx-attribute-literal.ts@@ -9,8 +9,11 @@ export type AttributeLiteral =class LiteralParser {private index = 0;+ private readonly source: string;- constructor(private readonly source: string) {}+ constructor(source: string) {+ this.source = source;+ }parse(): AttributeLiteral {this.skipTrivia();diff --git a/docs/src/lib/mdx-serializer.test.ts b/docs/src/lib/mdx-serializer.test.tsindex 9a680d783..59b5ea8c6 100644--- a/docs/src/lib/mdx-serializer.test.ts+++ b/docs/src/lib/mdx-serializer.test.ts@@ -65,13 +65,12 @@ describe('component dispositions', () => {);});- test.each([- 'toString',- 'constructor',- 'valueOf',- ])('a name Object.prototype carries (%s) is refused, not resolved through the prototype', (name) => {- expect(() => body(`<${name} />`)).toThrow(/No serializer disposition/);- });+ test.each(['toString', 'constructor', 'valueOf'])(+ 'a name Object.prototype carries (%s) is refused, not resolved through the prototype',+ (name) => {+ expect(() => body(`<${name} />`)).toThrow(/No serializer disposition/);+ },+ );test('flatten keeps the children and discards the tag', () => {expect(body('<Wrapper>\n\nkept text\n\n</Wrapper>', { Wrapper: 'flatten' })).toBe('kept text');@@ -398,7 +397,8 @@ describe('a refusal names the page it came from', () => {}})();- expect((thrown?.cause as Error).message).toBe(+ expect(thrown).toBeInstanceOf(Error);+ expect(((thrown as Error).cause as Error).message).toBe("No serializer disposition for <Unknown>. Add \"Unknown\" to the registry as 'flatten', 'drop', or a custom serializer.",);});diff --git a/docs/src/lib/share-splash.test.ts b/docs/src/lib/share-splash.test.tsindex 105db98d9..16e3fb966 100644--- a/docs/src/lib/share-splash.test.ts+++ b/docs/src/lib/share-splash.test.ts@@ -31,19 +31,20 @@ function expectedContentFilename(entry: (typeof fixture.validShares)[number]): s}describe('buildSplashViewModel', () => {- test.each(- fixture.validShares.filter((entry) => entry.version === 2),- )('decodes canonical $id and hands the unchanged token to the desktop', (entry) => {- const view = buildSplashViewModel(entry.token);- expect(view).toMatchObject({- kind: 'ok',- sharedUrl: entry.sharedUrl,- githubUrl: entry.sharedUrl,- customSchemeUrl: `openknowledge://share?token=${entry.token}`,- target: entry.target.kind,- filename: expectedContentFilename(entry),- });- });+ test.each(fixture.validShares.filter((entry) => entry.version === 2))(+ 'decodes canonical $id and hands the unchanged token to the desktop',+ (entry) => {+ const view = buildSplashViewModel(entry.token);+ expect(view).toMatchObject({+ kind: 'ok',+ sharedUrl: entry.sharedUrl,+ githubUrl: entry.sharedUrl,+ customSchemeUrl: `openknowledge://share?token=${entry.token}`,+ target: entry.target.kind,+ filename: expectedContentFilename(entry),+ });+ },+ );test.each(fixture.invalidTokens)('rejects canonical fixture case $id', (entry) => {expect(buildSplashViewModel(entry.token)).toEqual({ kind: 'invalid' });diff --git a/docs/src/markdown-header-contract.test.ts b/docs/src/markdown-header-contract.test.tsindex 76b5018f2..8857fd903 100644--- a/docs/src/markdown-header-contract.test.ts+++ b/docs/src/markdown-header-contract.test.ts@@ -168,19 +168,19 @@ describe('a HEAD request to every Markdown route', () => {expect(files.length).toBe(new Set(files).size);});- test.each(HEAD_ROUTES)('$name is answered by its GET handler, which reads no method', async ({- module,- call,- }) => {- expect(module).not.toHaveProperty('HEAD');- const methods = autoImplementMethods(module as unknown as AppRouteHandlers);- expect(methods.HEAD).toBe(module.GET);-- const headers = (await call(methods.HEAD as never, 'HEAD')).headers;- for (const [header, value] of Object.entries(CONTRACT)) {- expect(headers.get(header), `${header} on HEAD`).toBe(value);- }- });+ test.each(HEAD_ROUTES)(+ '$name is answered by its GET handler, which reads no method',+ async ({ module, call }) => {+ expect(module).not.toHaveProperty('HEAD');+ const methods = autoImplementMethods(module as unknown as AppRouteHandlers);+ expect(methods.HEAD).toBe(module.GET);++ const headers = (await call(methods.HEAD as never, 'HEAD')).headers;+ for (const [header, value] of Object.entries(CONTRACT)) {+ expect(headers.get(header), `${header} on HEAD`).toBe(value);+ }+ },+ );});describe('the header layer next.config.ts adds on top', () => {diff --git a/docs/src/proxy.test.ts b/docs/src/proxy.test.tsindex 9f6283d81..89b952ec0 100644--- a/docs/src/proxy.test.ts+++ b/docs/src/proxy.test.ts@@ -123,13 +123,12 @@ describe('proxy: Accept negotiation', () => {expect(negotiate(path, MARKDOWN).rewrittenTo).toBeNull();});- test.each([- '/docs/overview.md',- '/docs/overview.html.md',- '/docs/overview.mdx',- ])('%s is left to the rewrite rules rather than negotiated again', (path) => {- expect(negotiate(path, MARKDOWN).rewrittenTo).toBeNull();- });+ test.each(['/docs/overview.md', '/docs/overview.html.md', '/docs/overview.mdx'])(+ '%s is left to the rewrite rules rather than negotiated again',+ (path) => {+ expect(negotiate(path, MARKDOWN).rewrittenTo).toBeNull();+ },+ );test('host canonicalization wins over negotiation', () => {const res = proxy(diff --git a/docs/tsconfig.json b/docs/tsconfig.jsonindex b4b6ecbc4..eb25728bc 100644--- a/docs/tsconfig.json+++ b/docs/tsconfig.json@@ -4,9 +4,10 @@"target": "ESNext","module": "esnext","lib": ["dom", "dom.iterable", "esnext"],- // @inkeep/open-knowledge-core resolves to its TS source (exports `types` →- // ./src/index.ts), whose internal imports carry explicit .ts extensions —- // same flag core/app set to consume it.+ // @inkeep/open-knowledge-core resolves to its TS source: the base tsconfig+ // sets `customConditions: ["@inkeep/source"]`, and core's exports list that+ // condition first pointing at ./src/index.ts, whose internal imports carry+ // explicit .ts extensions — same flag core/app set to consume it."allowImportingTsExtensions": true,"allowJs": true,"noEmit": true,diff --git a/knip.config.ts b/knip.config.tsindex a0ba1bf42..4ab03e27d 100644--- a/knip.config.ts+++ b/knip.config.ts@@ -14,6 +14,7 @@ export default {'@lingui/babel-plugin-lingui-macro','@lingui/format-po','micromark',+ '@typescript/native',],ignoreBinaries: ['printf',@@ -137,7 +138,14 @@ export default {],},'packages/desktop': {- entry: ['src/**/*.test.ts', 'scripts/*.mjs', 'tests/**/*.test.ts', 'tests/**/*.test.mjs'],+ entry: [+ 'src/utility/server-entry.ts',+ 'src/utility/pty-host.ts',+ 'src/**/*.test.ts',+ 'scripts/*.mjs',+ 'tests/**/*.test.ts',+ 'tests/**/*.test.mjs',+ ],ignoreDependencies: ['@inkeep/open-knowledge-native-config', 'culori'],project: 'src/**',},diff --git a/oxlint.config.ts b/oxlint.config.tsindex 389e9353c..c9b6c2a6a 100644--- a/oxlint.config.ts+++ b/oxlint.config.ts@@ -36,7 +36,7 @@ export default defineConfig({options: {typeAware: true,},- jsPlugins: ['oxlint-plugin-eslint', NO_COMMENTS_PLUGIN],+ jsPlugins: [{ name: 'eslint-js', specifier: 'oxlint-plugin-eslint' }, NO_COMMENTS_PLUGIN],rules: {[NO_COMMENTS_RULE]: NO_COMMENTS_SEVERITY,'eslint/logical-assignment-operators': [@@ -58,6 +58,14 @@ export default defineConfig({],},],+ 'eslint/no-unused-vars': [+ 'warn',+ {+ argsIgnorePattern: '^_',+ varsIgnorePattern: '^_',+ caughtErrorsIgnorePattern: '^_',+ },+ ],'typescript/no-floating-promises': 'off','eslint/no-unsafe-optional-chaining': 'off','typescript/await-thenable': 'off',diff --git a/package.json b/package.jsonindex 9fc734217..0ad029225 100644--- a/package.json+++ b/package.json@@ -18,7 +18,7 @@"check:fast": "pnpm run typecheck","check:doc-links": "pnpm --dir docs run validate-link","check:drift": "pnpm run check:drift:guards && vitest run --config vitest.scripts.config.ts",- "check:drift:guards": "bash scripts/check-husky-prepare-guard.sh && bash scripts/check-knip-clean.sh && bash scripts/check-notices-clean.sh && bash scripts/check-schema-snapshot-clean.sh && bash scripts/check-i18n-drift.sh && node scripts/check-i18n-new-string-translations.mjs && node scripts/check-i18n-picker-completeness.mjs && bash scripts/check-no-major-changeset.sh && node scripts/check-override-floors.mjs",+ "check:drift:guards": "bash scripts/check-husky-prepare-guard.sh && bash scripts/check-knip-clean.sh && bash scripts/check-notices-clean.sh && bash scripts/check-schema-snapshot-clean.sh && bash scripts/check-i18n-drift.sh && node scripts/check-i18n-new-string-translations.mjs && node scripts/check-i18n-picker-completeness.mjs && bash scripts/check-no-major-changeset.sh && node scripts/check-override-floors.mjs && node scripts/check-typescript-resolution.mjs","typecheck": "turbo run typecheck","test": "turbo run test","test:vitest-selftest": "vitest run",@@ -28,7 +28,7 @@"lint:oxlint": "oxlint --max-warnings 0 .","format": "pnpm run lint:biome --write --unsafe","check": "pnpm run lint && pnpm exec turbo run build typecheck test",- "check:full:parallel": "pnpm run check:drift:guards && pnpm run lint && pnpm run check:doc-links && vitest run --config vitest.scripts.config.ts && turbo run build typecheck test test:dom test:integration test:conversion test:perf:regression:unit test:health:unit test:health test:e2e test:visual test:perf test:a11y --concurrency=100% --output-logs=errors-only",+ "check:full:parallel": "pnpm run check:drift:guards && pnpm run lint && pnpm run check:doc-links && vitest run --config vitest.scripts.config.ts && turbo run build typecheck check:dts test test:dom test:integration test:conversion test:perf:regression:unit test:health:unit test:health test:e2e test:visual test:perf test:a11y --concurrency=100% --output-logs=errors-only","tier1": "pnpm run check","tier2": "pnpm run tier1 && turbo run test:perf:regression:unit test:health:unit test:health test:e2e","tier3": "STRESS_FIDELITY=1 pnpm run tier2",@@ -63,19 +63,20 @@]},"devDependencies": {- "@biomejs/biome": "2.4.15",+ "@biomejs/biome": "2.5.11","@changesets/cli": "^2.29.7",- "bun-types": "^1.3.13",+ "@typescript/native": "npm:typescript@~7.0.2","husky": "^9.1.7","knip": "^6.26.0","lint-staged": "^16.4.0",- "oxlint": "1.66.0",- "oxlint-plugin-eslint": "^1.66.0",- "oxlint-tsgolint": "^0.23.0",+ "oxlint": "1.80.0",+ "oxlint-plugin-eslint": "^1.80.0",+ "oxlint-tsgolint": "^7.0.2001","smol-toml": "^1.6.1","ts-morph": "^28.0.0","tsx": "^4.20.0","turbo": "^2.7.0",+ "typescript": "~6.0.3","vitest": "^4.1.0"},"puppeteer": {diff --git a/packages/app/package.json b/packages/app/package.jsonindex e9a71f53b..8bfb95e3b 100644--- a/packages/app/package.json+++ b/packages/app/package.json@@ -214,7 +214,7 @@"sirv": "^3.0.2","size-limit": "^12.1.0","ts-morph": "^28.0.0",- "typescript": "^5.9.3",+ "typescript": "~7.0.2","unified": "^11.0.5","vite": "^8.0.0","web-vitals": "^5.0.0",diff --git a/packages/app/src/components/AddPropertyNameField.dom.test.tsx b/packages/app/src/components/AddPropertyNameField.dom.test.tsxindex 649d1c7ab..81bcdc8a5 100644--- a/packages/app/src/components/AddPropertyNameField.dom.test.tsx+++ b/packages/app/src/components/AddPropertyNameField.dom.test.tsx@@ -120,7 +120,9 @@ describe('AddPropertyNameField — schema field picker', () => {await userEvent.keyboard('{ArrowDown}{Enter}');expect(onPick).toHaveBeenCalledTimes(1);- expect((onPick.mock.calls[0]?.[0] as AddPropertyFieldSuggestion).name).toBe('status');+ expect((onPick.mock.calls[0]?.[0] as AddPropertyFieldSuggestion | undefined)?.name).toBe(+ 'status',+ );expect(onCommit).not.toHaveBeenCalled();});@@ -132,7 +134,9 @@ describe('AddPropertyNameField — schema field picker', () => {await userEvent.keyboard('{ArrowDown}{ArrowDown}{Enter}');- expect((onPick.mock.calls[0]?.[0] as AddPropertyFieldSuggestion).name).toBe('tags');+ expect((onPick.mock.calls[0]?.[0] as AddPropertyFieldSuggestion | undefined)?.name).toBe(+ 'tags',+ );});test('ArrowUp enters the list at the last option', async () => {@@ -143,7 +147,9 @@ describe('AddPropertyNameField — schema field picker', () => {await userEvent.keyboard('{ArrowUp}{Enter}');- expect((onPick.mock.calls[0]?.[0] as AddPropertyFieldSuggestion).name).toBe('reviewedAt');+ expect((onPick.mock.calls[0]?.[0] as AddPropertyFieldSuggestion | undefined)?.name).toBe(+ 'reviewedAt',+ );});test('typing after arrowing into the list drops back out of it', async () => {@@ -307,7 +313,9 @@ describe('AddPropertyNameField — schema field picker', () => {await userEvent.hover(tags);await userEvent.keyboard('{Enter}');- expect((onPick.mock.calls[0]?.[0] as AddPropertyFieldSuggestion).name).toBe('tags');+ expect((onPick.mock.calls[0]?.[0] as AddPropertyFieldSuggestion | undefined)?.name).toBe(+ 'tags',+ );});test('a required field is marked in the list', async () => {diff --git a/packages/app/src/components/AddPropertyRow.add-property-focus.dom.test.tsx b/packages/app/src/components/AddPropertyRow.add-property-focus.dom.test.tsxindex 127bf150c..e08174216 100644--- a/packages/app/src/components/AddPropertyRow.add-property-focus.dom.test.tsx+++ b/packages/app/src/components/AddPropertyRow.add-property-focus.dom.test.tsx@@ -83,19 +83,20 @@ describe('AddPropertyRow — typing target stays focused after type change (Propexpect(document.activeElement?.getAttribute('data-testid')).toBe('add-property-name-input');});- test.each(- ALL_TYPE_PICKS,- )('after picking %s, the next keystrokes reach the name input', async (_type, label) => {- const user = userEvent.setup();- render(<PropertyPanelHarness />);- await user.click(screen.getByTestId('type-icon-button'));- await user.click(await screen.findByText(label));+ test.each(ALL_TYPE_PICKS)(+ 'after picking %s, the next keystrokes reach the name input',+ async (_type, label) => {+ const user = userEvent.setup();+ render(<PropertyPanelHarness />);+ await user.click(screen.getByTestId('type-icon-button'));+ await user.click(await screen.findByText(label));- await user.keyboard('prop_name');+ await user.keyboard('prop_name');- const nameInput = screen.getByTestId('add-property-name-input') as HTMLInputElement;- expect(nameInput.value).toBe('prop_name');- });+ const nameInput = screen.getByTestId('add-property-name-input') as HTMLInputElement;+ expect(nameInput.value).toBe('prop_name');+ },+ );test('focus stays on name input — and partial typing is preserved — when type is changed after partial name entry', async () => {const user = userEvent.setup();@@ -115,19 +116,20 @@ describe('AddPropertyRow — typing target stays focused after type change (Foldcleanup();});- test.each(- ALL_TYPE_PICKS,- )('after picking %s, the next keystrokes reach the name input', async (_type, label) => {- const user = userEvent.setup();- render(<FolderDefaultsHarness />);- await user.click(screen.getByTestId('type-icon-button'));- await user.click(await screen.findByText(label));+ test.each(ALL_TYPE_PICKS)(+ 'after picking %s, the next keystrokes reach the name input',+ async (_type, label) => {+ const user = userEvent.setup();+ render(<FolderDefaultsHarness />);+ await user.click(screen.getByTestId('type-icon-button'));+ await user.click(await screen.findByText(label));- await user.keyboard('prop_name');+ await user.keyboard('prop_name');- const nameInput = screen.getByTestId('add-property-name-input') as HTMLInputElement;- expect(nameInput.value).toBe('prop_name');- });+ const nameInput = screen.getByTestId('add-property-name-input') as HTMLInputElement;+ expect(nameInput.value).toBe('prop_name');+ },+ );});describe('AddPropertyRow — value-channel ADD gates on non-empty name AND value', () => {diff --git a/packages/app/src/components/AppMenubar.dom.test.tsx b/packages/app/src/components/AppMenubar.dom.test.tsxindex cf2c696c1..19d385ac8 100644--- a/packages/app/src/components/AppMenubar.dom.test.tsx+++ b/packages/app/src/components/AppMenubar.dom.test.tsx@@ -60,15 +60,15 @@ describe('AppMenubar Help menu', () => {expect(container.firstChild).toBeNull();});- test.each([- 'win32',- 'linux',- ] as const)('returns null in a %s note window, where app-wide menu chrome is intentionally absent', async (platform) => {- installBridge(platform, 'note');- const { AppMenubar } = await import('./AppMenubar');- const { container } = render(<AppMenubar />);- expect(container.firstChild).toBeNull();- });+ test.each(['win32', 'linux'] as const)(+ 'returns null in a %s note window, where app-wide menu chrome is intentionally absent',+ async (platform) => {+ installBridge(platform, 'note');+ const { AppMenubar } = await import('./AppMenubar');+ const { container } = render(<AppMenubar />);+ expect(container.firstChild).toBeNull();+ },+ );test('Send feedback dispatches the send-feedback menu action', async () => {const dispatch = installBridge('win32');diff --git a/packages/app/src/components/EditorPane.dom.test.tsx b/packages/app/src/components/EditorPane.dom.test.tsxindex dd9b42a70..61808867a 100644--- a/packages/app/src/components/EditorPane.dom.test.tsx+++ b/packages/app/src/components/EditorPane.dom.test.tsx@@ -380,17 +380,20 @@ describe('EditorPane auto-sync onboarding gate', () => {{ autoSync: { enabled: null } },{ autoSync: { default: true } },],- ] as const)('stays closed when %s', async (_label, nextHasRemote, nextProjectSynced, nextSynced, nextProjectLocalConfig, nextProjectConfig) => {- hasRemote = nextHasRemote;- projectSynced = nextProjectSynced;- projectLocalSynced = nextSynced;- projectLocalConfig = nextProjectLocalConfig;- projectConfig = nextProjectConfig;-- await renderEditorPane();-- expect(screen.getByTestId('auto-sync-onboarding').getAttribute('data-open')).toBe('false');- });+ ] as const)(+ 'stays closed when %s',+ async (_label, nextHasRemote, nextProjectSynced, nextSynced, nextProjectLocalConfig, nextProjectConfig) => {+ hasRemote = nextHasRemote;+ projectSynced = nextProjectSynced;+ projectLocalSynced = nextSynced;+ projectLocalConfig = nextProjectLocalConfig;+ projectConfig = nextProjectConfig;++ await renderEditorPane();++ expect(screen.getByTestId('auto-sync-onboarding').getAttribute('data-open')).toBe('false');+ },+ );test('a denied push probe opens the pull-only variant', async () => {hasRemote = true;diff --git a/packages/app/src/components/EditorTabs.dom.test.tsx b/packages/app/src/components/EditorTabs.dom.test.tsxindex e3642c5d9..60c70db88 100644--- a/packages/app/src/components/EditorTabs.dom.test.tsx+++ b/packages/app/src/components/EditorTabs.dom.test.tsx@@ -505,31 +505,31 @@ describe('EditorTabs runtime behavior', () => {expect(txtTab.getAttribute('title')).toBeNull();});- test.each([- 'glossary.csv',- 'settings.json',- ])('%s without page metadata keeps its filename across tab and file-menu actions', async (docName) => {- activeDocName = docName;- activeTabId = docName;- openTabs = [docName];- visibleTabIds = [docName];- newTabIds = [];- pageMeta = new Map();- renderRealTabTargetMenuItems = true;+ test.each(['glossary.csv', 'settings.json'])(+ '%s without page metadata keeps its filename across tab and file-menu actions',+ async (docName) => {+ activeDocName = docName;+ activeTabId = docName;+ openTabs = [docName];+ visibleTabIds = [docName];+ newTabIds = [];+ pageMeta = new Map();+ renderRealTabTargetMenuItems = true;- await renderEditorTabs();+ await renderEditorTabs();- expect(tabButton(docName).textContent).toBe(docName);+ expect(tabButton(docName).textContent).toBe(docName);- fireEvent.click(screen.getByRole('menuitem', { name: 'Rename' }));- expect(screen.getByTestId('file-target-rename-dialog').textContent).toBe(docName);+ fireEvent.click(screen.getByRole('menuitem', { name: 'Rename' }));+ expect(screen.getByTestId('file-target-rename-dialog').textContent).toBe(docName);- fireEvent.click(screen.getByRole('menuitem', { name: 'Relative path' }));- expect.soft(scheduleClipboardWrite).toHaveBeenCalledWith(docName);+ fireEvent.click(screen.getByRole('menuitem', { name: 'Relative path' }));+ expect.soft(scheduleClipboardWrite).toHaveBeenCalledWith(docName);- fireEvent.click(screen.getByRole('menuitem', { name: 'Hide this file' }));- expect.soft(okignorePatch).toHaveBeenCalledWith(`/${docName}\n`);- });+ fireEvent.click(screen.getByRole('menuitem', { name: 'Hide this file' }));+ expect.soft(okignorePatch).toHaveBeenCalledWith(`/${docName}\n`);+ },+ );test('explicit Markdown metadata stays authoritative for an extension-shaped docName', async () => {const docName = 'notes.ts';diff --git a/packages/app/src/components/EditorToolbar.dom.test.tsx b/packages/app/src/components/EditorToolbar.dom.test.tsxindex 80a2605ee..6edcce4cf 100644--- a/packages/app/src/components/EditorToolbar.dom.test.tsx+++ b/packages/app/src/components/EditorToolbar.dom.test.tsx@@ -140,15 +140,15 @@ describe('EditorToolbar runtime layout', () => {expect(screen.getByRole('radio', { name: 'Markdown source' })).toBeTruthy();});- test.each([- 'glossary.csv',- 'settings.json',- ])('%s omits the Markdown-only Add properties affordance', async (docName) => {- expect(isEditableTextDocFile(docName)).toBe(true);- await renderToolbar(docName);-- expect(screen.queryByRole('button', { name: /add properties/i })).toBeNull();- });+ test.each(['glossary.csv', 'settings.json'])(+ '%s omits the Markdown-only Add properties affordance',+ async (docName) => {+ expect(isEditableTextDocFile(docName)).toBe(true);+ await renderToolbar(docName);++ expect(screen.queryByRole('button', { name: /add properties/i })).toBeNull();+ },+ );test('keeps Add properties available while the document name is loading', async () => {await renderToolbar(null);diff --git a/packages/app/src/components/FileTree.preview-tabs.dom.test.tsx b/packages/app/src/components/FileTree.preview-tabs.dom.test.tsxindex 92fcad6f8..6194a5098 100644--- a/packages/app/src/components/FileTree.preview-tabs.dom.test.tsx+++ b/packages/app/src/components/FileTree.preview-tabs.dom.test.tsx@@ -327,37 +327,40 @@ describe('FileTree preview-tab activation', () => {test.each([['enabled', true, 'preview'],['disabled', false, 'permanent'],- ] as const)('opens document and folder rows as %s tabs without dropping hash or selection notifications', async (_state, enabled, disposition) => {- previewTabsEnabled = enabled;- render(<FileTree />);-- await screen.findByTestId('fake-pierre-tree');- await waitFor(() => expect(model.getItem('docs/')).not.toBeNull());-- fireEvent.click(screen.getByRole('treeitem', { name: 'note.md' }));-- await waitFor(() =>- expect(openTargetMock).toHaveBeenNthCalledWith(- 1,- { kind: 'doc', target: 'note', docName: 'note' },- { disposition, consumeActiveNewTab: true },- ),- );- expect(window.location.hash).toBe('#/note');- expect(notifySidebarFileSelectedMock).toHaveBeenCalledTimes(1);-- fireEvent.click(screen.getByRole('treeitem', { name: 'docs/' }));-- await waitFor(() =>- expect(openTargetMock).toHaveBeenNthCalledWith(- 2,- { kind: 'folder', target: 'docs', folderPath: 'docs' },- { disposition, consumeActiveNewTab: true },- ),- );- expect(window.location.hash).toBe('#/docs/');- expect(notifySidebarFileSelectedMock).toHaveBeenCalledTimes(2);- });+ ] as const)(+ 'opens document and folder rows as %s tabs without dropping hash or selection notifications',+ async (_state, enabled, disposition) => {+ previewTabsEnabled = enabled;+ render(<FileTree />);++ await screen.findByTestId('fake-pierre-tree');+ await waitFor(() => expect(model.getItem('docs/')).not.toBeNull());++ fireEvent.click(screen.getByRole('treeitem', { name: 'note.md' }));++ await waitFor(() =>+ expect(openTargetMock).toHaveBeenNthCalledWith(+ 1,+ { kind: 'doc', target: 'note', docName: 'note' },+ { disposition, consumeActiveNewTab: true },+ ),+ );+ expect(window.location.hash).toBe('#/note');+ expect(notifySidebarFileSelectedMock).toHaveBeenCalledTimes(1);++ fireEvent.click(screen.getByRole('treeitem', { name: 'docs/' }));++ await waitFor(() =>+ expect(openTargetMock).toHaveBeenNthCalledWith(+ 2,+ { kind: 'folder', target: 'docs', folderPath: 'docs' },+ { disposition, consumeActiveNewTab: true },+ ),+ );+ expect(window.location.hash).toBe('#/docs/');+ expect(notifySidebarFileSelectedMock).toHaveBeenCalledTimes(2);+ },+ );test('leaves a click on a pinned folder header to the tree, so it collapses instead of reopening', async () => {render(<FileTree />);diff --git a/packages/app/src/components/ReportBugDialog.dom.test.tsx b/packages/app/src/components/ReportBugDialog.dom.test.tsxindex ea1af2a5f..1788c9a1d 100644--- a/packages/app/src/components/ReportBugDialog.dom.test.tsx+++ b/packages/app/src/components/ReportBugDialog.dom.test.tsx@@ -430,23 +430,26 @@ describe('ReportBugDialog', () => {fallback: { mailtoUrl: 'mailto:[email protected]?subject=OpenKnowledge%20bug' },},],- ])('%s resolves outside the dialog — no terminal phase, no reopen, no draft', async (_, result) => {- const log = installBridge({ send: () => Promise.resolve(result) });- const { openChangeCalls } = await renderDialog({}, { statefulOpen: true });- await createReport('still my note');-- await userEvent.click(screen.getByRole('button', { name: 'Send report' }));- await vi.waitFor(() => {- expect(log.sendCalls).toHaveLength(1);- });+ ])(+ '%s resolves outside the dialog — no terminal phase, no reopen, no draft',+ async (_, result) => {+ const log = installBridge({ send: () => Promise.resolve(result) });+ const { openChangeCalls } = await renderDialog({}, { statefulOpen: true });+ await createReport('still my note');++ await userEvent.click(screen.getByRole('button', { name: 'Send report' }));+ await vi.waitFor(() => {+ expect(log.sendCalls).toHaveLength(1);+ });- expect(openChangeCalls).toEqual([false]);- expect(screen.queryByRole('dialog')).toBeNull();- expect(screen.queryByRole('heading', { name: "Couldn't send the report" })).toBeNull();- expect(screen.queryByRole('heading', { name: 'Send your report by email' })).toBeNull();- expect(screen.queryByRole('heading', { name: 'Thanks for the report!' })).toBeNull();- expect(log.opened).toEqual([]);- });+ expect(openChangeCalls).toEqual([false]);+ expect(screen.queryByRole('dialog')).toBeNull();+ expect(screen.queryByRole('heading', { name: "Couldn't send the report" })).toBeNull();+ expect(screen.queryByRole('heading', { name: 'Send your report by email' })).toBeNull();+ expect(screen.queryByRole('heading', { name: 'Thanks for the report!' })).toBeNull();+ expect(log.opened).toEqual([]);+ },+ );test('Escape closes the dialog from review, and review keeps its close button', async () => {installBridge();diff --git a/packages/app/src/components/SharingModeField.tsx b/packages/app/src/components/SharingModeField.tsxindex a0bedeb9f..21cfcaed0 100644--- a/packages/app/src/components/SharingModeField.tsx+++ b/packages/app/src/components/SharingModeField.tsx@@ -41,7 +41,7 @@ export function SharingModeField({<Trans>Share this setup with your team?</Trans></span><ConfigSharingInfoTooltip />- {}+ {/* biome-ignore lint/a11y/noAmbiguousAnchorText: the accessible name comes from aria-label, which this rule only recognises as a string literal; the i18n directive requires the t macro. */}<ahref={CONFIG_SHARING_DOCS_URL}target="_blank"diff --git a/packages/app/src/components/SyncStatusBadge.dom.test.tsx b/packages/app/src/components/SyncStatusBadge.dom.test.tsxindex c3204ffd8..cca0402ea 100644--- a/packages/app/src/components/SyncStatusBadge.dom.test.tsx+++ b/packages/app/src/components/SyncStatusBadge.dom.test.tsx@@ -691,15 +691,18 @@ describe('SyncStatusBadge runtime behavior', () => {['pulling', 'pulling', 'sync-popover-pull'],['fetching', 'fetching', 'sync-popover-pull'],['pushing', 'pushing', 'sync-popover-push'],- ] as const)('an automation-driven %s cycle spins the matching direction, never Pull and Push', async (_label, state, expectedTestId) => {- status = { ...baseStatus, state } as GitSyncStatus;- projectLocalConfig = { autoSync: { mode: 'full' } };- await renderBadge();- await openPopover();+ ] as const)(+ 'an automation-driven %s cycle spins the matching direction, never Pull and Push',+ async (_label, state, expectedTestId) => {+ status = { ...baseStatus, state } as GitSyncStatus;+ projectLocalConfig = { autoSync: { mode: 'full' } };+ await renderBadge();+ await openPopover();- expect(spinnerIn(expectedTestId)).not.toBeNull();- expect(spinnerIn('sync-popover-sync')).toBeNull();- });+ expect(spinnerIn(expectedTestId)).not.toBeNull();+ expect(spinnerIn('sync-popover-sync')).toBeNull();+ },+ );test.each([['idle', { state: 'idle' }, 'Sync status: Up to date'],@@ -707,12 +710,15 @@ describe('SyncStatusBadge runtime behavior', () => {['fetching', { state: 'fetching' }, 'Sync status: Checking for updates'],['offline', { state: 'offline' }, 'Sync status: Offline'],['auth-error', { state: 'auth-error' }, 'Sync status: Reconnect required'],- ] as const)('pull-only %s renders a distinct following badge', async (_label, override, ariaName) => {- status = { ...baseStatus, syncMode: 'follow', ...override } as GitSyncStatus;- await renderBadge();+ ] as const)(+ 'pull-only %s renders a distinct following badge',+ async (_label, override, ariaName) => {+ status = { ...baseStatus, syncMode: 'follow', ...override } as GitSyncStatus;+ await renderBadge();- expect(screen.getByRole('button', { name: ariaName })).toBeTruthy();- });+ expect(screen.getByRole('button', { name: ariaName })).toBeTruthy();+ },+ );test('pull-only conflict surfaces on the badge even though the engine stays idle', async () => {status = {diff --git a/packages/app/src/components/ValidationFreshness.dom.test.tsx b/packages/app/src/components/ValidationFreshness.dom.test.tsxindex 2f1302685..ca0830b52 100644--- a/packages/app/src/components/ValidationFreshness.dom.test.tsx+++ b/packages/app/src/components/ValidationFreshness.dom.test.tsx@@ -211,36 +211,36 @@ describe('ValidationFreshness', () => {expect(fetchUrls).toEqual(['/api/audit?counts=1']);});- test.each([- 'local-targets',- 'files',- ] as const)('re-audits when the local-target assessment plane changes via %s', async (channel) => {- countsBody = {- files: [- {- file: 'notes.md',- lint: { errorCount: 0, warningCount: 0 },- links: { errorCount: 0, warningCount: 1 },- },- ],- fileCount: 1,- errorCount: 0,- warningCount: 1,- warnings: [],- };- render(<ValidationFreshness />);- emitDocumentsChanged([channel]);-- await waitFor(- () =>- expect(getValidationSnapshot().get('notes')).toEqual({- errorCount: 0,- warningCount: 1,- }),- { timeout: 3000 },- );- expect(fetchUrls).toEqual(['/api/audit?counts=1']);- });+ test.each(['local-targets', 'files'] as const)(+ 're-audits when the local-target assessment plane changes via %s',+ async (channel) => {+ countsBody = {+ files: [+ {+ file: 'notes.md',+ lint: { errorCount: 0, warningCount: 0 },+ links: { errorCount: 0, warningCount: 1 },+ },+ ],+ fileCount: 1,+ errorCount: 0,+ warningCount: 1,+ warnings: [],+ };+ render(<ValidationFreshness />);+ emitDocumentsChanged([channel]);++ await waitFor(+ () =>+ expect(getValidationSnapshot().get('notes')).toEqual({+ errorCount: 0,+ warningCount: 1,+ }),+ { timeout: 3000 },+ );+ expect(fetchUrls).toEqual(['/api/audit?counts=1']);+ },+ );test('docs the new config no longer flags drop out of the snapshot', async () => {render(<ValidationFreshness />);diff --git a/packages/app/src/components/acp/ThreadView.composed.dom.test.tsx b/packages/app/src/components/acp/ThreadView.composed.dom.test.tsxindex 17aef0592..39720c6fe 100644--- a/packages/app/src/components/acp/ThreadView.composed.dom.test.tsx+++ b/packages/app/src/components/acp/ThreadView.composed.dom.test.tsx@@ -166,23 +166,24 @@ function transcriptRows(): [string, string][] {const noticeCards = (): HTMLElement[] => screen.queryAllByTestId('agent-thread-agent-notice');describe('composed transcript: a Codex warning becomes a warning card', () => {- test.each(- fixture.candidates.map((candidate) => [candidate.name, candidate] as const),- )('candidate %s arrives over the socket and draws one runtime-warning row', (_name, candidate) => {- render(<ThreadView info={openThread()} />);-- pushEvent(su(candidate.update), 0);-- const cards = noticeCards();- expect(cards).toHaveLength(1);- const card = cards[0];- expect(card).toBe(screen.getByRole('note'));- expect(card.textContent).toContain('Warning');- expect(card.querySelector('svg')?.getAttribute('aria-hidden')).toBe('true');- const body = candidate.update.content.text.trim();- expect(card.textContent).toContain(body.split('\n')[0]);- expect(screen.queryByTestId('agent-thread-agent-message')).toBeNull();- });+ test.each(fixture.candidates.map((candidate) => [candidate.name, candidate] as const))(+ 'candidate %s arrives over the socket and draws one runtime-warning row',+ (_name, candidate) => {+ render(<ThreadView info={openThread()} />);++ pushEvent(su(candidate.update), 0);++ const cards = noticeCards();+ expect(cards).toHaveLength(1);+ const card = cards[0];+ expect(card).toBe(screen.getByRole('note'));+ expect(card.textContent).toContain('Warning');+ expect(card.querySelector('svg')?.getAttribute('aria-hidden')).toBe('true');+ const body = candidate.update.content.text.trim();+ expect(card.textContent).toContain(body.split('\n')[0]);+ expect(screen.queryByTestId('agent-thread-agent-message')).toBeNull();+ },+ );test('a config warning keeps its detail paragraphs inside the one card', () => {const detailed = fixture.candidates.find((c) => c.name === 'config-warning-with-details');@@ -241,23 +242,24 @@ describe('composed transcript: a Codex warning becomes a warning card', () => {describe('composed transcript: near misses stay ordinary prose', () => {const SENTINEL = 'The refactor is safe.';- test.each(- fixture.negatives.map((negative) => [negative.name, negative] as const),- )('near miss %s draws no warning card', (_name, negative) => {- const agent = agentNamed((negative as { agent?: string }).agent);- render(<ThreadView info={openThread({ agent })} />);-- pushEvents([su(negative.update), chunk(SENTINEL, 'sentinel')], 0);-- expect(noticeCards()).toHaveLength(0);- expect(screen.queryAllByRole('note')).toHaveLength(0);- const transcript = screen.getByTestId('agent-thread-transcript');- expect(transcript.textContent).toContain(SENTINEL);- const body = (negative.update as { content?: { type?: string; text?: string } }).content;- if (body?.type === 'text' && body.text !== undefined && body.text.trim() !== '') {- expect(transcript.textContent).toContain(body.text.trim());- }- });+ test.each(fixture.negatives.map((negative) => [negative.name, negative] as const))(+ 'near miss %s draws no warning card',+ (_name, negative) => {+ const agent = agentNamed((negative as { agent?: string }).agent);+ render(<ThreadView info={openThread({ agent })} />);++ pushEvents([su(negative.update), chunk(SENTINEL, 'sentinel')], 0);++ expect(noticeCards()).toHaveLength(0);+ expect(screen.queryAllByRole('note')).toHaveLength(0);+ const transcript = screen.getByTestId('agent-thread-transcript');+ expect(transcript.textContent).toContain(SENTINEL);+ const body = (negative.update as { content?: { type?: string; text?: string } }).content;+ if (body?.type === 'text' && body.text !== undefined && body.text.trim() !== '') {+ expect(transcript.textContent).toContain(body.text.trim());+ }+ },+ );test('an ordinary answer carrying an item id stays a reply bubble', () => {render(<ThreadView info={openThread()} />);diff --git a/packages/app/src/components/acp/follow-file.test.ts b/packages/app/src/components/acp/follow-file.test.tsindex b7610ad3e..cbed84422 100644--- a/packages/app/src/components/acp/follow-file.test.ts+++ b/packages/app/src/components/acp/follow-file.test.ts@@ -148,32 +148,30 @@ describe('followTargetFromToolCall', () => {).toBeNull();});- test.each([- 'read',- 'search',- 'execute',- 'other',- ] as const)('flat docName on a %s-shaped tool call never follows', (kind) => {- expect(- followTargetFromToolCall(- call({- toolKind: kind,- rawInput: {- server: 'open-knowledge',- tool: 'history',- arguments: { docName: 'notes/today' },- },- }),- posix,- ),- ).toBeNull();- expect(- followTargetFromToolCall(- call({ toolKind: kind, rawInput: { docName: 'notes/today' } }),- posix,- ),- ).toBeNull();- });+ test.each(['read', 'search', 'execute', 'other'] as const)(+ 'flat docName on a %s-shaped tool call never follows',+ (kind) => {+ expect(+ followTargetFromToolCall(+ call({+ toolKind: kind,+ rawInput: {+ server: 'open-knowledge',+ tool: 'history',+ arguments: { docName: 'notes/today' },+ },+ }),+ posix,+ ),+ ).toBeNull();+ expect(+ followTargetFromToolCall(+ call({ toolKind: kind, rawInput: { docName: 'notes/today' } }),+ posix,+ ),+ ).toBeNull();+ },+ );test('flat docName argument shape also resolves', () => {const target = followTargetFromToolCall(@@ -357,19 +355,17 @@ describe('followTargetFromToolCall — exec commands never follow', () => {});describe('followTargetFromToolCall — location-based follow is write-only', () => {- test.each([- 'execute',- 'search',- 'other',- 'read',- ] as const)('%s never navigates from its locations (even when the doc exists)', (kind) => {- expect(- followTargetFromToolCall(- call({ toolKind: kind, locations: [{ path: '/home/me/notes/main.md' }] }),- posix,- ),- ).toBeNull();- });+ test.each(['execute', 'search', 'other', 'read'] as const)(+ '%s never navigates from its locations (even when the doc exists)',+ (kind) => {+ expect(+ followTargetFromToolCall(+ call({ toolKind: kind, locations: [{ path: '/home/me/notes/main.md' }] }),+ posix,+ ),+ ).toBeNull();+ },+ );test('a move call names the destination — its location follows even when the doc does not exist yet', () => {expect(diff --git a/packages/app/src/components/file-tree-trash-copy.test.ts b/packages/app/src/components/file-tree-trash-copy.test.tsindex f170a4ffa..b9a8fee11 100644--- a/packages/app/src/components/file-tree-trash-copy.test.ts+++ b/packages/app/src/components/file-tree-trash-copy.test.ts@@ -212,23 +212,25 @@ describe('file-tree-trash-copy — ICU escape regression guard', () => {).toBe(false);}- test.each(- shippedLocales,- )('compiled `%s` catalog: single-file trash-copy entry has an interpolation slot', (locale) => {- if (fileId === undefined)- throw new Error('anchor missing — earlier test surfaces the root cause');- const entry = loadCatalog(locale).messages[fileId];- assertInterpolatingSlot(entry, `${locale}/${fileId}`);- });-- test.each(- shippedLocales,- )('compiled `%s` catalog: single-folder trash-copy entry has an interpolation slot', (locale) => {- if (folderId === undefined)- throw new Error('anchor missing — earlier test surfaces the root cause');- const entry = loadCatalog(locale).messages[folderId];- assertInterpolatingSlot(entry, `${locale}/${folderId}`);- });+ test.each(shippedLocales)(+ 'compiled `%s` catalog: single-file trash-copy entry has an interpolation slot',+ (locale) => {+ if (fileId === undefined)+ throw new Error('anchor missing — earlier test surfaces the root cause');+ const entry = loadCatalog(locale).messages[fileId];+ assertInterpolatingSlot(entry, `${locale}/${fileId}`);+ },+ );++ test.each(shippedLocales)(+ 'compiled `%s` catalog: single-folder trash-copy entry has an interpolation slot',+ (locale) => {+ if (folderId === undefined)+ throw new Error('anchor missing — earlier test surfaces the root cause');+ const entry = loadCatalog(locale).messages[folderId];+ assertInterpolatingSlot(entry, `${locale}/${folderId}`);+ },+ );});describe('file-tree-trash-copy — source-layer smoke tests', () => {diff --git a/packages/app/src/components/graph-view-utils.test.ts b/packages/app/src/components/graph-view-utils.test.tsindex b812cef32..7fd9e614b 100644--- a/packages/app/src/components/graph-view-utils.test.ts+++ b/packages/app/src/components/graph-view-utils.test.ts@@ -172,27 +172,26 @@ describe('getGraphNodeTooltipLabel', () => {heading: 'Folder target',detail: 'This link resolves to a folder view rather than a standalone page.',},- ])('returns status-rich HTML for $displayState doc targets', ({- displayState,- heading,- detail,- }) => {- const html = getGraphNodeTooltipLabel(- {- kind: 'doc',- id: 'notes/alpha',- label: 'Alpha',- docName: 'notes/alpha',- anchor: null,- },- { displayState },- );+ ])(+ 'returns status-rich HTML for $displayState doc targets',+ ({ displayState, heading, detail }) => {+ const html = getGraphNodeTooltipLabel(+ {+ kind: 'doc',+ id: 'notes/alpha',+ label: 'Alpha',+ docName: 'notes/alpha',+ anchor: null,+ },+ { displayState },+ );- expect(html).toContain('<div');- expect(html).toContain(heading);- expect(html).toContain(detail);- expect(html).toContain('Alpha');- });+ expect(html).toContain('<div');+ expect(html).toContain(heading);+ expect(html).toContain(detail);+ expect(html).toContain('Alpha');+ },+ );});describe('resolveGraphNodeClickAction', () => {diff --git a/packages/app/src/components/handoff/OpenInAgentMenuItem.test.ts b/packages/app/src/components/handoff/OpenInAgentMenuItem.test.tsindex d3556dae1..cb1a8605c 100644--- a/packages/app/src/components/handoff/OpenInAgentMenuItem.test.ts+++ b/packages/app/src/components/handoff/OpenInAgentMenuItem.test.ts@@ -114,16 +114,19 @@ describe('computeRowState — branch 1: pre-probe', () => {['claude-code' as const, false],['codex' as const, false],['cursor' as const, false],- ])('row %s on isElectronHost=%s with installed:null is disabled with no tooltip', async (id, isElectronHost) => {- const { computeRowState } = await import('./OpenInAgentMenuItem');- const state = computeRowState({- target: targetById(id),- installState: { installed: null },- isElectronHost,- });- expect(state.enabled).toBe(false);- expect(state.tooltip).toBeNull();- });+ ])(+ 'row %s on isElectronHost=%s with installed:null is disabled with no tooltip',+ async (id, isElectronHost) => {+ const { computeRowState } = await import('./OpenInAgentMenuItem');+ const state = computeRowState({+ target: targetById(id),+ installState: { installed: null },+ isElectronHost,+ });+ expect(state.enabled).toBe(false);+ expect(state.tooltip).toBeNull();+ },+ );});describe('computeRowState — branch 3: not installed → install affordance only', () => {@@ -195,20 +198,19 @@ describe('computeRowState — branch 4: installed → enabled', () => {expect(state.tooltip).toBeNull();});- test.each([- ['claude-cowork' as const],- ['claude-code' as const],- ['codex' as const],- ])('row %s on web with installed:true is enabled', async (id) => {- const { computeRowState } = await import('./OpenInAgentMenuItem');- const state = computeRowState({- target: targetById(id),- installState: { installed: true, lastChecked: 1 },- isElectronHost: false,- });- expect(state.enabled).toBe(true);- expect(state.tooltip).toBeNull();- });+ test.each([['claude-cowork' as const], ['claude-code' as const], ['codex' as const]])(+ 'row %s on web with installed:true is enabled',+ async (id) => {+ const { computeRowState } = await import('./OpenInAgentMenuItem');+ const state = computeRowState({+ target: targetById(id),+ installState: { installed: true, lastChecked: 1 },+ isElectronHost: false,+ });+ expect(state.enabled).toBe(true);+ expect(state.tooltip).toBeNull();+ },+ );});describe('install-state cardinality used by the dropdown', () => {diff --git a/packages/app/src/components/settings/SettingsSectionHeader.tsx b/packages/app/src/components/settings/SettingsSectionHeader.tsxindex 9f02219e3..1ea04929f 100644--- a/packages/app/src/components/settings/SettingsSectionHeader.tsx+++ b/packages/app/src/components/settings/SettingsSectionHeader.tsx@@ -42,6 +42,7 @@ export function SettingsSectionHeader({</div>{children ? <p className="text-sm text-muted-foreground">{children}</p> : null}{docUrl !== undefined ? (+ // biome-ignore lint/a11y/noAmbiguousAnchorText: the accessible name comes from aria-label, which this rule only recognises as a string literal; the i18n directive requires the t macro.<ahref={docUrl}target="_blank"diff --git a/packages/app/src/components/settings/frontmatter-schema-field-editor.dom.test.tsx b/packages/app/src/components/settings/frontmatter-schema-field-editor.dom.test.tsxindex dd33559f1..b03454d51 100644--- a/packages/app/src/components/settings/frontmatter-schema-field-editor.dom.test.tsx+++ b/packages/app/src/components/settings/frontmatter-schema-field-editor.dom.test.tsx@@ -297,28 +297,25 @@ describe('FrontmatterSchemaFieldEditor', () => {expect(writes).toEqual([[FILE, 'status', { type: 'string' }, []]]);});- test.each([- 'number',- 'boolean',- 'array',- 'object',- ])('switching to %s clears values that type could never satisfy', async (target) => {- render(<FrontmatterSchemaFieldEditor file={FILE} />);- await userEvent.click(screen.getByTestId('frontmatter-field-type-status'));- await userEvent.click(await screen.findByRole('option', { name: target }));- expect(writes).toEqual([[FILE, 'status', { type: target, enum: null }, []]]);- });-- test.each([- 'number',- 'boolean',- 'object',- ])('switching the element type to %s clears the element values', async (target) => {- render(<FrontmatterSchemaFieldEditor file={FILE} />);- await userEvent.click(screen.getByTestId('frontmatter-field-items-type-tags'));- await userEvent.click(await screen.findByRole('option', { name: target }));- expect(writes).toEqual([[FILE, 'tags', { itemsType: target, itemsEnum: null }, []]]);- });+ test.each(['number', 'boolean', 'array', 'object'])(+ 'switching to %s clears values that type could never satisfy',+ async (target) => {+ render(<FrontmatterSchemaFieldEditor file={FILE} />);+ await userEvent.click(screen.getByTestId('frontmatter-field-type-status'));+ await userEvent.click(await screen.findByRole('option', { name: target }));+ expect(writes).toEqual([[FILE, 'status', { type: target, enum: null }, []]]);+ },+ );++ test.each(['number', 'boolean', 'object'])(+ 'switching the element type to %s clears the element values',+ async (target) => {+ render(<FrontmatterSchemaFieldEditor file={FILE} />);+ await userEvent.click(screen.getByTestId('frontmatter-field-items-type-tags'));+ await userEvent.click(await screen.findByRole('option', { name: target }));+ expect(writes).toEqual([[FILE, 'tags', { itemsType: target, itemsEnum: null }, []]]);+ },+ );test('entering an allowed element value on a typed array writes only that constraint', () => {mockLintData = lintDataWithSchema({diff --git a/packages/app/src/components/ui/calendar.dom.test.tsx b/packages/app/src/components/ui/calendar.dom.test.tsxnew file mode 100644index 000000000..3a334f19a--- /dev/null+++ b/packages/app/src/components/ui/calendar.dom.test.tsx@@ -0,0 +1,30 @@+// @vitest-environment jsdom+import { cleanup, render, screen } from '@testing-library/react';+import { afterEach, describe, expect, test } from 'vitest';+import { Calendar } from './calendar';++afterEach(() => {+ cleanup();+});++describe('Calendar', () => {+ test('renders a labelled month grid for the given month', () => {+ render(<Calendar month={new Date(2026, 0, 1)} />);+ const grid = screen.getByRole('grid');+ expect(grid).toBeTruthy();+ expect(screen.getAllByRole('gridcell').length).toBeGreaterThan(27);+ });++ test('styles the month grid through the month_grid slot, not the renamed table slot', () => {+ render(<Calendar month={new Date(2026, 0, 1)} />);+ const grid = screen.getByRole('grid');+ expect(grid.className).toContain('border-collapse');+ expect(grid.className).toContain('w-full');+ expect(grid.className).toContain('rdp-month_grid');+ });++ test('a caller can still override the month grid styling', () => {+ render(<Calendar month={new Date(2026, 0, 1)} classNames={{ month_grid: 'ok-custom-grid' }} />);+ expect(screen.getByRole('grid').className).toContain('ok-custom-grid');+ });+});diff --git a/packages/app/src/components/ui/calendar.tsx b/packages/app/src/components/ui/calendar.tsxindex 832f5adc3..6baee56e9 100644--- a/packages/app/src/components/ui/calendar.tsx+++ b/packages/app/src/components/ui/calendar.tsx@@ -69,7 +69,7 @@ function Calendar({: 'flex items-center gap-1 rounded-(--cell-radius) text-sm [&>svg]:size-3.5 [&>svg]:text-muted-foreground',defaultClassNames.caption_label,),- table: 'w-full border-collapse',+ month_grid: cn('w-full border-collapse', defaultClassNames.month_grid),weekdays: cn('flex', defaultClassNames.weekdays),weekday: cn('flex-1 rounded-(--cell-radius) text-[0.8rem] font-normal text-muted-foreground select-none',diff --git a/packages/app/src/components/ui/context-menu.dom.test.tsx b/packages/app/src/components/ui/context-menu.dom.test.tsxindex 3a3da65ad..8da43e45b 100644--- a/packages/app/src/components/ui/context-menu.dom.test.tsx+++ b/packages/app/src/components/ui/context-menu.dom.test.tsx@@ -95,22 +95,22 @@ describe('ContextMenu runtime class contracts', () => {}});- test.each([- 'context-menu-content',- 'context-menu-sub-content',- ] as const)('%s carries keyframe motion and reduced-motion opt-in at runtime', async (slot) => {- await renderContextMenu();-- const surface = document.querySelector(`[data-slot="${slot}"]`);- expect(surface).toBeTruthy();- const className = surface?.getAttribute('class') ?? '';-- expectVisualClassTokens(className, [- ...UPSTREAM_MOTION_TOKENS,- 'origin-(--radix-context-menu-content-transform-origin)',- ...A11Y_OPT_IN,- ]);- });+ test.each(['context-menu-content', 'context-menu-sub-content'] as const)(+ '%s carries keyframe motion and reduced-motion opt-in at runtime',+ async (slot) => {+ await renderContextMenu();++ const surface = document.querySelector(`[data-slot="${slot}"]`);+ expect(surface).toBeTruthy();+ const className = surface?.getAttribute('class') ?? '';++ expectVisualClassTokens(className, [+ ...UPSTREAM_MOTION_TOKENS,+ 'origin-(--radix-context-menu-content-transform-origin)',+ ...A11Y_OPT_IN,+ ]);+ },+ );test('subtrigger keeps its open-state highlight classes at runtime', async () => {await renderContextMenu();diff --git a/packages/app/src/components/ui/dropdown-menu.dom.test.tsx b/packages/app/src/components/ui/dropdown-menu.dom.test.tsxindex 18f1c389d..570765edc 100644--- a/packages/app/src/components/ui/dropdown-menu.dom.test.tsx+++ b/packages/app/src/components/ui/dropdown-menu.dom.test.tsx@@ -91,22 +91,22 @@ describe('DropdownMenu runtime class contracts', () => {}});- test.each([- 'dropdown-menu-content',- 'dropdown-menu-sub-content',- ] as const)('%s carries keyframe motion and reduced-motion opt-in at runtime', async (slot) => {- await renderDropdownMenu();-- const surface = document.querySelector(`[data-slot="${slot}"]`);- expect(surface).toBeTruthy();- const className = surface?.getAttribute('class') ?? '';-- expectVisualClassTokens(className, [- ...UPSTREAM_MOTION_TOKENS,- 'origin-(--radix-dropdown-menu-content-transform-origin)',- ...A11Y_OPT_IN,- ]);- });+ test.each(['dropdown-menu-content', 'dropdown-menu-sub-content'] as const)(+ '%s carries keyframe motion and reduced-motion opt-in at runtime',+ async (slot) => {+ await renderDropdownMenu();++ const surface = document.querySelector(`[data-slot="${slot}"]`);+ expect(surface).toBeTruthy();+ const className = surface?.getAttribute('class') ?? '';++ expectVisualClassTokens(className, [+ ...UPSTREAM_MOTION_TOKENS,+ 'origin-(--radix-dropdown-menu-content-transform-origin)',+ ...A11Y_OPT_IN,+ ]);+ },+ );test('content keeps its closed-state overflow clip and subtrigger highlight classes', async () => {await renderDropdownMenu();diff --git a/packages/app/src/components/ui/sidebar.partition.dom.test.tsx b/packages/app/src/components/ui/sidebar.partition.dom.test.tsxindex 4a9d99c07..8195c4f89 100644--- a/packages/app/src/components/ui/sidebar.partition.dom.test.tsx+++ b/packages/app/src/components/ui/sidebar.partition.dom.test.tsx@@ -55,8 +55,6 @@ function installMatchMedia(initialMatches: boolean): ControllableMql {listeners.delete(listener as Listener);}},- addListener() {},- removeListener() {},dispatchEvent() {return false;},diff --git a/packages/app/src/editor/awareness-heartbeat.ts b/packages/app/src/editor/awareness-heartbeat.tsindex 7e6a31c6c..533db2757 100644--- a/packages/app/src/editor/awareness-heartbeat.ts+++ b/packages/app/src/editor/awareness-heartbeat.ts@@ -17,11 +17,10 @@ export class AwarenessHeartbeat {private started = false;private readonly renewIntervalMs: number;private readonly now: () => number;+ private readonly ticker: HeartbeatTicker;- constructor(- private readonly ticker: HeartbeatTicker,- options: AwarenessHeartbeatOptions = {},- ) {+ constructor(ticker: HeartbeatTicker, options: AwarenessHeartbeatOptions = {}) {+ this.ticker = ticker;this.renewIntervalMs = options.renewIntervalMs ?? AWARENESS_RENEW_INTERVAL_MS;this.now = options.now ?? (() => Date.now());}diff --git a/packages/app/src/editor/branch-invalidation.test.ts b/packages/app/src/editor/branch-invalidation.test.tsindex 6c9e9d870..63af6a5fa 100644--- a/packages/app/src/editor/branch-invalidation.test.ts+++ b/packages/app/src/editor/branch-invalidation.test.ts@@ -242,7 +242,7 @@ describe('handleBranchSwitched', () => {entry.provider.emit('authenticationFailed', { reason: 'server-instance-mismatch' });await pool.awaitMismatchSettled();const fresh = pool.entries.get(d1);- if (!fresh || fresh.kind !== 'active') throw new Error('expected a recycled entry');+ if (fresh?.kind !== 'active') throw new Error('expected a recycled entry');pool.__test_seedBufferedUpdate(d1, new Uint8Array([0x01, 0x02]), { branch: 'main' });pool.setObservedBranch('feature');diff --git a/packages/app/src/editor/bubble-menu/ImageAlignButtons.tsx b/packages/app/src/editor/bubble-menu/ImageAlignButtons.tsxindex fb2aee475..4b4e6e399 100644--- a/packages/app/src/editor/bubble-menu/ImageAlignButtons.tsx+++ b/packages/app/src/editor/bubble-menu/ImageAlignButtons.tsx@@ -71,7 +71,7 @@ export function ImageAlignButtons({ editor }: ImageAlignButtonsProps) {node?: { type: { name: string }; attrs: Record<string, unknown> };}).node;- if (!liveNode || liveNode.type.name !== 'jsxComponent') return;+ if (liveNode?.type.name !== 'jsxComponent') return;const componentName = String(liveNode.attrs.componentName ?? '');if (!ALIGNABLE_DESCRIPTOR_NAMES.has(componentName)) {return;diff --git a/packages/app/src/editor/clipboard/lone-url.test.ts b/packages/app/src/editor/clipboard/lone-url.test.tsindex 4944a7c64..ae14b1240 100644--- a/packages/app/src/editor/clipboard/lone-url.test.ts+++ b/packages/app/src/editor/clipboard/lone-url.test.ts@@ -52,14 +52,12 @@ describe('detectLoneTrustedUrl — over-selection policy (trust the gesture)', (expect(detectLoneTrustedUrl(raw)).toBe(expected);});- test.each([- ['javascript:alert(1)'],- ['data:text/html,x'],- ['vbscript:x'],- ['foo:bar'],- ])('non-allowlisted scheme is refused: %s', (raw) => {- expect(detectLoneTrustedUrl(raw)).toBeNull();- });+ test.each([['javascript:alert(1)'], ['data:text/html,x'], ['vbscript:x'], ['foo:bar']])(+ 'non-allowlisted scheme is refused: %s',+ (raw) => {+ expect(detectLoneTrustedUrl(raw)).toBeNull();+ },+ );test.each([['example.com', 'https://example.com'],@@ -107,22 +105,19 @@ describe('detectClipboardPrefillUrl — link-popover pre-fill policy (explicit sexpect(detectClipboardPrefillUrl(raw)).toBe(expected);});- test.each([- ['javascript:alert(1)'],- ['data:text/html,x'],- ['vbscript:x'],- ])('non-allowlisted scheme never pre-fills: %s', (raw) => {- expect(detectClipboardPrefillUrl(raw)).toBeNull();- });+ test.each([['javascript:alert(1)'], ['data:text/html,x'], ['vbscript:x']])(+ 'non-allowlisted scheme never pre-fills: %s',+ (raw) => {+ expect(detectClipboardPrefillUrl(raw)).toBeNull();+ },+ );- test.each([- ['example.com'],- ['www.example.com'],- ['[email protected]'],- ['AGENTS.md'],- ])('schemeless token the trust-intent policy would convert stays out: %s', (raw) => {- expect(detectClipboardPrefillUrl(raw)).toBeNull();- });+ test.each([['example.com'], ['www.example.com'], ['[email protected]'], ['AGENTS.md']])(+ 'schemeless token the trust-intent policy would convert stays out: %s',+ (raw) => {+ expect(detectClipboardPrefillUrl(raw)).toBeNull();+ },+ );test.each([['localhost:5173'],diff --git a/packages/app/src/editor/components/Embed.tsx b/packages/app/src/editor/components/Embed.tsxindex 0067ebe8f..7556830f4 100644--- a/packages/app/src/editor/components/Embed.tsx+++ b/packages/app/src/editor/components/Embed.tsx@@ -68,7 +68,7 @@ export function Embed({ src, title, width, height }: EmbedProps) {if (typeof pos !== 'number') return;try {const node = editor.state.doc.nodeAt(pos);- if (!node || node.type.name !== 'jsxComponent') return;+ if (node?.type.name !== 'jsxComponent') return;const props = (node.attrs.props as Record<string, unknown>) ?? {};const nextProps = {...props,diff --git a/packages/app/src/editor/components/Mermaid.dom.test.tsx b/packages/app/src/editor/components/Mermaid.dom.test.tsxindex 421f20f55..645230983 100644--- a/packages/app/src/editor/components/Mermaid.dom.test.tsx+++ b/packages/app/src/editor/components/Mermaid.dom.test.tsx@@ -173,8 +173,6 @@ describe('MermaidView controls', () => {onchange: null,addEventListener: () => {},removeEventListener: () => {},- addListener: () => {},- removeListener: () => {},dispatchEvent: () => false,})) as typeof window.matchMedia;try {diff --git a/packages/app/src/editor/components/Mermaid.tsx b/packages/app/src/editor/components/Mermaid.tsxindex a7ffbd21e..fc507cca2 100644--- a/packages/app/src/editor/components/Mermaid.tsx+++ b/packages/app/src/editor/components/Mermaid.tsx@@ -193,7 +193,7 @@ export function MermaidView({ chart = '', className, editBinding, onExpand }: Meconst pos = h.getPos();if (typeof pos !== 'number') return;const node = h.editor.state.doc.nodeAt(pos);- if (!node || node.type.name !== 'jsxComponent') return;+ if (node?.type.name !== 'jsxComponent') return;const currentProps = (node.attrs.props as Record<string, unknown>) ?? {};try {h.editor.view.dispatch(diff --git a/packages/app/src/editor/components/TagView.tsx b/packages/app/src/editor/components/TagView.tsxindex b8dd338a7..107eb1d97 100644--- a/packages/app/src/editor/components/TagView.tsx+++ b/packages/app/src/editor/components/TagView.tsx@@ -14,7 +14,7 @@ function commitDraft(if (!next || !INLINE_TAG_VALUE_RE.test(next)) return false;const { state, view } = editor;const curNode = state.doc.nodeAt(pos);- if (!curNode || curNode.type.name !== 'tag') return false;+ if (curNode?.type.name !== 'tag') return false;const tr = state.tr.setNodeMarkup(pos, null, { ...curNode.attrs, value: next });const after = pos + curNode.nodeSize;tr.insertText(' ', after);@@ -28,7 +28,7 @@ function cancelDraft(editor: NodeViewProps['editor'], pos: number | undefined):if (typeof pos !== 'number') return;const { state, view } = editor;const curNode = state.doc.nodeAt(pos);- if (!curNode || curNode.type.name !== 'tag') return;+ if (curNode?.type.name !== 'tag') return;const tr = state.tr.delete(pos, pos + curNode.nodeSize);view.dispatch(tr);view.focus();diff --git a/packages/app/src/editor/editor-panes.test.ts b/packages/app/src/editor/editor-panes.test.tsindex 18c84ba05..6a34fb7b4 100644--- a/packages/app/src/editor/editor-panes.test.ts+++ b/packages/app/src/editor/editor-panes.test.ts@@ -748,38 +748,38 @@ describe('editor pane workspace', () => {});});- test.each([- 'preview',- 'permanent',- ] as const)('consumes an active blank independently of %s disposition', (disposition) => {- const workspace: EditorWorkspaceState = {- panes: [- {- ...pane('pane-a', ['existing'], null),- newTabIds: ['new-tab:1'],- activeNewTabId: 'new-tab:1',- },- ],- focusedPaneId: 'pane-a',- };-- const transition = transitionEditorWorkspace(workspace, {- type: 'open-target',- paneId: 'pane-a',- tabId: 'opened',- target: docTarget('opened'),- disposition,- consumeActiveNewTab: true,- });+ test.each(['preview', 'permanent'] as const)(+ 'consumes an active blank independently of %s disposition',+ (disposition) => {+ const workspace: EditorWorkspaceState = {+ panes: [+ {+ ...pane('pane-a', ['existing'], null),+ newTabIds: ['new-tab:1'],+ activeNewTabId: 'new-tab:1',+ },+ ],+ focusedPaneId: 'pane-a',+ };- expect(transition.consumedNewTabId).toBe('new-tab:1');- expect(transition.workspace.panes[0]).toMatchObject({- openTabs: ['existing', 'opened'],- newTabIds: [],- activeNewTabId: null,- previewTabId: disposition === 'preview' ? 'opened' : null,- });- });+ const transition = transitionEditorWorkspace(workspace, {+ type: 'open-target',+ paneId: 'pane-a',+ tabId: 'opened',+ target: docTarget('opened'),+ disposition,+ consumeActiveNewTab: true,+ });++ expect(transition.consumedNewTabId).toBe('new-tab:1');+ expect(transition.workspace.panes[0]).toMatchObject({+ openTabs: ['existing', 'opened'],+ newTabIds: [],+ activeNewTabId: null,+ previewTabId: disposition === 'preview' ? 'opened' : null,+ });+ },+ );test('activates, creates, closes, pins, and promotes tabs through the command boundary', () => {let workspace: EditorWorkspaceState = {diff --git a/packages/app/src/editor/extensions/JsxInlineView.tsx b/packages/app/src/editor/extensions/JsxInlineView.tsxindex 000b1747b..37ab97e60 100644--- a/packages/app/src/editor/extensions/JsxInlineView.tsx+++ b/packages/app/src/editor/extensions/JsxInlineView.tsx@@ -148,7 +148,7 @@ function RegisteredInlineView({const p = typeof getPos === 'function' ? getPos() : undefined;if (typeof p !== 'number') return;const curNode = editor.state.doc.nodeAt(p);- if (!curNode || curNode.type.name !== 'jsxInline') return;+ if (curNode?.type.name !== 'jsxInline') return;const nextProps = { ...curNode.attrs.props, [propName]: value };const tr = editor.state.tr.setNodeMarkup(p, null, {...curNode.attrs,diff --git a/packages/app/src/editor/extensions/MathInlineView.tsx b/packages/app/src/editor/extensions/MathInlineView.tsxindex a989f9403..e487cb213 100644--- a/packages/app/src/editor/extensions/MathInlineView.tsx+++ b/packages/app/src/editor/extensions/MathInlineView.tsx@@ -164,7 +164,7 @@ export function MathInlineView({ node, selected, getPos, editor }: NodeViewPropsconst p = typeof getPos === 'function' ? getPos() : undefined;if (typeof p !== 'number') return;const curNode = editor.state.doc.nodeAt(p);- if (!curNode || curNode.type.name !== 'mathInline') return;+ if (curNode?.type.name !== 'mathInline') return;const tr = editor.state.tr.setNodeMarkup(p, null, {...curNode.attrs,[propName]: value ?? '',diff --git a/packages/app/src/editor/extensions/RawMdxFallbackCMView.tsx b/packages/app/src/editor/extensions/RawMdxFallbackCMView.tsxindex b3eec4cf0..f1ad93b76 100644--- a/packages/app/src/editor/extensions/RawMdxFallbackCMView.tsx+++ b/packages/app/src/editor/extensions/RawMdxFallbackCMView.tsx@@ -336,7 +336,7 @@ export function RawMdxFallbackView({ node, editor, getPos }: NodeViewProps) {const pmView = getEditorView(editor);if (!pmView) return;const currentNode = pmView.state.doc.nodeAt(pos);- if (!currentNode || currentNode.type.name !== 'rawMdxFallback') return;+ if (currentNode?.type.name !== 'rawMdxFallback') return;if (!autonomousFragmentEditAllowed(editor)) return;const source = update.view.state.doc.toString();diff --git a/packages/app/src/editor/extensions/preview-live-tokens.test.ts b/packages/app/src/editor/extensions/preview-live-tokens.test.tsindex 020a5b5db..b3e2d7036 100644--- a/packages/app/src/editor/extensions/preview-live-tokens.test.ts+++ b/packages/app/src/editor/extensions/preview-live-tokens.test.ts@@ -57,7 +57,9 @@ describe('buildPreviewThemeMessage', () => {| Record<string, unknown>| undefined;expect(message?.okPreviewTheme).toBe('dark');- expect((message?.okPreviewTokens as Record<string, string>)['--primary']).toBe('#bd93f9');+ expect((message?.okPreviewTokens as Record<string, string> | undefined)?.['--primary']).toBe(+ '#bd93f9',+ );});test('carries an empty token map under the default theme', () => {diff --git a/packages/app/src/editor/extensions/selection-state-plugin.test.ts b/packages/app/src/editor/extensions/selection-state-plugin.test.tsindex 33dadb046..1bd51788b 100644--- a/packages/app/src/editor/extensions/selection-state-plugin.test.ts+++ b/packages/app/src/editor/extensions/selection-state-plugin.test.ts@@ -370,7 +370,7 @@ describe('rangeEncompassedBlockIds (range-encompass soft halo derivation)', () =let state = makeStateWithBridgeIds(docNode);const firstCalloutPos = 3;const firstCalloutNode = state.doc.nodeAt(firstCalloutPos);- if (!firstCalloutNode || firstCalloutNode.type.name !== 'jsxComponent') {+ if (firstCalloutNode?.type.name !== 'jsxComponent') {throw new Error('test fixture: expected jsxComponent at pos 3');}const firstEnd = firstCalloutPos + firstCalloutNode.nodeSize;@@ -449,16 +449,10 @@ describe('isBlockNavigationKey', () => {expect(isBlockNavigationKey(key)).toBe(true);});- test.each([- 'a',- '1',- ' ',- 'Shift',- 'Control',- 'Meta',- 'F1',- '',- ])('returns false for non-navigation key %p', (key) => {- expect(isBlockNavigationKey(key)).toBe(false);- });+ test.each(['a', '1', ' ', 'Shift', 'Control', 'Meta', 'F1', ''])(+ 'returns false for non-navigation key %p',+ (key) => {+ expect(isBlockNavigationKey(key)).toBe(false);+ },+ );});diff --git a/packages/app/src/editor/extensions/source-dirty-observer.ts b/packages/app/src/editor/extensions/source-dirty-observer.tsindex 10d4b97f5..d8946a2dd 100644--- a/packages/app/src/editor/extensions/source-dirty-observer.ts+++ b/packages/app/src/editor/extensions/source-dirty-observer.ts@@ -30,7 +30,7 @@ export const SourceDirtyObserver = Extension.create({const oldPos = invertedMapping.map(pos);const oldNode = oldState.doc.nodeAt(oldPos);- const isFreshInsert = !oldNode || oldNode.type.name !== 'jsxComponent';+ const isFreshInsert = oldNode?.type.name !== 'jsxComponent';const hasAuthoritativeSource =typeof node.attrs.sourceRaw === 'string' && node.attrs.sourceRaw.length > 0;if (isFreshInsert && hasAuthoritativeSource) {diff --git a/packages/app/src/editor/extensions/table-insert-commands.ts b/packages/app/src/editor/extensions/table-insert-commands.tsindex b9783421a..83e8a42c7 100644--- a/packages/app/src/editor/extensions/table-insert-commands.ts+++ b/packages/app/src/editor/extensions/table-insert-commands.ts@@ -4,7 +4,7 @@ import type { EditorView } from '@tiptap/pm/view';function tableRectAt(state: EditorState, tablePos: number) {const table = state.doc.nodeAt(tablePos);- if (!table || table.type.name !== 'table') return null;+ if (table?.type.name !== 'table') return null;const map = TableMap.get(table);return {map,diff --git a/packages/app/src/editor/extensions/table-insert-controls.ts b/packages/app/src/editor/extensions/table-insert-controls.tsindex 3e0dc14a8..8119dc237 100644--- a/packages/app/src/editor/extensions/table-insert-controls.ts+++ b/packages/app/src/editor/extensions/table-insert-controls.ts@@ -33,11 +33,12 @@ class TableInsertControlsView {private readonly overlays = new Map<HTMLElement, TableOverlay>();private readonly mount: HTMLElement;private lastEditable: boolean;+ private readonly view: EditorView;+ private readonly editor: Editor;- constructor(- private readonly view: EditorView,- private readonly editor: Editor,- ) {+ constructor(view: EditorView, editor: Editor) {+ this.view = view;+ this.editor = editor;this.mount = view.dom.parentElement ?? view.dom;this.lastEditable = editor.isEditable;this.reconcile();diff --git a/packages/app/src/editor/extensions/trailing-affordance.dom.test.ts b/packages/app/src/editor/extensions/trailing-affordance.dom.test.tsindex 3ca6352c5..99375effa 100644--- a/packages/app/src/editor/extensions/trailing-affordance.dom.test.ts+++ b/packages/app/src/editor/extensions/trailing-affordance.dom.test.ts@@ -65,15 +65,12 @@ function decorationsOf(state: EditorState) {}describe('docNeedsTrailingAffordance', () => {- test.each([- 'table',- 'heading',- 'codeBlock',- 'list',- 'thematicBreak',- ])('engages when the last block is a %s — nothing can host a caret below it', (type) => {- expect(docNeedsTrailingAffordance(stateEndingIn(type).doc)).toBe(true);- });+ test.each(['table', 'heading', 'codeBlock', 'list', 'thematicBreak'])(+ 'engages when the last block is a %s — nothing can host a caret below it',+ (type) => {+ expect(docNeedsTrailingAffordance(stateEndingIn(type).doc)).toBe(true);+ },+ );test('stands down when the last block is a paragraph', () => {expect(docNeedsTrailingAffordance(stateEndingIn('paragraph').doc)).toBe(false);diff --git a/packages/app/src/editor/gfm-autolink-plugin.test.ts b/packages/app/src/editor/gfm-autolink-plugin.test.tsindex 33d18b22e..f2d200121 100644--- a/packages/app/src/editor/gfm-autolink-plugin.test.ts+++ b/packages/app/src/editor/gfm-autolink-plugin.test.ts@@ -104,21 +104,19 @@ describe('typed autolink — conversion', () => {}});- test.each([- 'AGENTS.md ',- 'example.com ',- 'localhost:5173 ',- 'v1.2.3 ',- ])('non-GFM token %j is left as plain text', async (typed) => {- const editor = makeLightEditor();- try {- insertLocal(editor, typed, 1);- await flushMicrotasksAndTimers();- expect(firstLinkAttrs(editor)).toBeNull();- } finally {- editor.destroy();- }- });+ test.each(['AGENTS.md ', 'example.com ', 'localhost:5173 ', 'v1.2.3 '])(+ 'non-GFM token %j is left as plain text',+ async (typed) => {+ const editor = makeLightEditor();+ try {+ insertLocal(editor, typed, 1);+ await flushMicrotasksAndTimers();+ expect(firstLinkAttrs(editor)).toBeNull();+ } finally {+ editor.destroy();+ }+ },+ );});describe('typed autolink — guards', () => {diff --git a/packages/app/src/editor/provider-pool.test.ts b/packages/app/src/editor/provider-pool.test.tsindex 5d99e5002..a53858209 100644--- a/packages/app/src/editor/provider-pool.test.ts+++ b/packages/app/src/editor/provider-pool.test.ts@@ -2495,7 +2495,7 @@ describe('ProviderPool syncPromise lifecycle integration (F15)', () => {test('the client-minted forced close never triggers a reauth', async () => {pool = new ProviderPool(3, DUMMY_WS);const entry = pool.open('doc1');- if (!entry || entry.kind !== 'active') throw new Error('expected an active entry');+ if (entry?.kind !== 'active') throw new Error('expected an active entry');const sendTokenSpy = vi.spyOn(entry.provider, 'sendToken').mockImplementation(() => Promise.resolve());@@ -3315,13 +3315,13 @@ describe('ProviderPool client-persistence attachment (US-003)', () => {expect(clearOk2).toHaveBeenCalledTimes(1);const post1 = pool.entries.get(doc1);- if (!post1 || post1.kind !== 'active') throw new Error('expected active doc1 post-recycle');+ if (post1?.kind !== 'active') throw new Error('expected active doc1 post-recycle');expect(post1.provider).not.toBe(preProvider1);expect(pool.has(doc3)).toBe(false);const post2 = pool.entries.get(doc2);- if (!post2 || post2.kind !== 'active') throw new Error('expected active doc2 still in pool');+ if (post2?.kind !== 'active') throw new Error('expected active doc2 still in pool');expect(post2.provider).toBe(preProvider2);void preProvider3;});@@ -3349,8 +3349,7 @@ describe('ProviderPool client-persistence attachment (US-003)', () => {await wait(60);const postActive = pool.entries.get(docActive);- if (!postActive || postActive.kind !== 'active')- throw new Error('expected active doc post-recycle');+ if (postActive?.kind !== 'active') throw new Error('expected active doc post-recycle');expect(pool.getServerRestartRecoveryState()).toMatchObject({kind: 'recovering',phase: 'reconnecting',@@ -3960,7 +3959,7 @@ describe('ProviderPool structured mismatch telemetry', () => {await wait(150);const neo = pool.entries.get(docName);- if (!neo || neo.kind !== 'active') throw new Error('expected recycled active entry');+ if (neo?.kind !== 'active') throw new Error('expected recycled active entry');neo.observerCleanup = () => {};pool.__test_seedBufferedUpdate(docName, new Uint8Array([255, 0, 254]));diff --git a/packages/app/src/editor/provider-pool.ts b/packages/app/src/editor/provider-pool.tsindex abf47984a..49ee1e2bd 100644--- a/packages/app/src/editor/provider-pool.ts+++ b/packages/app/src/editor/provider-pool.ts@@ -176,21 +176,23 @@ type ClientPersistenceFactory = (args: {type PeekStoredLineageEpoch = (args: PeekStoredLineageEpochArgs) => Promise<string | null>;class ClientPersistenceClearTimeoutError extends Error {- constructor(- readonly docName: string,- readonly timeoutMs: number,- ) {+ readonly docName: string;+ readonly timeoutMs: number;+ constructor(docName: string, timeoutMs: number) {super(`client persistence clearData timed out for ${docName} after ${timeoutMs}ms`);+ this.docName = docName;+ this.timeoutMs = timeoutMs;this.name = 'ClientPersistenceClearTimeoutError';}}class StoredEpochPeekTimeoutError extends Error {- constructor(- readonly docName: string,- readonly timeoutMs: number,- ) {+ readonly docName: string;+ readonly timeoutMs: number;+ constructor(docName: string, timeoutMs: number) {super(`stored-state epoch peek timed out for ${docName} after ${timeoutMs}ms`);+ this.docName = docName;+ this.timeoutMs = timeoutMs;this.name = 'StoredEpochPeekTimeoutError';}}@@ -517,7 +519,7 @@ export class ProviderPool {observeDiskAck(docName: string, sv: Uint8Array): void {const entry = this.entries.get(docName);- if (!entry || entry.kind !== 'active') return;+ if (entry?.kind !== 'active') return;entry.lastDiskAckedSV = mergeStateVectors(entry.lastDiskAckedSV, sv);}@@ -2067,7 +2069,7 @@ export class ProviderPool {private recycleDisconnectedEntry(docName: string): void {const entry = this.entries.get(docName);- if (!entry || entry.kind !== 'active') return;+ if (entry?.kind !== 'active') return;const wasActive = this.activeDocName === docName;mark('ok/pool/recycle-disconnected', { docName, wasActive });diff --git a/packages/app/src/editor/useDocDiagnostics.dom.test.tsx b/packages/app/src/editor/useDocDiagnostics.dom.test.tsxindex 7a7daad25..84a5de45b 100644--- a/packages/app/src/editor/useDocDiagnostics.dom.test.tsx+++ b/packages/app/src/editor/useDocDiagnostics.dom.test.tsx@@ -77,34 +77,34 @@ describe('useDocDiagnostics', () => {await waitFor(() => expect(result.current.some((d) => d.code === 'MD010')).toBe(true));});- test.each(editableTextCases)('$docName stays outside Markdown and OKF diagnostics', async ({- docName,- source,- }) => {- expect(isEditableTextDocFile(docName)).toBe(true);+ test.each(editableTextCases)(+ '$docName stays outside Markdown and OKF diagnostics',+ async ({ docName, source }) => {+ expect(isEditableTextDocFile(docName)).toBe(true);- const markdownProvider = fakeProvider(source, 'notes').provider;- const editableTextProvider = fakeProvider(source, docName).provider;- const { result, rerender } = renderHook(- ({ provider }: { provider: HocuspocusProvider }) =>- useDocDiagnostics(provider, markdownAndOkfEnabled),- { initialProps: { provider: markdownProvider } },- );+ const markdownProvider = fakeProvider(source, 'notes').provider;+ const editableTextProvider = fakeProvider(source, docName).provider;+ const { result, rerender } = renderHook(+ ({ provider }: { provider: HocuspocusProvider }) =>+ useDocDiagnostics(provider, markdownAndOkfEnabled),+ { initialProps: { provider: markdownProvider } },+ );- await waitFor(() => {- const sources = new Set(result.current.map((diagnostic) => diagnostic.source));- expect(sources.has('markdownlint')).toBe(true);- expect(sources.has('okf')).toBe(true);- });+ await waitFor(() => {+ const sources = new Set(result.current.map((diagnostic) => diagnostic.source));+ expect(sources.has('markdownlint')).toBe(true);+ expect(sources.has('okf')).toBe(true);+ });- rerender({ provider: editableTextProvider });- expect(result.current).toEqual([]);+ rerender({ provider: editableTextProvider });+ expect(result.current).toEqual([]);- rerender({ provider: markdownProvider });- await waitFor(() => {- const sources = new Set(result.current.map((diagnostic) => diagnostic.source));- expect(sources.has('markdownlint')).toBe(true);- expect(sources.has('okf')).toBe(true);- });- });+ rerender({ provider: markdownProvider });+ await waitFor(() => {+ const sources = new Set(result.current.map((diagnostic) => diagnostic.source));+ expect(sources.has('markdownlint')).toBe(true);+ expect(sources.has('okf')).toBe(true);+ });+ },+ );});diff --git a/packages/app/src/editor/utils/editor-visible-region.dom.test.tsx b/packages/app/src/editor/utils/editor-visible-region.dom.test.tsxindex 678d6cd23..be9a0724d 100644--- a/packages/app/src/editor/utils/editor-visible-region.dom.test.tsx+++ b/packages/app/src/editor/utils/editor-visible-region.dom.test.tsx@@ -120,44 +120,53 @@ describe('deriveEditorShiftOptions', () => {expect(options.padding.bottom).toBe(COMPOSER_HEIGHT_PX + CONFLICT_FOOTER_HEIGHT_PX);});- test.each([- 'top',- 'top-start',- ] as const)('a %s placement absorbs a pending anchor gap by tightening the top inset', (placement) => {- const { editor } = renderEditorInScroller();- document.documentElement.style.setProperty('--ask-composer-height', `${COMPOSER_HEIGHT_PX}px`);- const options = deriveEditorShiftOptions(editor, {- pendingOffsetPx: PENDING_OFFSET_PX,- })({ placement });- expect(options.padding.top).toBe(TOOLBAR_HEIGHT + PENDING_OFFSET_PX);- expect(options.padding.bottom).toBe(COMPOSER_HEIGHT_PX - PENDING_OFFSET_PX);- });+ test.each(['top', 'top-start'] as const)(+ 'a %s placement absorbs a pending anchor gap by tightening the top inset',+ (placement) => {+ const { editor } = renderEditorInScroller();+ document.documentElement.style.setProperty(+ '--ask-composer-height',+ `${COMPOSER_HEIGHT_PX}px`,+ );+ const options = deriveEditorShiftOptions(editor, {+ pendingOffsetPx: PENDING_OFFSET_PX,+ })({ placement });+ expect(options.padding.top).toBe(TOOLBAR_HEIGHT + PENDING_OFFSET_PX);+ expect(options.padding.bottom).toBe(COMPOSER_HEIGHT_PX - PENDING_OFFSET_PX);+ },+ );- test.each([- 'bottom',- 'bottom-start',- ] as const)('a %s placement mirrors the compensation', (placement) => {- const { editor } = renderEditorInScroller();- document.documentElement.style.setProperty('--ask-composer-height', `${COMPOSER_HEIGHT_PX}px`);- const options = deriveEditorShiftOptions(editor, {- pendingOffsetPx: PENDING_OFFSET_PX,- })({ placement });- expect(options.padding.top).toBe(TOOLBAR_HEIGHT - PENDING_OFFSET_PX);- expect(options.padding.bottom).toBe(COMPOSER_HEIGHT_PX + PENDING_OFFSET_PX);- });+ test.each(['bottom', 'bottom-start'] as const)(+ 'a %s placement mirrors the compensation',+ (placement) => {+ const { editor } = renderEditorInScroller();+ document.documentElement.style.setProperty(+ '--ask-composer-height',+ `${COMPOSER_HEIGHT_PX}px`,+ );+ const options = deriveEditorShiftOptions(editor, {+ pendingOffsetPx: PENDING_OFFSET_PX,+ })({ placement });+ expect(options.padding.top).toBe(TOOLBAR_HEIGHT - PENDING_OFFSET_PX);+ expect(options.padding.bottom).toBe(COMPOSER_HEIGHT_PX + PENDING_OFFSET_PX);+ },+ );- test.each([- 'left',- 'right',- ] as const)('a %s placement needs no compensation — the pending gap is horizontal there', (placement) => {- const { editor } = renderEditorInScroller();- document.documentElement.style.setProperty('--ask-composer-height', `${COMPOSER_HEIGHT_PX}px`);- const options = deriveEditorShiftOptions(editor, {- pendingOffsetPx: PENDING_OFFSET_PX,- })({ placement });- expect(options.padding.top).toBe(TOOLBAR_HEIGHT);- expect(options.padding.bottom).toBe(COMPOSER_HEIGHT_PX);- });+ test.each(['left', 'right'] as const)(+ 'a %s placement needs no compensation — the pending gap is horizontal there',+ (placement) => {+ const { editor } = renderEditorInScroller();+ document.documentElement.style.setProperty(+ '--ask-composer-height',+ `${COMPOSER_HEIGHT_PX}px`,+ );+ const options = deriveEditorShiftOptions(editor, {+ pendingOffsetPx: PENDING_OFFSET_PX,+ })({ placement });+ expect(options.padding.top).toBe(TOOLBAR_HEIGHT);+ expect(options.padding.bottom).toBe(COMPOSER_HEIGHT_PX);+ },+ );test('a top placement with no composer up drives the bottom inset negative', () => {const { editor } = renderEditorInScroller();diff --git a/packages/app/src/env.d.ts b/packages/app/src/env.d.tsindex 6a0eb9b8e..500f40d9e 100644--- a/packages/app/src/env.d.ts+++ b/packages/app/src/env.d.ts@@ -1,5 +1,4 @@/// <reference types="vite/client" />-/// <reference types="bun-types" />interface ImportMetaEnv {/**@@ -35,18 +34,14 @@ declare module 'lucide-react/dist/esm/icons/pin' {}declare namespace globalThis {- import type { HocuspocusProvider } from '@hocuspocus/provider';- import type { Editor } from '@tiptap/core';- import type { GraphNodeVisualState } from '@/components/graph-view-utils';- import type { ProviderPool } from '@/editor/provider-pool';- import type { AcpThreadHarness } from '@/lib/acp/dev-thread-harness';-var __graphHarness:| {clickDoc: (docName: string) => boolean;clickBackground: () => boolean;clickExternal: (url: string) => boolean;- getNodeVisualState: (docName: string) => GraphNodeVisualState | null;+ getNodeVisualState: (+ docName: string,+ ) => import('@/components/graph-view-utils').GraphNodeVisualState | null;getNodeClickPoint: (nodeKey: string) => {x: number;y: number;@@ -69,16 +64,16 @@ declare namespace globalThis {* without an agent process. Tree-shaken from production bundles by the* `import.meta.env.DEV` guard in `AgentThreadClientBinder.tsx`.*/- var __acpThreadHarness: AcpThreadHarness | undefined;- var __providerPool: ProviderPool | undefined;- var __activeProvider: HocuspocusProvider | null;+ var __acpThreadHarness: import('@/lib/acp/dev-thread-harness').AcpThreadHarness | undefined;+ var __providerPool: import('@/editor/provider-pool').ProviderPool | undefined;+ var __activeProvider: import('@hocuspocus/provider').HocuspocusProvider | null;/*** DEV-only: TipTap `Editor` instance of the currently-active pooled doc.* Playwright reads `editor.state.selection` to close the PM-selection-sync* race. Tree-shaken from production* bundles by the `import.meta.env.DEV` guard in `DocumentContext.tsx`.*/- var __activeEditor: Editor | null;+ var __activeEditor: import('@tiptap/core').Editor | null;/*** Test-only hook: force-reject the cached syncPromise for a docName.* Returns true if an entry was rejected, false otherwise.diff --git a/packages/app/src/fontsource.d.ts b/packages/app/src/fontsource.d.tsnew file mode 100644index 000000000..92660ea98--- /dev/null+++ b/packages/app/src/fontsource.d.ts@@ -0,0 +1,2 @@+declare module '@fontsource-variable/inter' {}+declare module '@fontsource-variable/jetbrains-mono' {}diff --git a/packages/app/src/globals.composer-inset-cascade.test.ts b/packages/app/src/globals.composer-inset-cascade.test.tsindex bfeac7514..2a3faa01c 100644--- a/packages/app/src/globals.composer-inset-cascade.test.ts+++ b/packages/app/src/globals.composer-inset-cascade.test.ts@@ -106,44 +106,42 @@ describe('full-page CodeMirror surfaces reserve the Ask AI composer height', ()).toBe(true);});- test.each(- FULL_PAGE_CM_SURFACES,- )('$component reserves the composer height and wins the tie against the reset', ({- component,- hostSelector,- insetKind,- }) => {- const prelude = insetKind === 'content' ? `${hostSelector} .cm-content` : hostSelector;- const insetOffset = composerInsetOffset(css, prelude);- expect(- insetOffset,- `${component} mounts a full-page CodeMirror but no \`${prelude}\` rule in globals.css ` +- `sets \`padding-bottom: ${INSET_VALUE}…)\`. Its last lines sit under the floating Ask AI ` +- 'composer with no way to scroll them clear, which is the bug this registry exists to stop',- ).not.toBeNull();- if (insetKind !== 'content' || insetOffset === null) return;- const resetOffset = Math.max(...ruleOffsets(css, RESET_PRELUDE));- expect(- insetOffset,- `\`${prelude}\` ties \`${RESET_PRELUDE}\` on specificity (0,2,0), so document order breaks ` +- 'the tie. Declared before the reset it loses and the inset silently collapses to 0',- ).toBeGreaterThan(resetOffset);- });-- test.each(FULL_PAGE_CM_SURFACES)('$component reserves exactly one composer height', ({- hostSelector,- }) => {- const insetOffsets = [- composerInsetOffset(css, hostSelector),- composerInsetOffset(css, `${hostSelector} .cm-content`),- ].filter((offset) => offset !== null);- expect(- insetOffsets,- `\`${hostSelector}\` must reserve the composer height on EITHER its host OR its ` +- '`.cm-content`, never both. Zero leaves the last lines under the composer; two reserves ' +- 'double the gap and make the last line float a full card above it',- ).toHaveLength(1);- });+ test.each(FULL_PAGE_CM_SURFACES)(+ '$component reserves the composer height and wins the tie against the reset',+ ({ component, hostSelector, insetKind }) => {+ const prelude = insetKind === 'content' ? `${hostSelector} .cm-content` : hostSelector;+ const insetOffset = composerInsetOffset(css, prelude);+ expect(+ insetOffset,+ `${component} mounts a full-page CodeMirror but no \`${prelude}\` rule in globals.css ` ++ `sets \`padding-bottom: ${INSET_VALUE}…)\`. Its last lines sit under the floating Ask AI ` ++ 'composer with no way to scroll them clear, which is the bug this registry exists to stop',+ ).not.toBeNull();+ if (insetKind !== 'content' || insetOffset === null) return;+ const resetOffset = Math.max(...ruleOffsets(css, RESET_PRELUDE));+ expect(+ insetOffset,+ `\`${prelude}\` ties \`${RESET_PRELUDE}\` on specificity (0,2,0), so document order breaks ` ++ 'the tie. Declared before the reset it loses and the inset silently collapses to 0',+ ).toBeGreaterThan(resetOffset);+ },+ );++ test.each(FULL_PAGE_CM_SURFACES)(+ '$component reserves exactly one composer height',+ ({ hostSelector }) => {+ const insetOffsets = [+ composerInsetOffset(css, hostSelector),+ composerInsetOffset(css, `${hostSelector} .cm-content`),+ ].filter((offset) => offset !== null);+ expect(+ insetOffsets,+ `\`${hostSelector}\` must reserve the composer height on EITHER its host OR its ` ++ '`.cm-content`, never both. Zero leaves the last lines under the composer; two reserves ' ++ 'double the gap and make the last line float a full card above it',+ ).toHaveLength(1);+ },+ );test('no other component mounts a full-page CodeMirror without an entry here', () => {const registered = new Set(diff --git a/packages/app/src/globals.css b/packages/app/src/globals.cssindex f0f85527d..9484241e3 100644--- a/packages/app/src/globals.css+++ b/packages/app/src/globals.css@@ -2401,9 +2401,8 @@* placeholder visible. `:has()` is supported on Chrome 105+, Safari 15.4+,* Firefox 121+; older Firefox sees the pre-fix behavior (placeholder still* visible behind the panel) as graceful degradation. */-.tiptap-editor:has(- .jsx-component-chrome button[data-slot="popover-trigger"][data-state="open"]- ) .ProseMirror+.tiptap-editor:has(.jsx-component-chrome button[data-slot="popover-trigger"][data-state="open"])+ .ProseMirrorp.is-empty::before {content: none;}@@ -4960,7 +4959,8 @@ html.electron-mode [data-slot="sidebar-inner"] {/* `.cm-focused` lands on `.cm-editor` (CM6's wrapper), not on this* outer host div — so the focused-selection rule must nest through it.* Sibling `.ok-prop-codemirror` uses the same nesting at line 3790. */- .ok-codepreview-cm .cm-editor.cm-focused+ .ok-codepreview-cm+ .cm-editor.cm-focused.cm-selectionBackground,.ok-codepreview-cm ::selection {background-color: var(--accent);@@ -5464,8 +5464,7 @@ html.electron-mode [data-slot="sidebar-inner"] {button via the hover rule above. */.jsx-component-wrapper[data-needs-config="true"]:not(:has(.component-children .jsx-component-wrapper:hover)-)-> .jsx-component-chrome {+) > .jsx-component-chrome {opacity: 1;pointer-events: auto;}@@ -5473,7 +5472,8 @@ html.electron-mode [data-slot="sidebar-inner"] {except the properties trigger so the gear is the only affordance shown. */.jsx-component-wrapper[data-needs-config="true"]:not(:hover):not(:has(.component-children .jsx-component-wrapper:hover)- ) > .jsx-component-chrome+ )+ > .jsx-component-chrome> button:not([aria-label*="properties"]) {display: none;}diff --git a/packages/app/src/globals.cv-paint-lock.test.ts b/packages/app/src/globals.cv-paint-lock.test.tsindex 798c3e07f..b3f080c9b 100644--- a/packages/app/src/globals.cv-paint-lock.test.ts+++ b/packages/app/src/globals.cv-paint-lock.test.ts@@ -53,34 +53,36 @@ describe('globals.css content-visibility paint-lock deferral contract', () => {expect(modeHidden?.declarations).toMatch(CV_HIDDEN);});- test.each(- cvHiddenBlocks.map((b) => [b.selector, b] as const),- )('rule %j defers its paint lock via an allow-discrete transition with a positive delay/duration', (_selector, block) => {- const transitions = [...block.declarations.matchAll(/transition[^:;]*:\s*([^;]*)/g)].map(- (m) => m[1],- );- const cvSegment = transitions- .flatMap((value) => splitTopLevelCommas(value))- .find((segment) => /content-visibility/.test(segment));- expect(- cvSegment,- 'a content-visibility: hidden rule must declare a transition segment on content-visibility (defers lock formation to a rendering update)',- ).toBeDefined();- expect(- cvSegment,- 'the content-visibility transition segment must use allow-discrete (discrete properties do not transition otherwise)',- ).toMatch(/allow-discrete/);- expect(- cvSegment,- 'the content-visibility transition segment needs a positive delay or duration — with a combined duration of 0s no transition is created at all (CSS Transitions: starting requires combined duration > 0s), so the lock would form synchronously in the same style recalc',- ).toMatch(POSITIVE_TIME);- });+ test.each(cvHiddenBlocks.map((b) => [b.selector, b] as const))(+ 'rule %j defers its paint lock via an allow-discrete transition with a positive delay/duration',+ (_selector, block) => {+ const transitions = [...block.declarations.matchAll(/transition[^:;]*:\s*([^;]*)/g)].map(+ (m) => m[1],+ );+ const cvSegment = transitions+ .flatMap((value) => splitTopLevelCommas(value))+ .find((segment) => /content-visibility/.test(segment));+ expect(+ cvSegment,+ 'a content-visibility: hidden rule must declare a transition segment on content-visibility (defers lock formation to a rendering update)',+ ).toBeDefined();+ expect(+ cvSegment,+ 'the content-visibility transition segment must use allow-discrete (discrete properties do not transition otherwise)',+ ).toMatch(/allow-discrete/);+ expect(+ cvSegment,+ 'the content-visibility transition segment needs a positive delay or duration — with a combined duration of 0s no transition is created at all (CSS Transitions: starting requires combined duration > 0s), so the lock would form synchronously in the same style recalc',+ ).toMatch(POSITIVE_TIME);+ },+ );- test.each(- cvHiddenBlocks.map((b) => [b.selector, b] as const),- )('rule %j pairs the paint lock with visibility: hidden (non-hit-testable during the deferral window)', (_selector, block) => {- expect(block.declarations).toMatch(BARE_VISIBILITY_HIDDEN);- });+ test.each(cvHiddenBlocks.map((b) => [b.selector, b] as const))(+ 'rule %j pairs the paint lock with visibility: hidden (non-hit-testable during the deferral window)',+ (_selector, block) => {+ expect(block.declarations).toMatch(BARE_VISIBILITY_HIDDEN);+ },+ );test('no content-visibility: hidden under a .ProseMirror scope (PM blocks are live hit-test targets)', () => {const offenders = cvHiddenBlocks.filter((b) => b.selector.includes('.ProseMirror'));diff --git a/packages/app/src/hooks/use-document-stats.dom.test.tsx b/packages/app/src/hooks/use-document-stats.dom.test.tsxindex 81279f60a..b80730976 100644--- a/packages/app/src/hooks/use-document-stats.dom.test.tsx+++ b/packages/app/src/hooks/use-document-stats.dom.test.tsx@@ -28,15 +28,14 @@ describe('useDocumentStats', () => {source: '---\n{"name":"widget"}\n---\n',expected: { words: 1, chars: 26, tokens: 7 },},- ])('$docName counts its literal source instead of interpreting Markdown', async ({- docName,- source,- expected,- }) => {- expect(isEditableTextDocFile(docName)).toBe(true);- const provider = fakeProvider(source, docName);- const { result } = renderHook(() => useDocumentStats(provider, docName));+ ])(+ '$docName counts its literal source instead of interpreting Markdown',+ async ({ docName, source, expected }) => {+ expect(isEditableTextDocFile(docName)).toBe(true);+ const provider = fakeProvider(source, docName);+ const { result } = renderHook(() => useDocumentStats(provider, docName));- await waitFor(() => expect(result.current).toEqual(expected));- });+ await waitFor(() => expect(result.current).toEqual(expected));+ },+ );});diff --git a/packages/app/src/lib/acp/image-attachment.ts b/packages/app/src/lib/acp/image-attachment.tsindex 465d4a10c..48cd152d1 100644--- a/packages/app/src/lib/acp/image-attachment.ts+++ b/packages/app/src/lib/acp/image-attachment.ts@@ -113,7 +113,7 @@ function collectFiles(dataTransfer: DataTransfer | null, accept: (file: File) =>if (items) {for (let i = 0; i < items.length; i += 1) {const it = items[i];- if (!it || it.kind !== 'file') continue;+ if (it?.kind !== 'file') continue;const file = it.getAsFile();if (file === null) continue;itemsYieldedFiles = true;diff --git a/packages/app/src/lib/acp/thread-event-model.codex-notice.test.ts b/packages/app/src/lib/acp/thread-event-model.codex-notice.test.tsindex 8d9c7a9ce..1387ff695 100644--- a/packages/app/src/lib/acp/thread-event-model.codex-notice.test.ts+++ b/packages/app/src/lib/acp/thread-event-model.codex-notice.test.ts@@ -92,21 +92,22 @@ describe('legacy Codex warning classification', () => {expect(agentMessages(model.items)).toHaveLength(1);});- test.each(- fixture.candidates.map((c) => [c.name, c] as const),- )('candidate %s folds to a single verbatim notice', (_name, candidate) => {- const model = buildThreadRenderModel([su(candidate.update)], CODEX);-- expect(notices(model.items)).toEqual([- {- kind: 'agent_notice',- source: 'codex_legacy',- severity: 'warning',- text: candidate.update.content.text,- seq: 0,- },- ]);- });+ test.each(fixture.candidates.map((c) => [c.name, c] as const))(+ 'candidate %s folds to a single verbatim notice',+ (_name, candidate) => {+ const model = buildThreadRenderModel([su(candidate.update)], CODEX);++ expect(notices(model.items)).toEqual([+ {+ kind: 'agent_notice',+ source: 'codex_legacy',+ severity: 'warning',+ text: candidate.update.content.text,+ seq: 0,+ },+ ]);+ },+ );test('a config warning keeps its internal blank lines in one row', () => {const detailed = fixture.candidates.find((c) => c.name === 'config-warning-with-details');@@ -128,19 +129,20 @@ describe('legacy Codex warning classification', () => {expect(notices(model.items)[0].text).toBe(mixed.update.content.text);});- test.each(- fixture.negatives.map((n) => [n.name, n] as const),- )('near miss %s keeps its bytes on the ordinary path', (_name, negative) => {- const agent = agentNamed((negative as { agent?: string }).agent);+ test.each(fixture.negatives.map((n) => [n.name, n] as const))(+ 'near miss %s keeps its bytes on the ordinary path',+ (_name, negative) => {+ const agent = agentNamed((negative as { agent?: string }).agent);- const model = buildThreadRenderModel([su(negative.update)], agent);+ const model = buildThreadRenderModel([su(negative.update)], agent);- expect(notices(model.items)).toHaveLength(0);- const content = (negative.update as { content?: { type?: string; text?: string } }).content;- if (content?.type === 'text' && typeof content.text === 'string') {- expect(messageText(model.items)).toBe(content.text);- }- });+ expect(notices(model.items)).toHaveLength(0);+ const content = (negative.update as { content?: { type?: string; text?: string } }).content;+ if (content?.type === 'text' && typeof content.text === 'string') {+ expect(messageText(model.items)).toBe(content.text);+ }+ },+ );test('an ordinary answer carrying an item id stays prose', () => {const model = buildThreadRenderModel([su(fixture.ordinaryAnswer.update)], CODEX);diff --git a/packages/app/src/lib/acp/thread-event-model.ts b/packages/app/src/lib/acp/thread-event-model.tsindex a2d7535c3..b539a5dac 100644--- a/packages/app/src/lib/acp/thread-event-model.ts+++ b/packages/app/src/lib/acp/thread-event-model.ts@@ -161,7 +161,11 @@ function isSupersededByReady(failure: ThreadFailureDetail | null): boolean {}export class ThreadRenderModelBuilder {- constructor(private readonly agent: CodexLegacyAgentIdentity | null) {}+ private readonly agent: CodexLegacyAgentIdentity | null;++ constructor(agent: CodexLegacyAgentIdentity | null) {+ this.agent = agent;+ }private items: RenderedItem[] = [];private plan: PlanEntry[] = [];diff --git a/packages/app/src/lib/excalidraw-lang.dom.test.ts b/packages/app/src/lib/excalidraw-lang.dom.test.tsindex 36149bfd9..940689d72 100644--- a/packages/app/src/lib/excalidraw-lang.dom.test.ts+++ b/packages/app/src/lib/excalidraw-lang.dom.test.ts@@ -35,14 +35,12 @@ describe('the Excalidraw language mapping', () => {expect(excalidrawLangCode('')).toBe(EXCALIDRAW_FALLBACK_LANG_CODE);});- test.each([- 'toString',- 'constructor',- '__proto__',- 'valueOf',- ])('returns a language code for the inherited key %s rather than something off the prototype', (key) => {- expect(excalidrawLangCode(key)).toBe(EXCALIDRAW_FALLBACK_LANG_CODE);- });+ test.each(['toString', 'constructor', '__proto__', 'valueOf'])(+ 'returns a language code for the inherited key %s rather than something off the prototype',+ (key) => {+ expect(excalidrawLangCode(key)).toBe(EXCALIDRAW_FALLBACK_LANG_CODE);+ },+ );test('keeps the two Chinese scripts on separate catalogs', () => {expect(excalidrawLangCode('zh-Hans')).toBe('zh-CN');diff --git a/packages/app/src/lib/handoff/dispatch.test.ts b/packages/app/src/lib/handoff/dispatch.test.tsindex 4a729c533..8107adcb2 100644--- a/packages/app/src/lib/handoff/dispatch.test.ts+++ b/packages/app/src/lib/handoff/dispatch.test.ts@@ -158,16 +158,14 @@ describe('dispatchHandoff — runtime exhaustiveness guard', () => {expect(result.detail ?? '').toContain('zed');});- test.each([- 'copilot',- 'opencode',- 'pi',- 'antigravity',- ] as const)('terminal-only target %s is refused by the deep-link dispatcher (defensive)', async (target) => {- const result = await dispatchHandoff({ ...BASE_PAYLOAD, target });- expect(result.ok).toBe(false);- if (result.ok) return;- expect(result.reason).toBe('invalid-payload');- expect(result.detail ?? '').toContain('terminal-only');- });+ test.each(['copilot', 'opencode', 'pi', 'antigravity'] as const)(+ 'terminal-only target %s is refused by the deep-link dispatcher (defensive)',+ async (target) => {+ const result = await dispatchHandoff({ ...BASE_PAYLOAD, target });+ expect(result.ok).toBe(false);+ if (result.ok) return;+ expect(result.reason).toBe('invalid-payload');+ expect(result.detail ?? '').toContain('terminal-only');+ },+ );});diff --git a/packages/app/src/lib/install-client-log-forwarder.test.ts b/packages/app/src/lib/install-client-log-forwarder.test.tsindex c06859d7b..682b98d8d 100644--- a/packages/app/src/lib/install-client-log-forwarder.test.ts+++ b/packages/app/src/lib/install-client-log-forwarder.test.ts@@ -75,7 +75,7 @@ function makeFetchSpy() {function bodyOf(spy: ReturnType<typeof makeFetchSpy>): { entries: Array<Record<string, unknown>> } {const call = spy.mock.calls.at(-1);- return JSON.parse((call?.[1] as RequestInit).body as string);+ return JSON.parse((call?.[1] as RequestInit | undefined)?.body as string);}function install(@@ -254,7 +254,7 @@ describe('installClientLogForwarder', () => {const entry = bodyOf(fetchSpy).entries[0];expect(entry?.event).toBe('big-event');expect(entry?.fields).toBeUndefined();- expect((entry?.message as string).length).toBeLessThanOrEqual(8192);+ expect((entry?.message as string | undefined)?.length).toBeLessThanOrEqual(8192);});test('a failed POST is counted and carried as droppedSinceLastFlush on the next batch', async () => {diff --git a/packages/app/src/lib/lru-string-cache.ts b/packages/app/src/lib/lru-string-cache.tsindex c713b01d2..f3c54c7a5 100644--- a/packages/app/src/lib/lru-string-cache.ts+++ b/packages/app/src/lib/lru-string-cache.ts@@ -1,7 +1,10 @@export class LruStringCache {private readonly map = new Map<string, string>();- constructor(private readonly limit: number) {+ private readonly limit: number;++ constructor(limit: number) {+ this.limit = limit;if (limit <= 0) {throw new Error(`LruStringCache: limit must be > 0 (got ${limit})`);}diff --git a/packages/app/src/lib/terminal-placement-store.test.ts b/packages/app/src/lib/terminal-placement-store.test.tsindex 92e0ca02b..cbd2c40f4 100644--- a/packages/app/src/lib/terminal-placement-store.test.ts+++ b/packages/app/src/lib/terminal-placement-store.test.ts@@ -32,12 +32,11 @@ describe('terminal placement persistence', () => {expect(readTerminalPlacement(storage)).toBe(placement);});- test.each([- '',- 'sideways',- '{"placement":"right"}',- ])('defaults malformed or unsupported value %j to bottom', (value) => {- const storage = memoryStorage({ [TERMINAL_PLACEMENT_KEY]: value });- expect(readTerminalPlacement(storage)).toBe('bottom');- });+ test.each(['', 'sideways', '{"placement":"right"}'])(+ 'defaults malformed or unsupported value %j to bottom',+ (value) => {+ const storage = memoryStorage({ [TERMINAL_PLACEMENT_KEY]: value });+ expect(readTerminalPlacement(storage)).toBe('bottom');+ },+ );});diff --git a/packages/app/tests/dom/frontmatter-dialects-client-realm.dom.test.tsx b/packages/app/tests/dom/frontmatter-dialects-client-realm.dom.test.tsxindex fc6e0f81c..875338b94 100644--- a/packages/app/tests/dom/frontmatter-dialects-client-realm.dom.test.tsx+++ b/packages/app/tests/dom/frontmatter-dialects-client-realm.dom.test.tsx@@ -87,16 +87,16 @@ describe('frontmatter dialects in the client realm', () => {).toBe('dependentRequired,pattern');});- test.each([- 'http://json-schema.org/draft-06/schema#',- 'http://json-schema.org/draft-07/schema#',- ])('%s still validates client-side', async ($schema) => {- expect(- await mountAndReadCodes('---\nweight: 5\n---\n', {- $schema,- type: 'object',- properties: { weight: { type: 'number', exclusiveMinimum: 5 } },- }),- ).toBe('exclusiveMinimum');- });+ test.each(['http://json-schema.org/draft-06/schema#', 'http://json-schema.org/draft-07/schema#'])(+ '%s still validates client-side',+ async ($schema) => {+ expect(+ await mountAndReadCodes('---\nweight: 5\n---\n', {+ $schema,+ type: 'object',+ properties: { weight: { type: 'number', exclusiveMinimum: 5 } },+ }),+ ).toBe('exclusiveMinimum');+ },+ );});diff --git a/packages/app/tests/dom/input-rule-atom-ranges.dom.test.tsx b/packages/app/tests/dom/input-rule-atom-ranges.dom.test.tsxindex f81d64a77..6a9167f6a 100644--- a/packages/app/tests/dom/input-rule-atom-ranges.dom.test.tsx+++ b/packages/app/tests/dom/input-rule-atom-ranges.dom.test.tsx@@ -92,25 +92,26 @@ describe('a completion keystroke whose match window spans an inline object', ()expect(unmarked, 'every leaf of the delimited span carries strong').toEqual([]);});- test.each(- INLINE_OBJECT_NAMES,- )('leaves preceding text untouched when the range stays positive (%s)', (name) => {- const editor = mountEditor();- const object = inlineObject(editor, name, 'x');- expect(object).not.toBeNull();- const lead = `${'lorem ipsum dolor sit amet '.repeat(2)}**see `;- seedParagraph(editor, lead, object as PMNode, ' here*');+ test.each(INLINE_OBJECT_NAMES)(+ 'leaves preceding text untouched when the range stays positive (%s)',+ (name) => {+ const editor = mountEditor();+ const object = inlineObject(editor, name, 'x');+ expect(object).not.toBeNull();+ const lead = `${'lorem ipsum dolor sit amet '.repeat(2)}**see `;+ seedParagraph(editor, lead, object as PMNode, ' here*');- expect(() => typeCharacter(editor, '*')).not.toThrow();+ expect(() => typeCharacter(editor, '*')).not.toThrow();- const text = editor.state.doc.firstChild?.textContent ?? '';- expect(text.startsWith('lorem ipsum dolor sit amet '.repeat(2))).toBe(true);- expect(text).not.toContain('*');- const strong = editor.schema.marks.strong;- expect(strong).toBeDefined();- const leadEnd = 1 + 'lorem ipsum dolor sit amet '.repeat(2).length;- expect(editor.state.doc.rangeHasMark(1, leadEnd, strong as MarkType)).toBe(false);- });+ const text = editor.state.doc.firstChild?.textContent ?? '';+ expect(text.startsWith('lorem ipsum dolor sit amet '.repeat(2))).toBe(true);+ expect(text).not.toContain('*');+ const strong = editor.schema.marks.strong;+ expect(strong).toBeDefined();+ const leadEnd = 1 + 'lorem ipsum dolor sit amet '.repeat(2).length;+ expect(editor.state.doc.rangeHasMark(1, leadEnd, strong as MarkType)).toBe(false);+ },+ );test('a node with children is faithful regardless of how much it holds', () => {for (const body of ['a', 'ab', 'abc', '<Foo bar="baz" />']) {diff --git a/packages/app/tests/dom/literal-text-suggestion-gating.dom.test.tsx b/packages/app/tests/dom/literal-text-suggestion-gating.dom.test.tsxindex cdb3bc0a8..694689f57 100644--- a/packages/app/tests/dom/literal-text-suggestion-gating.dom.test.tsx+++ b/packages/app/tests/dom/literal-text-suggestion-gating.dom.test.tsx@@ -34,7 +34,7 @@ const TRIGGERS: Trigger[] = [{ keyPrefix: 'slashCommand', typed: 'x /head', literal: '/head' },];-const ENTER: KeyboardEventInit & { key: string } = { key: 'Enter', code: 'Enter', keyCode: 13 };+const ENTER: KeyboardEventInit & { key: string } = { key: 'Enter', code: 'Enter' };function mountEditor(context: Context): { editor: Editor; container: HTMLDivElement } {const container = document.createElement('div');@@ -194,12 +194,13 @@ describe('Suggestion plugins refuse inside literal text (byte-preservation contr}});- test('still activates in a plain paragraph', async () => {+ test('still activates in a plain paragraph and consumes Enter', async () => {const { editor, container } = mountEditor('paragraph');try {typeChars(editor, typed);await flush();expect(getSuggestionState(editor, keyPrefix)?.active).toBe(true);+ expect(pressEnter(editor)).toBe(true);} finally {teardown(editor, container);}diff --git a/packages/app/tests/dom/select-all-probe.dom.test.ts b/packages/app/tests/dom/select-all-probe.dom.test.tsindex 14c3572fc..735453658 100644--- a/packages/app/tests/dom/select-all-probe.dom.test.ts+++ b/packages/app/tests/dom/select-all-probe.dom.test.ts@@ -50,15 +50,13 @@ describe('select-all probe view classification', () => {{ outcome: 'partial', from: 3, to: 12, length: 12 },{ outcome: 'empty', from: 4, to: 4, length: 12 },{ outcome: 'unreadable', from: 0, to: undefined, length: 12 },- ])('CodeMirror $from-$to over a $length-character document reads $outcome', ({- outcome,- from,- to,- length,- }) => {- mountCodeMirror({ from, to }, length);- expect(repairFocusAndReadProbe(SOURCE_CONTENT_SELECTOR).viewSelection).toBe(outcome);- });+ ])(+ 'CodeMirror $from-$to over a $length-character document reads $outcome',+ ({ outcome, from, to, length }) => {+ mountCodeMirror({ from, to }, length);+ expect(repairFocusAndReadProbe(SOURCE_CONTENT_SELECTOR).viewSelection).toBe(outcome);+ },+ );test('CodeMirror is reached through the cmView handle when cmTile is absent', () => {mountCodeMirror({ from: 0, to: 9 }, 9, 'cmView');@@ -77,15 +75,13 @@ describe('select-all probe view classification', () => {{ outcome: 'partial', from: 4, to: 14, size: 14 },{ outcome: 'empty', from: 3, to: 3, size: 14 },{ outcome: 'unreadable', from: 0, to: undefined, size: 14 },- ])('ProseMirror $from-$to over a size-$size document reads $outcome', ({- outcome,- from,- to,- size,- }) => {- mountProseMirror({ from, to }, size);- expect(repairFocusAndReadProbe(WYSIWYG_SELECTOR).viewSelection).toBe(outcome);- });+ ])(+ 'ProseMirror $from-$to over a size-$size document reads $outcome',+ ({ outcome, from, to, size }) => {+ mountProseMirror({ from, to }, size);+ expect(repairFocusAndReadProbe(WYSIWYG_SELECTOR).viewSelection).toBe(outcome);+ },+ );test('a ProseMirror view whose dom is a different element falls through to the CodeMirror branch', () => {mountProseMirror({ from: 0, to: 14 }, 14);diff --git a/packages/app/tests/dom/task-list-input-rule.dom.test.tsx b/packages/app/tests/dom/task-list-input-rule.dom.test.tsxindex e01856aac..6bf2e75ff 100644--- a/packages/app/tests/dom/task-list-input-rule.dom.test.tsx+++ b/packages/app/tests/dom/task-list-input-rule.dom.test.tsx@@ -162,35 +162,35 @@ describe('task list input rules', () => {});});- test.each([- '- ',- '[x] ',- ])('Backspace right after %j dissolves the wrapped item back to a paragraph', (typed) => {- const editor = mountEditor();- type(editor, typed);- expect(firstListItem(editor)).not.toBeNull();+ test.each(['- ', '[x] '])(+ 'Backspace right after %j dissolves the wrapped item back to a paragraph',+ (typed) => {+ const editor = mountEditor();+ type(editor, typed);+ expect(firstListItem(editor)).not.toBeNull();- const { handled } = pressEditorKey(editor, 'Backspace');+ const { handled } = pressEditorKey(editor, 'Backspace');- expect(handled).toBe(true);- expect(firstListItem(editor)).toBeNull();- expect(editor.state.doc.firstChild?.type.name).toBe('paragraph');- });+ expect(handled).toBe(true);+ expect(firstListItem(editor)).toBeNull();+ expect(editor.state.doc.firstChild?.type.name).toBe('paragraph');+ },+ );- test.each([- '- [x] ',- '- [ ] ',- ])('Backspace right after %j un-ticks the item but leaves the bullet', (typed) => {- const editor = mountEditor();- type(editor, typed);- expect(firstListItem(editor)?.attrs.checked).not.toBeNull();+ test.each(['- [x] ', '- [ ] '])(+ 'Backspace right after %j un-ticks the item but leaves the bullet',+ (typed) => {+ const editor = mountEditor();+ type(editor, typed);+ expect(firstListItem(editor)?.attrs.checked).not.toBeNull();- const { handled } = pressEditorKey(editor, 'Backspace');+ const { handled } = pressEditorKey(editor, 'Backspace');- expect(handled).toBe(true);- expect(firstListItem(editor)?.attrs.checked).toBeNull();- expect(textOf(editor)).toBe(typed.slice(2));- expect(editor.state.doc.firstChild?.type.name).toBe('list');- expect(pressEditorKey(editor, 'Backspace').handled).toBe(false);- });+ expect(handled).toBe(true);+ expect(firstListItem(editor)?.attrs.checked).toBeNull();+ expect(textOf(editor)).toBe(typed.slice(2));+ expect(editor.state.doc.firstChild?.type.name).toBe('list');+ expect(pressEditorKey(editor, 'Backspace').handled).toBe(false);+ },+ );});diff --git a/packages/app/tests/integration/advisory-warnings.test.ts b/packages/app/tests/integration/advisory-warnings.test.tsindex 75c6477f0..c3ffa9a2a 100644--- a/packages/app/tests/integration/advisory-warnings.test.ts+++ b/packages/app/tests/integration/advisory-warnings.test.ts@@ -15,7 +15,6 @@ afterAll(async () => {interface WriteResponse {timestamp?: string;- warning?: { kind?: string };warnings?: AdvisoryWarning[];[key: string]: unknown;}@@ -103,7 +102,7 @@ describe('advisory warnings on POST /api/agent-write-md', () => {});describe('advisory warnings on POST /api/frontmatter-patch', () => {- test('a reconciled out-of-band edit reaches warnings[] alongside the deprecated slot', async () => {+ test('a reconciled out-of-band edit reaches warnings[]', async () => {const { writeFileSync } = await import('node:fs');const { join } = await import('node:path');const docName = uniqueDoc('rw-fm');@@ -125,8 +124,8 @@ describe('advisory warnings on POST /api/frontmatter-patch', () => {});expect(res.status).toBe(200);const body = (await res.json()) as WriteResponse;- expect(body.warning?.kind).toBe('disk-edit-reconciled');expect(body.warnings?.map((w) => w.kind)).toEqual(['disk-edit-reconciled']);+ expect(body.warning).toBeUndefined();});});@@ -154,7 +153,7 @@ describe('advisory co-occurrence (the unification win: no masking)', () => {expect(status).toBe(200);const kinds = (body.warnings ?? []).map((w) => w.kind).sort();expect(kinds).toEqual(['disk-edit-reconciled', 'mermaid-parse-error']);- expect(body.warning?.kind).toBe('disk-edit-reconciled');+ expect(body.warning).toBeUndefined();});});diff --git a/packages/app/tests/integration/api-error-envelope/upload-filename-reference-resolution.test.ts b/packages/app/tests/integration/api-error-envelope/upload-filename-reference-resolution.test.tsindex eb51f6587..ce437756a 100644--- a/packages/app/tests/integration/api-error-envelope/upload-filename-reference-resolution.test.ts+++ b/packages/app/tests/integration/api-error-envelope/upload-filename-reference-resolution.test.ts@@ -96,23 +96,32 @@ describe('uploaded asset names, from the wire to the reader', () => {test.each([['nnbsp', SENT, EXPECTED],['cjk', CJK, CJK],- ])('the in-process transport decodes identically to the socket: %s', async (id, sent, expected) => {- const dir = seedDir(`localapi-${id}`);-- const form = new FormData();- form.append('parentDocName', `docs/localapi-${id}/guide.md`);- form.append('file', new Blob([pngFixture()]), sent);- const encoded = new Request('http://localhost/api/upload', { method: 'POST', body: form });- const contentType = encoded.headers.get('content-type') ?? 'multipart/form-data';- const bytes = new Uint8Array(await encoded.arrayBuffer());-- const out = await server.instance.localApi('POST', '/api/upload', { body: bytes, contentType });- expect(out, 'localApi returned null - /api/upload left the dispatch allowlist').not.toBeNull();- expect(out?.status, out?.bodyText).toBe(200);-- const parsed = JSON.parse(out?.bodyText ?? '{}') as { src: string; deduped: boolean };- expect(parsed.deduped).toBe(false);- expect(hexOf(parsed.src), `sent ${hexOf(sent)} -> got "${parsed.src}"`).toBe(hexOf(expected));- expect(existsSync(join(dir, parsed.src))).toBe(true);- });+ ])(+ 'the in-process transport decodes identically to the socket: %s',+ async (id, sent, expected) => {+ const dir = seedDir(`localapi-${id}`);++ const form = new FormData();+ form.append('parentDocName', `docs/localapi-${id}/guide.md`);+ form.append('file', new Blob([pngFixture()]), sent);+ const encoded = new Request('http://localhost/api/upload', { method: 'POST', body: form });+ const contentType = encoded.headers.get('content-type') ?? 'multipart/form-data';+ const bytes = new Uint8Array(await encoded.arrayBuffer());++ const out = await server.instance.localApi('POST', '/api/upload', {+ body: bytes,+ contentType,+ });+ expect(+ out,+ 'localApi returned null - /api/upload left the dispatch allowlist',+ ).not.toBeNull();+ expect(out?.status, out?.bodyText).toBe(200);++ const parsed = JSON.parse(out?.bodyText ?? '{}') as { src: string; deduped: boolean };+ expect(parsed.deduped).toBe(false);+ expect(hexOf(parsed.src), `sent ${hexOf(sent)} -> got "${parsed.src}"`).toBe(hexOf(expected));+ expect(existsSync(join(dir, parsed.src))).toBe(true);+ },+ );});diff --git a/packages/app/tests/integration/disk-authority-reconcile.test.ts b/packages/app/tests/integration/disk-authority-reconcile.test.tsindex f1fd72509..28d42b50f 100644--- a/packages/app/tests/integration/disk-authority-reconcile.test.ts+++ b/packages/app/tests/integration/disk-authority-reconcile.test.ts@@ -61,11 +61,11 @@ describe('PRD-6832 β L1: agent write reconciles a newer out-of-band disk edit',});expect(res.status).toBe(200);const body = (await res.json()) as {- warning?: { kind?: string };+ warning?: unknown;warnings?: Array<{ kind?: string }>;};- expect(body.warning?.kind).toBe('disk-edit-reconciled');expect(body.warnings?.map((w) => w.kind)).toEqual(['disk-edit-reconciled']);+ expect(body.warning).toBeUndefined();const after = readTestDoc(contentDir, docName);expect(after).toContain('body-v2-native');@@ -142,10 +142,12 @@ describe('PRD-6832 β L1: agent write reconciles a newer out-of-band disk edit',});expect(res.status).toBe(200);const body = (await res.json()) as {- warning?: { kind?: string; mergeOutcome?: string };+ warning?: unknown;+ warnings?: Array<{ kind?: string; mergeOutcome?: string }>;};- expect(body.warning?.kind).toBe('disk-edit-reconciled');- expect(body.warning?.mergeOutcome).toBe('merged');+ const reconciled = body.warnings?.find((w) => w.kind === 'disk-edit-reconciled');+ expect(reconciled?.mergeOutcome).toBe('merged');+ expect(body.warning).toBeUndefined();await pollUntil(() => serverYtext().includes('agent-line'));expect(serverYtext()).toContain('disk-oob-line');@@ -198,7 +200,11 @@ describe('PRD-6832 β L1: agent write reconciles a newer out-of-band disk edit',body: JSON.stringify({ docName, markdown: 'agent-line\n', position: 'append' }),});expect(res.status).toBe(200);- const body = (await res.json()) as { warning?: { kind?: string } };+ const body = (await res.json()) as {+ warning?: unknown;+ warnings?: Array<{ kind?: string }>;+ };+ expect(body.warnings?.some((w) => w.kind === 'disk-edit-reconciled')).not.toBe(true);expect(body.warning).toBeUndefined();await pollUntil(() => serverYtext().includes('agent-line'));diff --git a/packages/app/tests/integration/hook-timeout-stop-rules.test.ts b/packages/app/tests/integration/hook-timeout-stop-rules.test.tsindex f611d5943..3c41cdd2c 100644--- a/packages/app/tests/integration/hook-timeout-stop-rules.test.ts+++ b/packages/app/tests/integration/hook-timeout-stop-rules.test.ts@@ -1,6 +1,6 @@import { type Dirent, readdirSync, readFileSync } from 'node:fs';import { join, relative } from 'node:path';-import ts from 'typescript';+import { ts } from 'ts-morph';import { describe, expect, test } from 'vitest';const REPO_ROOT = join(import.meta.dirname, '..', '..', '..', '..');diff --git a/packages/app/tests/integration/kill-gracefully-errno.test.ts b/packages/app/tests/integration/kill-gracefully-errno.test.tsindex f57bf9a85..7dd019133 100644--- a/packages/app/tests/integration/kill-gracefully-errno.test.ts+++ b/packages/app/tests/integration/kill-gracefully-errno.test.ts@@ -67,30 +67,25 @@ describe('killGroup errno policy', () => {expect(String(warn.mock.calls[0]?.[0])).toContain('EPERM');});- test.each([- 'EACCES',- 'EINVAL',- 'ENOSYS',- undefined,- ])('rethrows %s rather than hiding it', (code) => {- const err = code === undefined ? new Error('not an errno at all') : errnoError(code);- vi.spyOn(process, 'kill').mockImplementation(() => {- throw err;- });- expect(() => killGroup(9_001, 'SIGTERM')).toThrow(err);- });-- test.each([- 0,- 1,- -5,- 1.5,- Number.NaN,- ])('refuses pid %p instead of signalling our own process group', (pid) => {- const kill = vi.spyOn(process, 'kill').mockReturnValue(true);- expect(killGroup(pid, 'SIGKILL')).toBe(false);- expect(kill).not.toHaveBeenCalled();- });+ test.each(['EACCES', 'EINVAL', 'ENOSYS', undefined])(+ 'rethrows %s rather than hiding it',+ (code) => {+ const err = code === undefined ? new Error('not an errno at all') : errnoError(code);+ vi.spyOn(process, 'kill').mockImplementation(() => {+ throw err;+ });+ expect(() => killGroup(9_001, 'SIGTERM')).toThrow(err);+ },+ );++ test.each([0, 1, -5, 1.5, Number.NaN])(+ 'refuses pid %p instead of signalling our own process group',+ (pid) => {+ const kill = vi.spyOn(process, 'kill').mockReturnValue(true);+ expect(killGroup(pid, 'SIGKILL')).toBe(false);+ expect(kill).not.toHaveBeenCalled();+ },+ );});describe('signalTree errno policy', () => {diff --git a/packages/app/tests/integration/lint-fix-relint-failure.test.ts b/packages/app/tests/integration/lint-fix-relint-failure.test.tsnew file mode 100644index 000000000..9b9271c82--- /dev/null+++ b/packages/app/tests/integration/lint-fix-relint-failure.test.ts@@ -0,0 +1,224 @@+import { mkdirSync, readFileSync, rmSync, writeFileSync } from 'node:fs';+import { join } from 'node:path';+import {+ isReLintFailedWarning,+ type LintFixResult,+ LintFixResultSchema,+} from '@inkeep/open-knowledge-core';+import { afterAll, beforeAll, describe, expect, test, vi } from 'vitest';+import { HARNESS_BOOT_TIMEOUT_MS } from './harness-boot-timeout';+import { createTestServer, type TestServer } from './test-harness.ts';++const postFixLintFault = vi.hoisted(() => ({ active: false, calls: 0 }));+const postFixSourceFault = vi.hoisted(() => ({ active: false, calls: 0 }));+const postFixEmptyMessageFault = vi.hoisted(() => ({ active: false, calls: 0 }));+const preFixSourceFault = vi.hoisted(() => ({ active: false, calls: 0 }));++vi.mock('@inkeep/open-knowledge-core', async (importOriginal) => {+ const actual = await importOriginal<typeof import('@inkeep/open-knowledge-core')>();+ return {+ ...actual,+ lintDocument: (...args: Parameters<typeof actual.lintDocument>) => {+ const [source] = args;+ if (postFixLintFault.active && !source.includes('\t')) {+ postFixLintFault.calls += 1;+ throw new Error('re-lint exploded');+ }+ if (postFixEmptyMessageFault.active && !source.includes('\t')) {+ postFixEmptyMessageFault.calls += 1;+ throw new Error('');+ }+ if (preFixSourceFault.active) {+ const report = args[3] as ((failure: unknown) => void) | undefined;+ const at = { start: { line: 0, character: 0 }, end: { line: 0, character: 1 } };+ if (source.includes('\t')) {+ preFixSourceFault.calls += 1;+ report?.({+ source: 'markdownlint',+ phase: 'lint',+ message: 'source exploded on the pre-fix text',+ });+ return [+ { range: at, severity: 'warning', source: 'okf', code: 'OKF001', message: 'one' },+ { range: at, severity: 'warning', source: 'okf', code: 'OKF002', message: 'two' },+ ];+ }+ return [+ {+ range: at,+ severity: 'warning',+ source: 'markdownlint',+ code: 'MD012',+ message: 'late',+ },+ ];+ }+ if (postFixSourceFault.active && !source.includes('\t')) {+ postFixSourceFault.calls += 1;+ const report = args[3] as ((failure: unknown) => void) | undefined;+ report?.({+ source: 'markdownlint',+ phase: 'lint',+ message: 'source exploded on the post-fix text',+ });+ return [];+ }+ return actual.lintDocument(...args);+ },+ };+});++let server: TestServer;++beforeAll(async () => {+ server = await createTestServer({ markdownlintEnabled: true });+}, HARNESS_BOOT_TIMEOUT_MS);++afterAll(async () => {+ await server.cleanup();+});++const TABBED_BODY = '# Doc\n\n\tindented with a hard tab\n';++describe('POST /api/lint/fix when the post-write re-lint throws', () => {+ test('the durable fix is reported through diagnosticsArePreFix and reLintFailure, with no singular warning field and no prefixed warnings entry', async () => {+ const folder = join(server.contentDir, 'lint-fix-relint');+ mkdirSync(folder, { recursive: true });+ const file = join(folder, 'tabbed.md');+ writeFileSync(file, TABBED_BODY, 'utf-8');+ const warn = vi.spyOn(console, 'warn').mockImplementation(() => {});+ postFixLintFault.active = true;+ postFixLintFault.calls = 0;+ try {+ const res = await fetch(`http://127.0.0.1:${server.port}/api/lint/fix`, {+ method: 'POST',+ headers: { 'Content-Type': 'application/json' },+ body: JSON.stringify({ docName: 'lint-fix-relint/tabbed', agentId: 'relint-fault-agent' }),+ });+ expect(res.status).toBe(200);+ const raw = (await res.json()) as Record<string, unknown>;+ expect(raw).not.toHaveProperty('warning');+ const body: LintFixResult = LintFixResultSchema.parse(raw);++ expect(postFixLintFault.calls).toBeGreaterThan(0);+ expect((body.warnings ?? []).filter(isReLintFailedWarning)).toEqual([]);+ expect(body.reLintFailure).toEqual({+ reason: 're-lint-threw',+ message: 're-lint exploded',+ });+ expect(body.diagnosticsArePreFix).toBe(true);++ expect(body.diagnostics.map((d) => d.code)).toEqual(['MD010']);+ expect(body.fixedCount).toBe(0);+ expect(readFileSync(file, 'utf-8')).not.toContain('\t');+ } finally {+ postFixLintFault.active = false;+ warn.mockRestore();+ rmSync(folder, { recursive: true, force: true });+ }+ });+});++describe('POST /api/lint/fix when a source lints before the fix and fails after it', () => {+ test('reports the pre-fix diagnostics rather than counting the lost ones as fixed', async () => {+ const folder = join(server.contentDir, 'lint-fix-relint-blind');+ mkdirSync(folder, { recursive: true });+ const file = join(folder, 'tabbed.md');+ writeFileSync(file, TABBED_BODY, 'utf-8');+ const warn = vi.spyOn(console, 'warn').mockImplementation(() => {});+ postFixSourceFault.active = true;+ postFixSourceFault.calls = 0;+ try {+ const res = await fetch(`http://127.0.0.1:${server.port}/api/lint/fix`, {+ method: 'POST',+ headers: { 'Content-Type': 'application/json' },+ body: JSON.stringify({+ docName: 'lint-fix-relint-blind/tabbed',+ agentId: 'relint-blind-agent',+ }),+ });+ expect(res.status).toBe(200);+ const body: LintFixResult = LintFixResultSchema.parse(await res.json());++ expect(postFixSourceFault.calls).toBeGreaterThan(0);+ expect(body.diagnosticsArePreFix).toBe(true);+ expect(body.fixedCount).toBe(0);+ expect(body.diagnostics.map((d) => d.code)).toEqual(['MD010']);+ expect((body.warnings ?? []).filter(isReLintFailedWarning)).toEqual([]);+ expect(body.reLintFailure?.reason).toBe('source-went-blind');+ expect(body.reLintFailure?.message).toContain('markdownlint');+ } finally {+ postFixSourceFault.active = false;+ warn.mockRestore();+ rmSync(folder, { recursive: true, force: true });+ }+ });+});++describe('POST /api/lint/fix when the post-write re-lint throws with an EMPTY message', () => {+ test('still marks the diagnostics pre-fix and carries a non-empty message', async () => {+ const folder = join(server.contentDir, 'lint-fix-relint-empty');+ mkdirSync(folder, { recursive: true });+ writeFileSync(join(folder, 'tabbed.md'), TABBED_BODY, 'utf-8');+ const warn = vi.spyOn(console, 'warn').mockImplementation(() => {});+ postFixEmptyMessageFault.active = true;+ postFixEmptyMessageFault.calls = 0;+ try {+ const res = await fetch(`http://127.0.0.1:${server.port}/api/lint/fix`, {+ method: 'POST',+ headers: { 'Content-Type': 'application/json' },+ body: JSON.stringify({+ docName: 'lint-fix-relint-empty/tabbed',+ agentId: 'relint-empty-agent',+ }),+ });+ expect(res.status).toBe(200);+ const body: LintFixResult = LintFixResultSchema.parse(await res.json());+ expect(postFixEmptyMessageFault.calls).toBeGreaterThan(0);+ expect(body.diagnosticsArePreFix).toBe(true);+ expect(body.reLintFailure?.reason).toBe('re-lint-threw');+ expect(body.reLintFailure?.message.length ?? 0).toBeGreaterThan(0);+ expect(body.fixedCount).toBe(0);+ } finally {+ postFixEmptyMessageFault.active = false;+ warn.mockRestore();+ rmSync(folder, { recursive: true, force: true });+ }+ });+});++describe('POST /api/lint/fix when a source is blind BEFORE the fix and recovers after it', () => {+ test('excludes the recovered source from the comparison rather than cancelling real repairs', async () => {+ const folder = join(server.contentDir, 'lint-fix-prelint-blind');+ mkdirSync(folder, { recursive: true });+ const file = join(folder, 'tabbed.md');+ writeFileSync(file, TABBED_BODY, 'utf-8');+ const warn = vi.spyOn(console, 'warn').mockImplementation(() => {});+ preFixSourceFault.active = true;+ preFixSourceFault.calls = 0;+ try {+ const res = await fetch(`http://127.0.0.1:${server.port}/api/lint/fix`, {+ method: 'POST',+ headers: { 'Content-Type': 'application/json' },+ body: JSON.stringify({+ docName: 'lint-fix-prelint-blind/tabbed',+ agentId: 'prelint-blind-agent',+ }),+ });+ expect(res.status).toBe(200);+ const body: LintFixResult = LintFixResultSchema.parse(await res.json());++ expect(preFixSourceFault.calls).toBeGreaterThan(0);+ expect(body.diagnosticsArePreFix).toBeUndefined();+ expect(body.reLintFailure).toBeUndefined();+ expect(body.diagnostics.map((d) => d.source)).toEqual(['markdownlint']);+ expect(body.fixedCount).toBe(2);+ expect((body.warnings ?? []).join(' ')).toContain('markdownlint');+ expect((body.warnings ?? []).filter(isReLintFailedWarning)).toEqual([]);+ } finally {+ preFixSourceFault.active = false;+ warn.mockRestore();+ rmSync(folder, { recursive: true, force: true });+ }+ });+});diff --git a/packages/app/tests/integration/network-control.ts b/packages/app/tests/integration/network-control.tsindex f390d58ed..653a94886 100644--- a/packages/app/tests/integration/network-control.ts+++ b/packages/app/tests/integration/network-control.ts@@ -97,7 +97,7 @@ export class ControllableWebSocket {this.onMessageHandler = handler as MessageCallback | null;}- send(data: string | ArrayBufferLike | Blob | ArrayBufferView): void {+ send(data: Parameters<WebSocket['send']>[0]): void {if (this.droppingOutbound) return;this.inner.send(data);}diff --git a/packages/app/tests/integration/teardown-fs-errno.test.ts b/packages/app/tests/integration/teardown-fs-errno.test.tsindex b00d1cc1f..eb0bd1668 100644--- a/packages/app/tests/integration/teardown-fs-errno.test.ts+++ b/packages/app/tests/integration/teardown-fs-errno.test.ts@@ -53,25 +53,23 @@ describe('removeAllDuringTeardown removal policy', () => {expect(options?.maxRetries).toBeGreaterThan(0);});- test.each([- 'EBUSY',- 'ENOTEMPTY',- 'EPERM',- ])('tolerates %s rather than failing a run whose tests have all passed', (code) => {- rmFailingOn('/tmp/busy', errnoError(code));- expect(() => removeAllDuringTeardown('/tmp/busy')).not.toThrow();- });-- test.each([- 'EBUSY',- 'ENOTEMPTY',- 'EPERM',- ])('still reclaims the remaining targets after a tolerated %s', (code) => {- rmFailingOn('/tmp/busy', errnoError(code));- removeAllDuringTeardown('/tmp/busy', '/tmp/second', '/tmp/third');- expect(mockedRm).toHaveBeenCalledWith('/tmp/second', expect.anything());- expect(mockedRm).toHaveBeenCalledWith('/tmp/third', expect.anything());- });+ test.each(['EBUSY', 'ENOTEMPTY', 'EPERM'])(+ 'tolerates %s rather than failing a run whose tests have all passed',+ (code) => {+ rmFailingOn('/tmp/busy', errnoError(code));+ expect(() => removeAllDuringTeardown('/tmp/busy')).not.toThrow();+ },+ );++ test.each(['EBUSY', 'ENOTEMPTY', 'EPERM'])(+ 'still reclaims the remaining targets after a tolerated %s',+ (code) => {+ rmFailingOn('/tmp/busy', errnoError(code));+ removeAllDuringTeardown('/tmp/busy', '/tmp/second', '/tmp/third');+ expect(mockedRm).toHaveBeenCalledWith('/tmp/second', expect.anything());+ expect(mockedRm).toHaveBeenCalledWith('/tmp/third', expect.anything());+ },+ );test('warns on a tolerated failure so a genuinely leaked directory leaves a trace', () => {rmFailingOn('/tmp/busy', errnoError('EBUSY'));@@ -81,20 +79,16 @@ describe('removeAllDuringTeardown removal policy', () => {expect(String(warn.mock.calls[0]?.[0])).toContain('/tmp/busy');});- test.each([- 'EMFILE',- 'ENFILE',- 'EACCES',- 'ENOTDIR',- 'EINVAL',- undefined,- ])('rethrows %s rather than hiding it', (code) => {- const err = code === undefined ? new Error('not an errno at all') : errnoError(code);- mockedRm.mockImplementation(() => {- throw err;- });- expect(() => removeAllDuringTeardown('/tmp/a')).toThrow(err);- });+ test.each(['EMFILE', 'ENFILE', 'EACCES', 'ENOTDIR', 'EINVAL', undefined])(+ 'rethrows %s rather than hiding it',+ (code) => {+ const err = code === undefined ? new Error('not an errno at all') : errnoError(code);+ mockedRm.mockImplementation(() => {+ throw err;+ });+ expect(() => removeAllDuringTeardown('/tmp/a')).toThrow(err);+ },+ );test('reclaims every remaining target before rethrowing an untolerated errno', () => {const err = errnoError('EMFILE');diff --git a/packages/app/tests/integration/undo-recycle-reset.test.ts b/packages/app/tests/integration/undo-recycle-reset.test.tsindex be1a29fbc..b076f955c 100644--- a/packages/app/tests/integration/undo-recycle-reset.test.ts+++ b/packages/app/tests/integration/undo-recycle-reset.test.ts@@ -104,7 +104,7 @@ async function bootRig(): Promise<Rig> {await pollUntil(() => pool.getActive()?.provider.isSynced === true, 15_000, 50);const entry = pool.getActive();- if (!entry || entry.kind !== 'active') throw new Error('no active entry after sync');+ if (entry?.kind !== 'active') throw new Error('no active entry after sync');const editor = mountCollabEditor(entry.provider.document, []);const live = { editor, destroyed: false };@@ -176,7 +176,7 @@ async function restartAndAwaitRecycledSync(whileDown?: () => void,): Promise<{ provider: { document: Y.Doc; isSynced: boolean } }> {const before = rig.pool.getActive();- if (!before || before.kind !== 'active') throw new Error('no active entry pre-restart');+ if (before?.kind !== 'active') throw new Error('no active entry pre-restart');const providerBefore = before.provider;rig.srv.handle.killNetwork();@@ -200,7 +200,7 @@ async function restartAndAwaitRecycledSync(50,);const fresh = rig.pool.getActive();- if (!fresh || fresh.kind !== 'active') throw new Error('no recycled entry');+ if (fresh?.kind !== 'active') throw new Error('no recycled entry');if (fresh.provider.document === providerBefore.document) {throw new Error('expected a FRESH Y.Doc after recycle');}diff --git a/packages/app/tests/meta/playwright-worker-density.test.ts b/packages/app/tests/meta/playwright-worker-density.test.tsindex 52e7504ec..dabcf5f8f 100644--- a/packages/app/tests/meta/playwright-worker-density.test.ts+++ b/packages/app/tests/meta/playwright-worker-density.test.ts@@ -65,10 +65,11 @@ describe('playwright worker density', () => {expect(config.workers).toBe(resolveWorkerCount(CI_RUNNER_LOGICAL_CPUS));});- test.each(- CONFIG_NAMES,- )('off-CI the %s config derives workers from the density resolver', async (which) => {- const config = await loadConfigWithCI(undefined, which);- expect(config.workers).toBe(resolveWorkerCount(availableParallelism()));- });+ test.each(CONFIG_NAMES)(+ 'off-CI the %s config derives workers from the density resolver',+ async (which) => {+ const config = await loadConfigWithCI(undefined, which);+ expect(config.workers).toBe(resolveWorkerCount(availableParallelism()));+ },+ );});diff --git a/packages/app/tests/perf/lib/longtask-observer.test.ts b/packages/app/tests/perf/lib/longtask-observer.test.tsindex 0c977ef6f..877f55fda 100644--- a/packages/app/tests/perf/lib/longtask-observer.test.ts+++ b/packages/app/tests/perf/lib/longtask-observer.test.ts@@ -49,7 +49,7 @@ describe('installLongtaskObserver', () => {test('init script registers a PerformanceObserver for the longtask type', async () => {const fake = makeFakePage();await installLongtaskObserver(fake as unknown as Page);- const src = (fake.addInitScriptCalls[0]?.fn as () => void).toString();+ const src = (fake.addInitScriptCalls[0]?.fn as (() => void) | undefined)?.toString();expect(src).toContain('PerformanceObserver');expect(src).toMatch(/longtask/);expect(src).toMatch(/buffered:\s*(true|!0)/);@@ -58,7 +58,7 @@ describe('installLongtaskObserver', () => {test('init script wraps observer setup in try/catch (longtask API may be unsupported)', async () => {const fake = makeFakePage();await installLongtaskObserver(fake as unknown as Page);- const src = (fake.addInitScriptCalls[0]?.fn as () => void).toString();+ const src = (fake.addInitScriptCalls[0]?.fn as (() => void) | undefined)?.toString();expect(src).toContain('try');expect(src).toContain('catch');});@@ -92,13 +92,13 @@ describe('readLongtasks', () => {await readLongtasks(fake as unknown as Page);expect(fake.evaluateCalls.length).toBe(1);expect(typeof fake.evaluateCalls[0]?.fn).toBe('function');- expect((fake.evaluateCalls[0]?.fn as () => unknown).length).toBe(0);+ expect((fake.evaluateCalls[0]?.fn as (() => unknown) | undefined)?.length).toBe(0);});test('evaluator references the same globalThis store name as the installer', async () => {const fake = makeFakePage([]);await readLongtasks(fake as unknown as Page);- const src = (fake.evaluateCalls[0]?.fn as () => unknown).toString();+ const src = (fake.evaluateCalls[0]?.fn as (() => unknown) | undefined)?.toString();expect(src).toContain('__okScenLongTasks');});});diff --git a/packages/cli/package.json b/packages/cli/package.jsonindex 789079f09..44d51e356 100644--- a/packages/cli/package.json+++ b/packages/cli/package.json@@ -31,7 +31,6 @@},"files": ["dist",- "scripts","!dist/**/*.map"],"engines": {@@ -53,8 +52,9 @@"test": "pnpm run build:schema && vitest run","test:e2e:cli": "vitest run --config vitest.e2e.config.ts","typecheck": "tsc --noEmit",+ "check:dts": "node scripts/check-published-dts.mjs","verify:package": "node scripts/verify-package-surface.mjs",- "prepublishOnly": "bash ../../scripts/check-notices-clean.sh && pnpm run build && pnpm run verify:package"+ "prepublishOnly": "bash ../../scripts/check-notices-clean.sh && pnpm run build && pnpm run check:dts && pnpm run verify:package"},"dependencies": {"@inquirer/checkbox": "^5.0.11",@@ -89,7 +89,7 @@"@types/yazl": "^3.3.1","ajv": "^8.18.0","ajv-formats": "^3.0.1",- "tsdown": "^0.21.7",- "typescript": "^5.9.3"+ "tsdown": "^0.22.14",+ "typescript": "~7.0.2"}}diff --git a/packages/cli/scripts/check-published-dts.mjs b/packages/cli/scripts/check-published-dts.mjsnew file mode 100644index 000000000..84214e85b--- /dev/null+++ b/packages/cli/scripts/check-published-dts.mjs@@ -0,0 +1,519 @@+import { spawnSync } from 'node:child_process';+import { existsSync, readFileSync } from 'node:fs';+import { dirname, join, resolve } from 'node:path';+import { fileURLToPath } from 'node:url';+import { readJsoncOrError } from '../../../scripts/read-jsonc.mjs';++const PACKAGE_ROOT = process.env.OK_PUBLISHED_DTS_ROOT+ ? resolve(process.env.OK_PUBLISHED_DTS_ROOT)+ : resolve(dirname(fileURLToPath(import.meta.url)), '..');+const PACKAGE_ROOT_SOURCE = process.env.OK_PUBLISHED_DTS_ROOT ? 'OK_PUBLISHED_DTS_ROOT' : null;+const PUBLISHED_DECLARATION_NAME = 'dist/index.d.mts';+const PUBLISHED_DECLARATION = join(PACKAGE_ROOT, PUBLISHED_DECLARATION_NAME);+const CHECK_PROJECT = 'tsconfig.check.json';+const TSC_BIN = join(+ PACKAGE_ROOT,+ 'node_modules',+ '.bin',+ process.platform === 'win32' ? 'tsc.cmd' : 'tsc',+);++export const PINNED_THIRD_PARTY_INLINING_ARTIFACTS = [+ {+ origin: '@tiptap/core',+ mechanism:+ "tiptap's `declare module '@tiptap/core'` augmentations write `ParentConfig<NodeConfig<Options>>`, relying on NodeConfig's second type parameter defaulting. The inlined copy of NodeConfig loses that default, so the one-argument references no longer satisfy it. tiptap raises the diagnostic at two augmentation sites, which is what count 2 records.",+ file: PUBLISHED_DECLARATION_NAME,+ code: 'TS2314',+ message: "Generic type 'NodeConfig<Options, Storage>' requires 2 type argument(s).",+ count: 2,+ },+];++export const PUBLISHED_SURFACE_BASELINE = {+ capturedFrom:+ "TypeScript 5.9.3, counted trivia-free: comments and string literals excluded. Recorded in the internal evidence tree's dts-baseline-5.9.3/index.tokens.txt, which this package does not ship. Raising a ceiling is a reviewed edit against that token stream, not a regeneration from the artifact that just failed. If you are an outside contributor and a ceiling blocks you, say so on the pull request and ask a maintainer to check it against that token stream: these numbers are a pre-change capture you cannot see, not a budget to raise.",+ anyCeiling: 202,+ unknownCeiling: 128,+ exportedSymbols: [+ 'ALL_EDITOR_IDS',+ 'BundleExtraFile',+ 'BundleLogger',+ 'CollectReportBundleOptions',+ 'EDITOR_LABELS',+ 'EDITOR_TARGETS',+ 'EditorId',+ 'EditorMcpResult',+ 'EditorMcpTarget',+ 'EnsurePiBridgeResult',+ 'ExcludeWriteResult',+ 'ExpectedShareRepo',+ 'GhAccount',+ 'GhDetectResult',+ 'HOSTS_WITH_USER_SKILL_DIR',+ 'IntegrationWriteOutcome',+ 'LAUNCH_CONFIG_NAME',+ 'LanguageMetadata',+ 'LoadConfigResult',+ 'McpConfigDeclineEvent',+ 'McpConfigDeclineScope',+ 'McpConfigMigrateEvent',+ 'McpConfigMigrateScope',+ 'McpDeclineReason',+ 'McpEntryClassification',+ 'McpInstallOptions',+ 'McpRemoveOutcome',+ 'OwnManagedMcpEntryHit',+ 'PATH_SHIM_BEGIN',+ 'PATH_SHIM_BLOCK_RE',+ 'PATH_SHIM_END',+ 'ParsedGitHubBlobUrl',+ 'ParsedGitHubShareTarget',+ 'ParsedGitHubTreeUrl',+ 'PathDiscovery',+ 'PathInstallConsent',+ 'PathInstallMarker',+ 'PiBridgeFileState',+ 'PiBridgeState',+ 'PiBridgeWriteAction',+ 'PiTrustState',+ 'PiTrustWriteAction',+ 'PreviewResult',+ 'ProjectAiIntegrationsResult',+ 'ProjectSkillRemoveResult',+ 'ProjectSkillResult',+ 'ReportBundleLevel',+ 'ReportBundleResult',+ 'ReportBundleSummary',+ 'ResolveProjectRootOptions',+ 'ResolveProjectRootResult',+ 'ShareFolderValidationResult',+ 'SharingMode',+ 'SkillBundleTarget',+ 'TokenStore',+ 'TrackedRefusal',+ 'UserMcpConfigsOptions',+ 'addOkPathsToGitExclude',+ 'assertProjectPathSafe',+ 'buildManagedServerEntry',+ 'buildMcpConfigDeclineEvent',+ 'buildMcpConfigMigrateEvent',+ 'classifyExistingMcpEntry',+ 'collectReportBundle',+ 'createTokenStore',+ 'defaultBugReportZipPath',+ 'detectGh',+ 'detectGhAccounts',+ 'detectInstalledEditors',+ 'editorConfigPathDisplay',+ 'editorEntryLocator',+ 'ensurePiBridge',+ 'formatTrackedRemediation',+ 'getExcludedOkPaths',+ 'getInstalledSkillProjectionPaths',+ 'getNativeTomlMcpEditor',+ 'getOkArtifactPaths',+ 'isEntryUpToDate',+ 'isOwnManagedEntry',+ 'loadConfig',+ 'makeLazyProbeTokenStore',+ 'okBugReportsDir',+ 'parseGitHubBlobUrl',+ 'parseGitHubShareUrl',+ 'parseGitHubTreeUrl',+ 'parseGitUrl',+ 'pathInstallMarkerPath',+ 'previewContent',+ 'probeOwnManagedEditorMcpEntry',+ 'probePiBridgeState',+ 'probeTrackedOkPaths',+ 'readExistingMcpEntry',+ 'readSharingMode',+ 'redactContent',+ 'removeOkPathsFromGitExclude',+ 'removeOwnMcpEntry',+ 'removeProjectSkill',+ 'removeUserGlobalSkillBundle',+ 'resolveProjectRoot',+ 'runStop',+ 'truncatePriorEntry',+ 'userGlobalSkillBundleTargets',+ 'validateLocalFolderForShare',+ 'writeEditorMcpConfig',+ 'writeProjectAiIntegrations',+ 'writeProjectSkill',+ 'writeUserMcpConfigs',+ ],+};++const DIAGNOSTIC_LINE =+ /^(?<file>\S.*?)\((?<line>\d+),(?<col>\d+)\): error (?<code>TS\d+): (?<message>.*)$/;++export function partitionOutput(tscOutput) {+ const diagnostics = [];+ const residual = [];+ for (const line of tscOutput.split('\n')) {+ if (line.trim() === '') continue;+ const match = DIAGNOSTIC_LINE.exec(line);+ if (match?.groups) {+ diagnostics.push({+ file: match.groups.file,+ line: Number(match.groups.line),+ code: match.groups.code,+ message: match.groups.message,+ });+ continue;+ }+ if (/^\s/.test(line)) continue;+ residual.push(line);+ }+ return { diagnostics, residual };+}++export function classifyRun({ status, signal, diagnostics, residual }) {+ if (signal) {+ return `tsc was killed by ${signal} before it could report on the published declaration.`;+ }+ if (residual.length > 0) {+ return `tsc printed ${residual.length} line(s) this check cannot read as diagnostics, so the pin reconciliation below would have run against a partial picture:\n\n ${residual.join('\n ')}`;+ }+ if ((status !== 0) !== diagnostics.length > 0) {+ return `tsc exited ${status} while ${diagnostics.length} diagnostic(s) parsed out of its output. The exit code and the parsed diagnostics disagree, so one of them is not being read correctly.`;+ }+ return null;+}++const signature = (diagnostic) => `${diagnostic.file}: ${diagnostic.code}: ${diagnostic.message}`;++export const pinnedOccurrences = (pinned) =>+ pinned.reduce((total, entry) => total + (entry.count ?? 1), 0);++function toCounts(items) {+ const counts = new Map();+ for (const item of items) counts.set(item, (counts.get(item) ?? 0) + 1);+ return counts;+}++export function reconcile(diagnostics, pinned) {+ const observed = toCounts(diagnostics.map(signature));+ const expected = toCounts(+ pinned.flatMap((entry) => Array.from({ length: entry.count ?? 1 }, () => signature(entry))),+ );+ const provenance = new Map(pinned.map((entry) => [signature(entry), entry]));+ const unexpected = [];+ const missing = [];++ for (const [key, count] of observed) {+ const surplus = count - (expected.get(key) ?? 0);+ if (surplus > 0) unexpected.push({ signature: key, count: surplus });+ }+ for (const [key, count] of expected) {+ const deficit = count - (observed.get(key) ?? 0);+ if (deficit > 0) {+ const pin = provenance.get(key);+ missing.push({+ signature: key,+ count: deficit,+ origin: pin.origin,+ mechanism: pin.mechanism,+ });+ }+ }+ return { unexpected, missing };+}++const NAMED_EXPORT_BLOCK = /^export\s+(?:type\s+)?\{([^}]*)\}/gm;+const STAR_EXPORT = /^export\s+(?:type\s+)?\*/m;+const INKEEP_SPECIFIER = /@inkeep\//;++export function readPublishedSurface(text) {+ const declarations = stripTrivia(text);+ const code = stripTrivia(text, { stripStrings: true });+ const exported = new Set();+ let namedExportBlocks = 0;+ for (const block of declarations.matchAll(NAMED_EXPORT_BLOCK)) {+ namedExportBlocks += 1;+ for (const entry of block[1].split(',')) {+ const specifier = entry.trim();+ if (specifier === '') continue;+ const aliased = /\sas\s+(\S+)$/.exec(specifier);+ exported.add(aliased ? aliased[1] : specifier.replace(/^type\s+/, ''));+ }+ }+ return {+ exported,+ namedExportBlocks,+ hasStarExport: STAR_EXPORT.test(declarations),+ anyCount: (code.match(/\bany\b/g) ?? []).length,+ unknownCount: (code.match(/\bunknown\b/g) ?? []).length,+ inkeepLines: declarations.split('\n').filter((line) => INKEEP_SPECIFIER.test(line)),+ };+}++export function stripTrivia(text, { stripStrings = false } = {}) {+ let i = 0;+ const n = text.length;+ let out = '';+ while (i < n) {+ const c = text[i];+ const d = text[i + 1];+ if (c === '/' && d === '/') {+ const start = i;+ while (i < n && text[i] !== '\n') i++;+ if (!stripStrings && text.startsWith('///', start)) out += text.slice(start, i);+ continue;+ }+ if (c === '/' && d === '*') {+ i += 2;+ while (i < n && !(text[i] === '*' && text[i + 1] === '/')) {+ if (text[i] === '\n') out += '\n';+ i++;+ }+ i += 2;+ continue;+ }+ if (c === '"' || c === "'" || c === '`') {+ const start = i;+ i++;+ while (i < n) {+ if (text[i] === '\\') {+ i += 2;+ continue;+ }+ if (text[i] === c) {+ i++;+ break;+ }+ i++;+ }+ const literal = text.slice(start, i);+ out += stripStrings ? literal.replace(/[^\n]/g, ' ') : literal;+ continue;+ }+ out += c;+ i++;+ }+ return out;+}++export function checkSurface(surface, baseline) {+ const violations = [];+ if (surface.hasStarExport) {+ violations.push(+ 'the file carries a top-level `export *`, so its exported symbol set is no longer enumerable from the export statement and this check cannot fence it. Bundle the re-export instead.',+ );+ }+ if (surface.namedExportBlocks === 0 || surface.exported.size === 0) {+ violations.push(+ 'no top-level named export block was found, so the exported-symbol comparison below read nothing. A check that compares an empty set to a baseline passes vacuously, so this refuses instead.',+ );+ return violations;+ }+ const dropped = baseline.exportedSymbols.filter((name) => !surface.exported.has(name));+ if (dropped.length > 0) {+ violations.push(+ `${dropped.length} of the ${baseline.exportedSymbols.length} baseline exported symbols are gone from the published surface: ${dropped.join(', ')}. Removing a published export is a consumer-visible break; restore it or land the removal as its own versioned change and re-capture the baseline.`,+ );+ }+ if (surface.inkeepLines.length > 0) {+ violations.push(+ `${surface.inkeepLines.length} line(s) reference \`@inkeep/\`, so the published declaration is not self-contained. Sibling packages are devDependencies and are \`private: true\`, so an npm consumer cannot resolve them:\n\n ${surface.inkeepLines.slice(0, 5).join('\n ')}`,+ );+ }+ if (surface.anyCount > baseline.anyCeiling) {+ violations.push(+ `\`any\` occurs ${surface.anyCount} times outside comments and string literals, above the ${baseline.anyCeiling} the 5.9.3 token stream recorded. Either a sibling type degraded to \`any\` — find what stopped resolving — or a new export widened the surface legitimately, in which case land it as its own versioned change and re-capture the ceiling from the trivia-free token count, not the raw whole-file one.`,+ );+ }+ if (surface.unknownCount > baseline.unknownCeiling) {+ violations.push(+ `\`unknown\` occurs ${surface.unknownCount} times outside comments and string literals, above the ${baseline.unknownCeiling} the 5.9.3 token stream recorded. Same two causes and the same remedy as the \`any\` ceiling above.`,+ );+ }+ return violations;+}++export function checkProjectFences(read) {+ const problems = [];+ if (!read.ok) {+ problems.push(+ read.code === 'ENOENT'+ ? `${CHECK_PROJECT} does not exist, so nothing establishes what the type-check below actually opened.`+ : `${CHECK_PROJECT} could not be read: ${read.reason}. Nothing then establishes what the type-check below actually opened.`,+ );+ return problems;+ }+ const project = read.value;+ if (project?.compilerOptions?.skipLibCheck !== false) {+ problems.push(+ `${CHECK_PROJECT} does not set \`skipLibCheck: false\`. The base tsconfig sets it true, and with it on tsc skips every declaration file — including the only file this project lists — so the run would pass without reading the published surface at all.`,+ );+ }+ if (!(project?.files ?? []).includes(PUBLISHED_DECLARATION_NAME)) {+ problems.push(+ `${CHECK_PROJECT} does not list ${PUBLISHED_DECLARATION_NAME} in \`files\`, so the run below type-checks something other than the declaration this guard exists to fence.`,+ );+ }+ const conditions = project?.compilerOptions?.customConditions;+ if (!Array.isArray(conditions) || conditions.length !== 0) {+ problems.push(+ `${CHECK_PROJECT} does not reset \`customConditions\` to [], so a sibling specifier inside the published declaration would resolve through the base tsconfig's source condition rather than the way an npm consumer's compiler resolves it. The "standalone" claim in the success line rests on that reset.`,+ );+ }+ return problems;+}++export function isClean({ unexpected, missing, surfaceViolations, unreadable = null }) {+ return (+ !unreadable && unexpected.length === 0 && missing.length === 0 && surfaceViolations.length === 0+ );+}++export function evaluate({ declarationText, run, pins, baseline, root, rootSource = null }) {+ const output = `${run.stdout ?? ''}${run.stderr ?? ''}`;+ const { diagnostics, residual } = partitionOutput(output);+ const unreadable = classifyRun({+ status: run.status,+ signal: run.signal,+ diagnostics,+ residual,+ });+ if (unreadable) {+ return {+ code: 1,+ unreadable,+ unexpected: [],+ missing: [],+ surfaceViolations: [],+ out: [],+ err: [+ `check:dts: this check verified nothing, so it is failing rather than reporting a pass.\n\n${unreadable}\n\nFull tsc output:\n${output}`,+ ],+ };+ }++ const { unexpected, missing } = reconcile(diagnostics, pins);+ const surface = readPublishedSurface(declarationText);+ const surfaceViolations = checkSurface(surface, baseline);++ if (pins.length === 0 && diagnostics.length === 0) {+ return {+ code: 1,+ unreadable: `tsc emitted no diagnostics and no artifact is pinned, so nothing in this run proves it opened ${PUBLISHED_DECLARATION_NAME}. A silent pass here is indistinguishable from a project that fences the wrong file or skips declaration checking entirely.`,+ unexpected: [],+ missing: [],+ surfaceViolations,+ out: [],+ err: [+ `check:dts: this check verified nothing, so it is failing rather than reporting a pass.\n\ntsc emitted no diagnostics and PINNED_THIRD_PARTY_INLINING_ARTIFACTS is empty, so the run has no evidence it read ${PUBLISHED_DECLARATION_NAME}. If the pins were emptied because an upstream fix resolved them, replace them with a positive liveness assertion before deleting the last one.`,+ ...surfaceViolations.map((violation) => ` ${violation}\n`),+ ],+ };+ }++ if (isClean({ unexpected, missing, surfaceViolations })) {+ return {+ code: 0,+ unreadable: null,+ unexpected,+ missing,+ surfaceViolations,+ err: [],+ out: [+ `check:dts: OK at ${root}${rootSource === null ? '' : ` [from ${rootSource}]`} — ${PUBLISHED_DECLARATION_NAME} type-checks standalone with skipLibCheck disabled (${pinnedOccurrences(pins)} pinned third-party inlining artifacts across ${pins.length} pin(s), 0 unexpected) and keeps the published surface (${baseline.exportedSymbols.length}/${baseline.exportedSymbols.length} baseline symbols present of ${surface.exported.size} exported, 0 \`@inkeep/\` references, any ${surface.anyCount}/${baseline.anyCeiling}, unknown ${surface.unknownCount}/${baseline.unknownCeiling}).`,+ ],+ };+ }++ const census = `exported ${surface.exported.size}/${baseline.exportedSymbols.length} baseline symbols, any ${surface.anyCount}/${baseline.anyCeiling}, unknown ${surface.unknownCount}/${baseline.unknownCeiling}`;+ const unenumerable =+ surface.hasStarExport || surface.namedExportBlocks === 0 || surface.exported.size === 0;+ const err = [+ unenumerable+ ? `check:dts: the published declaration surface could not be enumerated, so it was never compared against the baseline (${census}). Refusing to report a pass. Baseline: ${baseline.capturedFrom}\n`+ : surfaceViolations.length > 0+ ? `check:dts: the published declaration surface changed (${census}). Baseline: ${baseline.capturedFrom}\n`+ : `check:dts: the published declaration did not type-check as expected (surface unchanged: ${census}).\n`,+ ];+ for (const violation of surfaceViolations) err.push(` ${violation}\n`);++ if (unexpected.length > 0) {+ err.push(+ 'UNEXPECTED diagnostics in the published declaration. This is the fence: a symbol that no longer resolves, a sibling type left dangling, or an internally inconsistent inlined declaration. Fix the exporting package rather than widening the pin.\n',+ );+ for (const entry of unexpected) err.push(` x${entry.count} ${entry.signature}`);+ err.push('');+ for (const diagnostic of diagnostics) {+ if (unexpected.some((entry) => entry.signature === signature(diagnostic))) {+ err.push(` ${diagnostic.file}:${diagnostic.line} ${diagnostic.code}`);+ }+ }+ err.push('');+ }++ if (missing.length > 0) {+ err.push(+ `PINNED diagnostics that no longer appear (${diagnostics.length} diagnostic(s) were observed in total, so tsc did run). An upstream fix or a bundler change resolved them; delete the matching entries from PINNED_THIRD_PARTY_INLINING_ARTIFACTS so the pin keeps meaning what it says. If that would empty the list, add a positive liveness assertion in the same change: with no pins and no diagnostics this check refuses rather than passing, because nothing would then prove it read the declaration.\n`,+ );+ for (const entry of missing) {+ err.push(` x${entry.count} ${entry.signature}`);+ err.push(` pinned against ${entry.origin}: ${entry.mechanism}`);+ }+ err.push('');+ }++ err.push(`Full tsc output:\n${output}`);+ return { code: 1, unreadable: null, unexpected, missing, surfaceViolations, out: [], err };+}++function main() {+ if (!existsSync(PUBLISHED_DECLARATION)) {+ console.error(+ `check:dts: ${PUBLISHED_DECLARATION} does not exist. Run \`pnpm run build:cli\` first (turbo orders this via dependsOn build).`,+ );+ process.exit(1);+ }++ if (!existsSync(TSC_BIN)) {+ console.error(+ `check:dts: no tsc at ${TSC_BIN}. Run \`pnpm install\` from public/open-knowledge. This check resolves the compiler by absolute path on purpose: falling through to a machine-global tsc would reconcile its diagnostics as if they came from the version this package declares.`,+ );+ process.exit(1);+ }++ const fenceProblems = checkProjectFences(readJsoncOrError(join(PACKAGE_ROOT, CHECK_PROJECT)));+ if (fenceProblems.length > 0) {+ console.error(+ 'check:dts: the project this check runs under no longer fences what the success line claims it does.\n',+ );+ for (const problem of fenceProblems) console.error(` ${problem}`);+ process.exit(1);+ }++ const tsc = spawnSync(TSC_BIN, ['-p', CHECK_PROJECT, '--pretty', 'false'], {+ cwd: PACKAGE_ROOT,+ encoding: 'utf8',+ shell: process.platform === 'win32',+ });++ if (tsc.error) {+ console.error(`check:dts: could not run tsc: ${tsc.error.message}`);+ process.exit(1);+ }++ const { code, out, err } = evaluate({+ declarationText: readFileSync(PUBLISHED_DECLARATION, 'utf8'),+ run: tsc,+ pins: PINNED_THIRD_PARTY_INLINING_ARTIFACTS,+ baseline: PUBLISHED_SURFACE_BASELINE,+ root: PACKAGE_ROOT,+ rootSource: PACKAGE_ROOT_SOURCE,+ });+ for (const line of out) console.log(line);+ for (const line of err) console.error(line);+ process.exit(code);+}++if (process.argv[1] === fileURLToPath(import.meta.url)) {+ main();+}diff --git a/packages/cli/scripts/check-published-dts.test.ts b/packages/cli/scripts/check-published-dts.test.tsnew file mode 100644index 000000000..b4dea423a--- /dev/null+++ b/packages/cli/scripts/check-published-dts.test.ts@@ -0,0 +1,776 @@+import { spawnSync } from 'node:child_process';+import { existsSync, mkdirSync, mkdtempSync, readFileSync, rmSync, writeFileSync } from 'node:fs';+import { tmpdir } from 'node:os';+import { dirname, join } from 'node:path';+import { fileURLToPath } from 'node:url';+import { describe, expect, it } from 'vitest';+import { readJsoncOrError } from '../../../scripts/read-jsonc.mjs';+import {+ checkProjectFences,+ checkSurface,+ classifyRun,+ evaluate,+ isClean,+ PINNED_THIRD_PARTY_INLINING_ARTIFACTS,+ PUBLISHED_SURFACE_BASELINE,+ partitionOutput,+ readPublishedSurface,+ reconcile,+} from './check-published-dts.mjs';++type Pin = {+ origin: string;+ mechanism: string;+ file: string;+ code: string;+ message: string;+ count?: number;+};+type Diagnostic = { file: string; line: number; code: string; message: string };+type Tally = { signature: string; count: number };+type MissingTally = Tally & { origin: string; mechanism: string };+type Baseline = { anyCeiling: number; unknownCeiling: number; exportedSymbols: string[] };++const PINS = PINNED_THIRD_PARTY_INLINING_ARTIFACTS as Pin[];+const BASELINE = PUBLISHED_SURFACE_BASELINE as Baseline;++const asDiagnostics = (pinned: Pin[]): Diagnostic[] =>+ pinned.flatMap((entry, index) =>+ Array.from({ length: entry.count ?? 1 }, (_unused, occurrence) => ({+ file: entry.file,+ line: 100 + index * 10 + occurrence,+ code: entry.code,+ message: entry.message,+ })),+ );++const PINNED_OCCURRENCES = PINS.reduce((sum: number, pin: Pin) => sum + (pin.count ?? 1), 0);++const totalCount = (tallies: Tally[]) => tallies.reduce((sum, entry) => sum + entry.count, 0);++const sig = (pin: Pin) => `${pin.file}: ${pin.code}: ${pin.message}`;++const exportStatement = (names: string[]) => `export { ${names.join(', ')} };`;++describe('published declaration reconciliation', () => {+ it('accepts a build whose diagnostics are exactly the pinned third-party artifacts', () => {+ const result = reconcile(asDiagnostics(PINS), PINS);++ expect(result.unexpected).toEqual([]);+ expect(result.missing).toEqual([]);+ });++ it('accepts the pinned artifacts at different line numbers, since every rebuild moves them', () => {+ const shifted = asDiagnostics(PINS).map((diagnostic: Diagnostic) => ({+ ...diagnostic,+ line: diagnostic.line + 9000,+ }));++ expect(reconcile(shifted, PINS)).toEqual({+ unexpected: [],+ missing: [],+ });+ });++ it('reports a diagnostic that is not pinned, which is the dangling-sibling-type case', () => {+ const withDanglingReference = [+ ...asDiagnostics(PINS),+ {+ file: 'dist/index.d.mts',+ line: 12020,+ code: 'TS2304',+ message: "Cannot find name 'ALL_EDITOR_IDS'.",+ },+ ];++ const result = reconcile(withDanglingReference, PINS);++ expect(result.missing).toEqual([]);+ expect(result.unexpected).toEqual([+ { signature: "dist/index.d.mts: TS2304: Cannot find name 'ALL_EDITOR_IDS'.", count: 1 },+ ]);+ });++ it('reports an extra occurrence of an already-pinned diagnostic rather than absorbing it', () => {+ const [tiptap] = PINS.filter((e: Pin) => e.code === 'TS2314');+ expect(tiptap.count).toBe(2);++ const withThird = [+ ...asDiagnostics(PINS),+ { file: tiptap.file, line: 9999, code: tiptap.code, message: tiptap.message },+ ];++ expect(reconcile(withThird, PINS).unexpected).toEqual([{ signature: sig(tiptap), count: 1 }]);+ });++ it('does not let the same message from a dependency declaration cover a pin on the published file', () => {+ const movedToDependency = asDiagnostics(PINS).map((diagnostic: Diagnostic) => ({+ ...diagnostic,+ file: 'node_modules/@tiptap/core/dist/index.d.ts',+ }));++ const result = reconcile(movedToDependency, PINS) as {+ unexpected: Tally[];+ missing: MissingTally[];+ };++ expect(totalCount(result.unexpected)).toBe(PINNED_OCCURRENCES);+ expect(totalCount(result.missing)).toBe(PINNED_OCCURRENCES);+ });++ it('reports a pinned diagnostic that stopped appearing, so an upstream fix shrinks the pin', () => {+ const [firstPin] = PINS;+ const [, ...remainingOccurrences] = asDiagnostics(PINS);++ const result = reconcile(remainingOccurrences, PINS) as {+ unexpected: Tally[];+ missing: MissingTally[];+ };++ expect(result.unexpected).toEqual([]);+ expect(result.missing).toHaveLength(1);+ expect(result.missing[0].signature).toBe(sig(firstPin));+ expect(result.missing[0].count).toBe(1);+ expect(result.missing[0].origin).toBe(firstPin.origin);+ expect(result.missing[0].mechanism).toBeTruthy();+ });++ it('carries the provenance of every stale pin so the operator knows what it covered', () => {+ const missing = reconcile([], PINS) as { missing: MissingTally[] };++ for (const entry of missing.missing) {+ expect(entry.origin).toBeTruthy();+ expect(entry.mechanism).toBeTruthy();+ }+ expect(missing.missing.map((entry) => entry.origin)).toContain('@tiptap/core');+ });++ it('fails loudly rather than silently passing when no diagnostics are observed at all', () => {+ const result = reconcile([], PINS);++ expect(totalCount(result.missing)).toBe(PINNED_OCCURRENCES);+ expect(result.missing).toHaveLength(new Set(PINS.map(sig)).size);+ });+});++describe('tsc output parsing', () => {+ const OUTPUT = [+ "dist/index.d.mts(927,63): error TS2636: Type '$ZodObjectInternals<sub-Shape, Config>' is not assignable to type '$ZodObjectInternals<super-Shape, Config>' as implied by variance annotation.",+ " Types of property 'output' are incompatible.",+ " Type 'A' is not assignable to type 'B'.",+ "dist/index.d.mts(9284,28): error TS2314: Generic type 'NodeConfig<Options, Storage>' requires 2 type argument(s).",+ '',+ ].join('\n');++ it('reads one diagnostic per top-level line and ignores the indented explanation lines', () => {+ const { diagnostics, residual } = partitionOutput(OUTPUT);++ expect(diagnostics).toHaveLength(2);+ expect(diagnostics[0]).toMatchObject({ code: 'TS2636', line: 927, file: 'dist/index.d.mts' });+ expect(diagnostics[1]).toMatchObject({ code: 'TS2314', line: 9284 });+ expect(diagnostics[1].message).toBe(+ "Generic type 'NodeConfig<Options, Storage>' requires 2 type argument(s).",+ );+ expect(residual).toEqual([]);+ });++ it('parses the real pinned diagnostics out of real tsc output', () => {+ const real = asDiagnostics(PINS)+ .map(+ (pin: Diagnostic, index: number) =>+ `${pin.file}(${6934 + index},28): error ${pin.code}: ${pin.message}`,+ )+ .join('\n');++ const result = reconcile(partitionOutput(real).diagnostics, PINS);++ expect(result.unexpected).toEqual([]);+ expect(result.missing).toEqual([]);+ });++ it('finds nothing in output that carries no diagnostics', () => {+ expect(partitionOutput('').diagnostics).toEqual([]);+ expect(partitionOutput('').residual).toEqual([]);+ });++ it('collects a global diagnostic with no file prefix as residual rather than dropping it', () => {+ const { diagnostics, residual } = partitionOutput(+ "error TS5058: The specified path does not exist: 'tsconfig.check.json'.\n",+ );++ expect(diagnostics).toEqual([]);+ expect(residual).toEqual([+ "error TS5058: The specified path does not exist: 'tsconfig.check.json'.",+ ]);+ });++ it('treats a trailing summary line as unreadable residual, since --pretty false emits none', () => {+ const { diagnostics, residual } = partitionOutput(+ 'dist/index.d.mts(1,1): error TS1005: Oops.\nFound 1 error in dist/index.d.mts:1\n',+ );++ expect(diagnostics).toHaveLength(1);+ expect(residual).toEqual(['Found 1 error in dist/index.d.mts:1']);+ });+});++describe('refusing to report a pass on a run this check could not read', () => {+ const clean = { status: 0, signal: null, diagnostics: [], residual: [] };+ const oneDiagnostic = [{ file: 'dist/index.d.mts', line: 1, code: 'TS2314', message: 'x' }];++ it('accepts a clean run', () => {+ expect(classifyRun(clean)).toBeNull();+ });++ it('accepts a run whose exit code and parsed diagnostics agree', () => {+ expect(classifyRun({ ...clean, status: 2, diagnostics: oneDiagnostic })).toBeNull();+ });++ it('refuses a crash whose output parses to nothing, rather than calling every pin stale', () => {+ const reason = classifyRun({+ ...clean,+ status: 1,+ residual: ["error TS5058: The specified path does not exist: 'tsconfig.check.json'."],+ });++ expect(reason).toContain('cannot read as diagnostics');+ });++ it('refuses a run killed by a signal', () => {+ expect(classifyRun({ ...clean, signal: 'SIGKILL' })).toContain('SIGKILL');+ });++ it('refuses a non-zero exit that produced no diagnostics at all', () => {+ expect(classifyRun({ ...clean, status: 1 })).toContain('disagree');+ });++ it('refuses a zero exit that somehow produced diagnostics', () => {+ expect(classifyRun({ ...clean, status: 0, diagnostics: oneDiagnostic })).toContain('disagree');+ });+});++describe('published surface fences', () => {+ const declarationWith = (exportLine: string, body = 'declare const a: string;\n') =>+ `${body}${exportLine}\n`;++ it('reads the exported names, stripping the type modifier and following an alias', () => {+ const surface = readPublishedSurface(+ declarationWith('export { ALL_EDITOR_IDS, type EditorId, redactSecrets as redactContent };'),+ );++ expect([...surface.exported].sort()).toEqual(['ALL_EDITOR_IDS', 'EditorId', 'redactContent']);+ expect(surface.namedExportBlocks).toBe(1);+ });++ it('reads the real baseline symbol set out of a real export statement', () => {+ const surface = readPublishedSurface(+ declarationWith(exportStatement(BASELINE.exportedSymbols)),+ );++ expect(checkSurface(surface, BASELINE)).toEqual([]);+ });++ it('names every baseline symbol the published file stopped exporting', () => {+ const kept = BASELINE.exportedSymbols.slice(1);+ const violations = checkSurface(+ readPublishedSurface(declarationWith(exportStatement(kept))),+ BASELINE,+ );++ expect(violations).toHaveLength(1);+ expect(violations[0]).toContain(BASELINE.exportedSymbols[0]);+ expect(violations[0]).toContain(`1 of the ${BASELINE.exportedSymbols.length}`);+ });++ it('accepts a surface that adds symbols, since growth is not a consumer break', () => {+ const grown = [...BASELINE.exportedSymbols, 'somethingBrandNew'];++ expect(+ checkSurface(readPublishedSurface(declarationWith(exportStatement(grown))), BASELINE),+ ).toEqual([]);+ });++ it('refuses a file with no named export block rather than comparing against an empty set', () => {+ const violations = checkSurface(readPublishedSurface('declare const a: string;\n'), BASELINE);++ expect(violations).toHaveLength(1);+ expect(violations[0]).toContain('passes vacuously');+ });++ it('refuses a top-level star export, whose symbol set this check cannot enumerate', () => {+ const surface = readPublishedSurface(+ `export * from './sibling.js';\n${exportStatement(BASELINE.exportedSymbols)}\n`,+ );++ expect(checkSurface(surface, BASELINE).join('\n')).toContain('export *');+ });++ it('fails a published file that still references a sibling workspace package', () => {+ const surface = readPublishedSurface(+ `import type { Doc } from '@inkeep/open-knowledge-core';\n${exportStatement(BASELINE.exportedSymbols)}\n`,+ );++ expect(surface.inkeepLines).toHaveLength(1);+ expect(checkSurface(surface, BASELINE).join('\n')).toContain('not self-contained');+ });++ it('fails a surface whose any count climbed above the captured baseline', () => {+ const widened = `${'type W = any;\n'.repeat(BASELINE.anyCeiling + 1)}${exportStatement(BASELINE.exportedSymbols)}\n`;++ expect(checkSurface(readPublishedSurface(widened), BASELINE).join('\n')).toContain('above the');+ });++ it('counts any and unknown as whole words, so identifiers containing them do not register', () => {+ const surface = readPublishedSurface(+ declarationWith(+ 'export { a };',+ 'declare const anyway: unknownish;\ndeclare const a: any;\n',+ ),+ );++ expect(surface.anyCount).toBe(1);+ expect(surface.unknownCount).toBe(0);+ });+});++describe('the published-declaration pass condition', () => {+ const tally = [{ signature: 'dist/index.d.mts: TS2304: x', count: 1 }];++ it('passes only when all three fences are empty', () => {+ expect(isClean({ unexpected: [], missing: [], surfaceViolations: [] })).toBe(true);+ });++ it('fails on a surface violation even when the diagnostics reconcile', () => {+ expect(+ isClean({ unexpected: [], missing: [], surfaceViolations: ['a baseline export is gone'] }),+ ).toBe(false);+ });++ it('fails on an unexpected diagnostic and on a stale pin', () => {+ expect(isClean({ unexpected: tally, missing: [], surfaceViolations: [] })).toBe(false);+ expect(isClean({ unexpected: [], missing: tally, surfaceViolations: [] })).toBe(false);+ });+});++describe('triple-slash directives are dependencies, not prose', () => {+ it('keeps a reference directive in the self-containment fence but out of the counts', () => {+ const surface = readPublishedSurface('/// <reference types="@inkeep/any" />\nexport { A };\n');++ expect(surface.inkeepLines).toHaveLength(1);+ expect(surface.anyCount).toBe(0);+ });++ it('still drops an ordinary line comment from both views', () => {+ const surface = readPublishedSurface(+ '// see @inkeep/open-knowledge-core for any of this\ndeclare const a: string;\nexport { A };\n',+ );++ expect(surface.inkeepLines).toEqual([]);+ expect(surface.anyCount).toBe(0);+ });+});++describe('the any/unknown ceilings count types, not prose', () => {+ const withExport = (body: string) =>+ `${body}\nexport { ${BASELINE.exportedSymbols.join(', ')} };\n`;++ it('ignores `any` and `unknown` in comments and string literals', () => {+ const surface = readPublishedSurface(+ withExport(+ '/** any any unknown */\n// any unknown\ndeclare const u: "any unknown | any";\ndeclare const a: any;\n',+ ),+ );++ expect(surface.anyCount).toBe(1);+ expect(surface.unknownCount).toBe(0);+ });++ it('fences the unknown axis too, so a copy-paste of the any branch cannot go silent', () => {+ const widened = readPublishedSurface(+ withExport(`${'type W = unknown;\n'.repeat(BASELINE.unknownCeiling + 1)}`),+ );++ expect(checkSurface(widened, BASELINE).join(' ')).toContain('`unknown` occurs');+ });++ it('still counts a type that widened to any, so prose churn cannot mask it', () => {+ const prose = `${'/** any any any any any */\n'.repeat(BASELINE.anyCeiling)}`;+ const clean = readPublishedSurface(withExport(prose));+ const widened = readPublishedSurface(+ withExport(`${prose}${'declare const w: any;\n'.repeat(BASELINE.anyCeiling + 1)}`),+ );++ expect(checkSurface(clean, BASELINE)).toEqual([]);+ expect(checkSurface(widened, BASELINE).join(' ')).toContain('`any` occurs');+ });+});++describe('the pass condition main() routes through', () => {+ const cleanRun = { status: 0, signal: null, stdout: '', stderr: '' };+ // A live clean run carries the pinned diagnostics. `cleanRun` above has none and+ // is kept for the cases that assert on a pin going missing; the liveness floor+ // refuses an empty-pins run with no diagnostics, since nothing in it proves tsc+ // opened the declaration.+ const livePinnedRun = {+ status: 2,+ signal: null,+ stdout: asDiagnostics(PINS)+ .map(+ (entry: Diagnostic, i: number) =>+ `${entry.file}(${100 + i},1): error ${entry.code}: ${entry.message}`,+ )+ .join('\n'),+ stderr: '',+ };+ const declaration = (symbols: string[]) =>+ `declare const x: string;\nexport { ${symbols.join(', ')} };\n`;++ it('reports success only when the diagnostics reconcile and the surface holds', () => {+ const result = evaluate({+ root: '/tree',+ declarationText: declaration(BASELINE.exportedSymbols),+ run: livePinnedRun,+ pins: PINS,+ baseline: BASELINE,+ });++ expect(result.code).toBe(0);+ expect(result.out.join(' ')).toContain('keeps the published surface');+ });++ it('fails on a dropped baseline export even though tsc reported only the pinned artifacts', () => {+ const result = evaluate({+ root: '/tree',+ declarationText: declaration(BASELINE.exportedSymbols.slice(1)),+ run: livePinnedRun,+ pins: PINS,+ baseline: BASELINE,+ });++ expect(result.code).toBe(1);+ expect(result.surfaceViolations.join(' ')).toContain('baseline exported symbols are gone');+ });++ it('refuses rather than passing when tsc was killed before it reported', () => {+ const result = evaluate({+ root: '/tree',+ declarationText: declaration(BASELINE.exportedSymbols),+ run: { status: null, signal: 'SIGKILL', stdout: '', stderr: '' },+ pins: [],+ baseline: BASELINE,+ });++ expect(result.code).toBe(1);+ expect(result.unreadable).toContain('SIGKILL');+ expect(result.missing).toEqual([]);+ });++ it('refuses rather than passing when tsc output it could not read', () => {+ const result = evaluate({+ root: '/tree',+ declarationText: declaration(BASELINE.exportedSymbols),+ run: { status: 1, signal: null, stdout: 'error TS5058: no such project.\n', stderr: '' },+ pins: [],+ baseline: BASELINE,+ });++ expect(result.code).toBe(1);+ expect(result.unreadable).toContain('cannot read as diagnostics');+ });++ it('reports a pin that stopped appearing instead of passing on a clean run', () => {+ const result = evaluate({+ root: '/tree',+ declarationText: declaration(BASELINE.exportedSymbols),+ run: cleanRun,+ pins: [+ {+ origin: 'zod',+ mechanism: 'variance cast',+ file: 'dist/index.d.mts',+ code: 'TS2636',+ message: 'Gone.',+ },+ ],+ baseline: BASELINE,+ });++ expect(result.code).toBe(1);+ expect(result.missing).toHaveLength(1);+ expect(result.missing[0]?.signature).toContain('TS2636');+ expect(result.err.join('\n')).toContain('add a positive liveness assertion in the same change');+ });++ it('does not claim the surface changed when only the diagnostics failed', () => {+ const result = evaluate({+ root: '/tree',+ declarationText: declaration(BASELINE.exportedSymbols),+ run: {+ status: 1,+ signal: null,+ stdout: "dist/index.d.mts(1,1): error TS2304: Cannot find name 'Ghost'.\n",+ stderr: '',+ },+ pins: [],+ baseline: BASELINE,+ });++ expect(result.err[0]).toContain('did not type-check as expected');+ expect(result.err[0]).not.toContain('surface changed');+ });++ it('fails on an unexpected diagnostic even though the surface holds', () => {+ const result = evaluate({+ root: '/tree',+ declarationText: declaration(BASELINE.exportedSymbols),+ run: {+ status: 1,+ signal: null,+ stdout: "dist/index.d.mts(1,1): error TS2304: Cannot find name 'Ghost'.\n",+ stderr: '',+ },+ pins: [],+ baseline: BASELINE,+ });++ expect(result.code).toBe(1);+ expect(result.unexpected).toHaveLength(1);+ });+});++describe('the ceilings, the fingerprint and the token stream stay one number', () => {+ const evidence = join(+ import.meta.dirname,+ '../../../specs/2026-09-02-typescript-7-toolchain-upgrade/evidence/dts-baseline-5.9.3',+ );+ const tokensPath = join(evidence, 'index.tokens.txt');+ const specsRoot = join(import.meta.dirname, '../../../specs');++ it.skipIf(!existsSync(specsRoot))(+ 'derives both ceilings from the committed 5.9.3 token stream',+ () => {+ expect(+ existsSync(tokensPath),+ `${tokensPath} is gone, so nothing ties anyCeiling/unknownCeiling to a capture`,+ ).toBe(true);+ const tokens = readFileSync(tokensPath, 'utf8').split('\n');+ const count = (word: string) => tokens.filter((token) => token === word).length;+ const fingerprint = JSON.parse(+ readFileSync(join(evidence, 'index.fingerprint.json'), 'utf8'),+ ) as Record<string, number>;++ expect(count('any')).toBe(BASELINE.anyCeiling);+ expect(count('unknown')).toBe(BASELINE.unknownCeiling);+ expect(fingerprint.any_tokens).toBe(BASELINE.anyCeiling);+ expect(fingerprint.unknown_tokens).toBe(BASELINE.unknownCeiling);+ },+ );+});++describe('checkProjectFences', () => {+ const sound = {+ compilerOptions: { skipLibCheck: false, customConditions: [] },+ files: ['dist/index.d.mts'],+ };+ const fence = (value: unknown) => checkProjectFences({ ok: true, value });++ it('accepts a project that disables skipLibCheck and lists the declaration', () => {+ expect(fence(sound)).toEqual([]);+ });++ it('accepts the tsconfig.check.json this package actually ships', () => {+ const onDisk = readJsoncOrError(join(import.meta.dirname, '..', 'tsconfig.check.json'));++ expect(onDisk.ok).toBe(true);+ expect(checkProjectFences(onDisk)).toEqual([]);+ });++ it('separates a project that is absent from one that is malformed', () => {+ const [absent] = checkProjectFences({ ok: false, code: 'ENOENT', reason: 'gone' });+ expect(absent).toContain('does not exist');++ const [malformed] = checkProjectFences({+ ok: false,+ code: 'EPARSE',+ reason: 'malformed rather than merely commented',+ });+ expect(malformed).toContain('could not be read');+ expect(malformed).toContain('malformed rather than merely commented');+ });++ it('reads a project that carries JSONC comments as the fences it declares', () => {+ const dir = mkdtempSync(join(tmpdir(), 'check-project-fences-'));+ try {+ const file = join(dir, 'tsconfig.check.json');+ writeFileSync(+ file,+ '{\n // the base sets skipLibCheck true\n "compilerOptions": { "skipLibCheck": false, "customConditions": [] },\n "files": ["dist/index.d.mts"],\n}\n',+ );++ expect(checkProjectFences(readJsoncOrError(file))).toEqual([]);+ } finally {+ rmSync(dir, { recursive: true, force: true });+ }+ });++ it('rejects a project that leaves skipLibCheck at the base value', () => {+ const [problem] = fence({ ...sound, compilerOptions: { customConditions: [] } });+ expect(problem).toContain('skipLibCheck: false');+ expect(problem).toContain('would pass without reading the published surface');+ });++ it('rejects a project that fences a file other than the published declaration', () => {+ const [problem] = fence({ ...sound, files: [] });+ expect(problem).toContain('does not list dist/index.d.mts');+ });++ it('rejects a project that leaves the base source condition in place', () => {+ const [problem] = fence({ ...sound, compilerOptions: { skipLibCheck: false } });+ expect(problem).toContain('does not reset `customConditions` to []');+ expect(problem).toContain('The "standalone" claim in the success line rests on that reset');+ });++ it('reports every broken fence rather than stopping at the first', () => {+ const problems = fence({ compilerOptions: {}, files: [] });+ expect(problems).toHaveLength(3);+ expect(problems[0]).toContain('skipLibCheck: false');+ expect(problems[1]).toContain('does not list dist/index.d.mts');+ expect(problems[2]).toContain('does not reset `customConditions` to []');+ });+});++describe('the liveness floor under evaluate', () => {+ it('refuses a run with no diagnostics and no pins, which proves nothing was read', () => {+ const result = evaluate({+ root: '/tree',+ declarationText: 'declare const x: string;\nexport { x };\n',+ run: { status: 0, signal: null, stdout: '', stderr: '' },+ pins: [],+ baseline: { exportedSymbols: [], anyCeiling: 0, unknownCeiling: 0, capturedFrom: 'test' },+ });++ expect(result.code).toBe(1);+ expect(result.err[0]).toContain('verified nothing');+ expect(result.unreadable).toContain('no artifact is pinned');+ });++ it('carries the surface diagnosis it computed rather than discarding it at the floor', () => {+ const result = evaluate({+ root: '/tree',+ declarationText: 'declare const x: string;\nexport { x };\n',+ run: { status: 0, signal: null, stdout: '', stderr: '' },+ pins: [],+ baseline: {+ exportedSymbols: ['x', 'y'],+ anyCeiling: 0,+ unknownCeiling: 0,+ capturedFrom: 'test',+ },+ });++ expect(result.code).toBe(1);+ expect(result.surfaceViolations).toHaveLength(1);+ expect(result.err.join(' ')).toContain('baseline exported symbols are gone');+ });+});++describe('the success line names the tree it checked', () => {+ const livePinnedRun = {+ status: 2,+ signal: null,+ stdout: asDiagnostics(PINS)+ .map(+ (entry: Diagnostic, i: number) =>+ `${entry.file}(${100 + i},1): error ${entry.code}: ${entry.message}`,+ )+ .join('\n'),+ stderr: '',+ };+ const cleanArgs = () => ({+ root: '/tree',+ declarationText: `declare const x: string;\nexport { ${BASELINE.exportedSymbols.join(', ')} };\n`,+ run: livePinnedRun,+ pins: PINS,+ baseline: BASELINE,+ });++ it('prints no provenance marker when no source is declared', () => {+ const result = evaluate(cleanArgs());+ expect(result.code).toBe(0);+ expect(result.out[0]).toMatch(+ /^check:dts: OK at \/tree — dist\/index\.d\.mts type-checks standalone/,+ );+ expect(result.out[0]).not.toContain('[from');+ });++ it('prints the root and the variable it came from when a source is declared', () => {+ const result = evaluate({ ...cleanArgs(), rootSource: 'OK_PUBLISHED_DTS_ROOT' });+ expect(result.code).toBe(0);+ expect(result.out[0]).toMatch(/^check:dts: OK at \/tree \[from OK_PUBLISHED_DTS_ROOT\] — /);+ });+});++describe('the refusals main() reaches before it ever runs tsc', () => {+ const SCRIPT_DIR = dirname(fileURLToPath(import.meta.url));+ const PACKAGE_ROOT = join(SCRIPT_DIR, '..');++ const run = (root: string) =>+ spawnSync('node', [join(SCRIPT_DIR, 'check-published-dts.mjs')], {+ cwd: PACKAGE_ROOT,+ encoding: 'utf8',+ env: { ...process.env, OK_PUBLISHED_DTS_ROOT: root },+ });++ const fixtureRoot = (files: Record<string, string>) => {+ const root = mkdtempSync(join(tmpdir(), 'check-published-dts-'));+ for (const [relative, body] of Object.entries(files)) {+ const file = join(root, relative);+ mkdirSync(dirname(file), { recursive: true });+ writeFileSync(file, body);+ }+ return root;+ };++ const refusalCase = (files: Record<string, string>, expected: (root: string) => string[]) => {+ const root = fixtureRoot(files);+ try {+ const result = run(root);+ expect(result.status).toBe(1);+ expect(result.stdout).toBe('');+ for (const fragment of expected(root)) expect(result.stderr).toContain(fragment);+ } finally {+ rmSync(root, { recursive: true, force: true });+ }+ };++ it('refuses when the published declaration has not been built', () => {+ refusalCase({}, (root) => [+ join(root, 'dist/index.d.mts'),+ 'does not exist',+ 'pnpm run build:cli',+ ]);+ });++ it('refuses when no tsc sits beside the package rather than falling through to a global one', () => {+ refusalCase({ 'dist/index.d.mts': 'export {};\n' }, (root) => [+ `no tsc at ${join(root, 'node_modules', '.bin')}`,+ 'falling through to a machine-global tsc',+ ]);+ });++ it('refuses when the project it would type-check under no longer fences what it claims', () => {+ refusalCase(+ {+ 'dist/index.d.mts': 'export {};\n',+ 'node_modules/.bin/tsc': '#!/bin/sh\nexit 0\n',+ 'tsconfig.check.json': JSON.stringify({ compilerOptions: { skipLibCheck: true } }),+ },+ () => [+ 'no longer fences what the success line claims',+ 'does not set `skipLibCheck: false`',+ 'does not list dist/index.d.mts in `files`',+ 'does not reset `customConditions` to []',+ ],+ );+ });+});diff --git a/packages/cli/scripts/check-resolution-truth.test.ts b/packages/cli/scripts/check-resolution-truth.test.tsnew file mode 100644index 000000000..db4f16f18--- /dev/null+++ b/packages/cli/scripts/check-resolution-truth.test.ts@@ -0,0 +1,82 @@+import { spawnSync } from 'node:child_process';+import path from 'node:path';+import { fileURLToPath } from 'node:url';+import { describe, expect, it } from 'vitest';++const okRoot = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '../../..');+const CORE = '@inkeep/open-knowledge-core';+const SOURCE_CONDITION = "condition '@inkeep/source'";++function trace(cwd: string, args: string[]): string {+ const run = spawnSync('pnpm', ['exec', 'tsc', '--noEmit', '--traceResolution', ...args], {+ cwd: path.join(okRoot, cwd),+ encoding: 'utf8',+ maxBuffer: 512 * 1024 * 1024,+ });+ const output = `${run.stdout ?? ''}${run.stderr ?? ''}`;+ if ((run.error as NodeJS.ErrnoException | undefined)?.code === 'ENOBUFS') {+ throw new Error(+ `the trace from ${cwd} exceeded the 512 MiB capture buffer, so it was truncated and nothing below read a complete resolution log. Raise maxBuffer or narrow the traced project rather than reading a partial trace as a verdict.`,+ );+ }+ if (run.error) {+ throw new Error(`tsc could not be run in ${cwd}: ${run.error.message}`);+ }+ if (run.signal) {+ throw new Error(+ `tsc was killed by ${run.signal} in ${cwd} before it finished tracing, so this trace proves nothing about how ${CORE} resolved. That is a harness or budget fault, not a resolution defect.`,+ );+ }+ if (run.status !== 0) {+ const diagnostics = output.split('\n').filter((line) => /error TS\d+/.test(line));+ throw new Error(+ `tsc exited ${run.status} in ${cwd}, so this trace proves nothing about how ${CORE} resolved. ` ++ `${diagnostics.length} diagnostic(s):\n${diagnostics.join('\n')}\n` ++ `A compile that fails here is a defect in what the build config reads, most often a sibling dist that is absent or whose emitted declarations mis-classify an export. Rebuild the siblings and read the diagnostics above before touching this test.`,+ );+ }+ return output;+}++function coreResolutions(output: string): string[] {+ const blocks: string[] = [];+ let current: string[] | null = null;+ for (const line of output.split('\n')) {+ if (line.startsWith('======== Resolving module ')) {+ current = line.includes(`'${CORE}`) ? [line] : null;+ continue;+ }+ if (current === null) continue;+ current.push(line);+ if (line.startsWith('======== Module name ')) {+ blocks.push(current.join('\n'));+ current = null;+ }+ }+ return blocks;+}++describe('D13 resolution truth: a leaf typecheck reads source, the published build reads declarations', () => {+ it('resolves every core import in a leaf typecheck through @inkeep/source, onto core/src', () => {+ const blocks = coreResolutions(trace('packages/server', []));+ expect(blocks.length).toBeGreaterThan(0);++ for (const block of blocks) {+ expect(block).toContain(`Matched 'exports' ${SOURCE_CONDITION}`);+ expect(block).toMatch(/was successfully resolved to '[^']*\/packages\/core\/src\/[^']*\.ts'/);+ }+ }, 90_000);++ it('clears @inkeep/source for the CLI declaration build, landing on core/dist declarations', () => {+ const blocks = coreResolutions(trace('packages/cli', ['-p', 'tsconfig.build.json']));+ expect(blocks.length).toBeGreaterThan(0);++ for (const block of blocks) {+ expect(block).toContain(`Saw non-matching ${SOURCE_CONDITION}`);+ expect(block).not.toContain(`Matched 'exports' ${SOURCE_CONDITION}`);+ expect(block).toMatch(+ /was successfully resolved to '[^']*\/packages\/core\/dist\/[^']*\.d\.mts'/,+ );+ }+ }, 90_000);+});diff --git a/packages/cli/scripts/verify-package-surface.mjs b/packages/cli/scripts/verify-package-surface.mjsindex 1276785fd..2d42029b3 100644--- a/packages/cli/scripts/verify-package-surface.mjs+++ b/packages/cli/scripts/verify-package-surface.mjs@@ -9,6 +9,8 @@ export const REQUIRED_PACK_FILES = ['README.md', 'dist/LICENSE', 'dist/THIRD_PARexport const REQUIRED_KEYWORDS = ['knowledge-base', 'markdown', 'local-first', 'mcp', 'ai', 'cli'];+export const FORBIDDEN_PACK_PREFIXES = ['scripts/', 'src/', 'tests/'];+export function validatePackageSurface(packageJson, packEntries) {const errors = [];const pack = Array.isArray(packEntries) ? packEntries[0] : undefined;@@ -18,6 +20,10 @@ export function validatePackageSurface(packageJson, packEntries) {for (const file of REQUIRED_PACK_FILES) {if (!packedFiles.has(file)) errors.push(`packed artifact is missing ${file}`);}+ for (const file of packedFiles) {+ const prefix = FORBIDDEN_PACK_PREFIXES.find((candidate) => file.startsWith(candidate));+ if (prefix) errors.push(`packed artifact must not ship ${file} (dev-only ${prefix} tree)`);+ }if (typeof packageJson.description !== 'string' || packageJson.description.trim().length < 40) {errors.push('package description must be at least 40 characters');diff --git a/packages/cli/src/auth/token-store.ts b/packages/cli/src/auth/token-store.tsindex e9210dd71..c14e31849 100644--- a/packages/cli/src/auth/token-store.ts+++ b/packages/cli/src/auth/token-store.ts@@ -43,7 +43,11 @@ export interface TokenStoreDiagnostics {class KeyringBackend implements TokenStore {readonly backend = 'keyring' as const;- constructor(private readonly onKeychainRead?: TokenStoreDiagnostics['onKeychainRead']) {}+ private readonly onKeychainRead?: TokenStoreDiagnostics['onKeychainRead'];++ constructor(onKeychainRead?: TokenStoreDiagnostics['onKeychainRead']) {+ this.onKeychainRead = onKeychainRead;+ }async get(host: string): Promise<TokenEntry | null> {const { Entry } = await import('@napi-rs/keyring');@@ -149,10 +153,13 @@ export class FileBackend implements TokenStore {class KeychainWithFileFallback implements TokenStore {readonly backend = 'keyring' as const;- constructor(- private readonly keychain: TokenStore,- private readonly file: FileBackend,- ) {}+ private readonly keychain: TokenStore;+ private readonly file: FileBackend;++ constructor(keychain: TokenStore, file: FileBackend) {+ this.keychain = keychain;+ this.file = file;+ }async get(host: string): Promise<TokenEntry | null> {const fromKeychain = await this.keychain.get(host);diff --git a/packages/cli/src/commands/init.ts b/packages/cli/src/commands/init.tsindex 3be39faf3..493008231 100644--- a/packages/cli/src/commands/init.ts+++ b/packages/cli/src/commands/init.ts@@ -97,7 +97,7 @@ function parseJsoncObjectTree(raw: string): JsoncNode | null {const errors: JsoncParseError[] = [];const tree = parseJsoncTree(raw, errors, JSONC_PARSE_OPTIONS);if (errors.some((error) => !isBenignBomError(error, raw))) return null;- if (!tree || tree.type !== 'object') return null;+ if (tree?.type !== 'object') return null;return tree;}diff --git a/packages/cli/src/commands/launch-json-removal.ts b/packages/cli/src/commands/launch-json-removal.tsindex ca14cff4d..fcce94b53 100644--- a/packages/cli/src/commands/launch-json-removal.ts+++ b/packages/cli/src/commands/launch-json-removal.ts@@ -39,7 +39,7 @@ export function removeOwnLaunchEntry(projectRoot: string): LaunchRemoveOutcome {const errors: JsoncParseError[] = [];const tree: JsoncNode | undefined = parseTree(raw, errors, JSONC_PARSE_OPTIONS) ?? undefined;if (errors.some((e) => !isBenignBomError(e, raw))) return { kind: 'declined' };- if (!tree || tree.type !== 'object') return { kind: 'declined' };+ if (tree?.type !== 'object') return { kind: 'declined' };const root = getNodeValue(tree) as Record<string, unknown>;const configs = root.configurations;diff --git a/packages/cli/src/commands/open.test.ts b/packages/cli/src/commands/open.test.tsindex 11f1e2fae..c1103f0db 100644--- a/packages/cli/src/commands/open.test.ts+++ b/packages/cli/src/commands/open.test.ts@@ -192,15 +192,18 @@ describe('runOpen', () => {['nested ..', 'a/../b'],['leading slash', '/abs/doc'],['backslash', 'a\\b'],- ])('rejects names the desktop parser would drop (%s) instead of false success', async (_label, name) => {- const { deps, opened, errors } = makeDeps({- detectBundlePath: () => '/Applications/OpenKnowledge.app',- });- const code = await runOpen(name, { project: '/p' }, deps);- expect(code).toBe(1);- expect(opened).toEqual([]);- expect(errors).toHaveLength(1);- });+ ])(+ 'rejects names the desktop parser would drop (%s) instead of false success',+ async (_label, name) => {+ const { deps, opened, errors } = makeDeps({+ detectBundlePath: () => '/Applications/OpenKnowledge.app',+ });+ const code = await runOpen(name, { project: '/p' }, deps);+ expect(code).toBe(1);+ expect(opened).toEqual([]);+ expect(errors).toHaveLength(1);+ },+ );test('rejects unsafe folder names too', async () => {const { deps, opened, errors } = makeDeps({ resolveBaseUrl: () => 'http://localhost:5173' });diff --git a/packages/cli/src/commands/self-spawn.test.ts b/packages/cli/src/commands/self-spawn.test.tsindex 584628d12..7c0333b55 100644--- a/packages/cli/src/commands/self-spawn.test.ts+++ b/packages/cli/src/commands/self-spawn.test.ts@@ -120,16 +120,19 @@ describe('resolveSelfSpawn', () => {it.each([['linux', PACKAGED_EXEC],['win32', 'C:\\Program Files\\OpenKnowledge\\OpenKnowledge.exe'],- ] as const)('non-darwin (%s) → command stays execPath (no LaunchServices)', (platform, execPath) => {- const result = resolveSelfSpawn({- execPath,- platform,- argv: ['runtime', '/entry/script'],- exists: () => true,- });- expect(result.command).toBe(execPath);- expect(result.prefixArgs).toEqual(['/entry/script']);- });+ ] as const)(+ 'non-darwin (%s) → command stays execPath (no LaunchServices)',+ (platform, execPath) => {+ const result = resolveSelfSpawn({+ execPath,+ platform,+ argv: ['runtime', '/entry/script'],+ exists: () => true,+ });+ expect(result.command).toBe(execPath);+ expect(result.prefixArgs).toEqual(['/entry/script']);+ },+ );it.each(['/usr/local/bin/node',diff --git a/packages/cli/src/commands/stop.test.ts b/packages/cli/src/commands/stop.test.tsindex 826fa0cf6..bc98591c3 100644--- a/packages/cli/src/commands/stop.test.ts+++ b/packages/cli/src/commands/stop.test.ts@@ -361,7 +361,7 @@ describe('probeCollabClients failure record', () => {const record = records.find((r) => r.msg === 'stop client-probe failed');expect(record?.obj).toMatchObject({ lockDir, outcome: 'unreachable' });- expect((record?.obj.err as Error).message).toContain('ECONNREFUSED');+ expect((record?.obj.err as Error | undefined)?.message).toContain('ECONNREFUSED');});test('records a malformed answer distinctly from an unreachable one', async () => {diff --git a/packages/cli/src/commands/stop.ts b/packages/cli/src/commands/stop.tsindex 6dfb4be5a..be1997081 100644--- a/packages/cli/src/commands/stop.ts+++ b/packages/cli/src/commands/stop.ts@@ -228,7 +228,7 @@ async function countOtherRunningServers(exceptLockDir: string): Promise<number>export function stopCommand(getConfig: () => Config): Command {return new Command('stop').description(- 'Stop open-knowledge server(s). With no argument: stops the server for the current directory. ' ++ 'Stop open-knowledge server(s). With no argument: stops the server for the enclosing project — run it from anywhere inside the project. ' +'Pass a port number, a directory path, or "all" to target globally.',).argument('[target...]', 'port number, directory path (spaces OK), or "all"')diff --git a/packages/cli/src/integrations/skill-teardown.test.ts b/packages/cli/src/integrations/skill-teardown.test.tsindex 5c6d19758..2d3c786c7 100644--- a/packages/cli/src/integrations/skill-teardown.test.ts+++ b/packages/cli/src/integrations/skill-teardown.test.ts@@ -244,14 +244,12 @@ describe('legacy fan-out sweep — refuses unsafe inputs', () => {return dir;}- test.each([- '',- '.',- 'relative/path',- 'x/../y',- ])('a non-absolute home (%j) throws instead of resolving against cwd', (bogus) => {- expect(() => planLegacyFanoutSweep(bogus)).toThrow(/absolute home/);- });+ test.each(['', '.', 'relative/path', 'x/../y'])(+ 'a non-absolute home (%j) throws instead of resolving against cwd',+ (bogus) => {+ expect(() => planLegacyFanoutSweep(bogus)).toThrow(/absolute home/);+ },+ );test('the filesystem root is refused', () => {expect(() => planLegacyFanoutSweep(sep)).toThrow(/filesystem root/);diff --git a/packages/cli/src/project-anchor.test.ts b/packages/cli/src/project-anchor.test.tsindex cafa57b87..5c08e0ef6 100644--- a/packages/cli/src/project-anchor.test.ts+++ b/packages/cli/src/project-anchor.test.ts@@ -28,40 +28,29 @@ function makeProjectRoot(dir: string, configYaml = ''): void {describe('resolveProjectAnchor — command gating', () => {const stubHit = () => ({ rootPath: '/proj', distance: 2 });- test.each([- 'start',- 'stop',- 'status',- 'clean',- 'ui',- 'mcp',- 'preview',- 'auth',- ])('anchors lifecycle command %s', (name) => {- expect(resolveProjectAnchor(name, '/proj/sub/dir', stubHit)).toBe('/proj');- });+ test.each(['start', 'stop', 'status', 'clean', 'ui', 'mcp', 'preview', 'auth'])(+ 'anchors lifecycle command %s',+ (name) => {+ expect(resolveProjectAnchor(name, '/proj/sub/dir', stubHit)).toBe('/proj');+ },+ );test('anchors the bare-`ok` dispatch (undefined command name)', () => {expect(resolveProjectAnchor(undefined, '/proj/sub/dir', stubHit)).toBe('/proj');});- test.each([- 'init',- 'seed',- 'clone',- 'open',- 'ps',- 'config',- 'diagnose',- ])('keeps literal-cwd semantics for %s without probing the filesystem', (name) => {- let called = false;- const probe = () => {- called = true;- return stubHit();- };- expect(resolveProjectAnchor(name, '/proj/sub/dir', probe)).toBeNull();- expect(called).toBe(false);- });+ test.each(['init', 'seed', 'clone', 'open', 'ps', 'config', 'diagnose'])(+ 'keeps literal-cwd semantics for %s without probing the filesystem',+ (name) => {+ let called = false;+ const probe = () => {+ called = true;+ return stubHit();+ };+ expect(resolveProjectAnchor(name, '/proj/sub/dir', probe)).toBeNull();+ expect(called).toBe(false);+ },+ );test('returns null when cwd is itself the project root (distance 0)', () => {expect(diff --git a/packages/cli/tsconfig.build.json b/packages/cli/tsconfig.build.jsonnew file mode 100644index 000000000..6fe93e8fb--- /dev/null+++ b/packages/cli/tsconfig.build.json@@ -0,0 +1,7 @@+{+ "extends": "./tsconfig.json",+ "compilerOptions": {+ "customConditions": []+ },+ "include": ["src"]+}diff --git a/packages/cli/tsconfig.check.json b/packages/cli/tsconfig.check.jsonnew file mode 100644index 000000000..05fa00f7a--- /dev/null+++ b/packages/cli/tsconfig.check.json@@ -0,0 +1,11 @@+{+ "extends": "../../tsconfig.json",+ "compilerOptions": {+ "module": "esnext",+ "noEmit": true,+ "skipLibCheck": false,+ "types": [],+ "customConditions": []+ },+ "files": ["dist/index.d.mts"]+}diff --git a/packages/cli/tsconfig.json b/packages/cli/tsconfig.jsonindex c8c60eb2f..507e0efc9 100644--- a/packages/cli/tsconfig.json+++ b/packages/cli/tsconfig.json@@ -3,13 +3,7 @@"compilerOptions": {"module": "esnext","noEmit": true,- "allowImportingTsExtensions": true,- "paths": {- "@inkeep/open-knowledge-core": ["../core/src/index.ts"],- "@inkeep/open-knowledge-core/*": ["../core/src/*"],- "@inkeep/open-knowledge-server": ["../server/src/index.ts"],- "@inkeep/open-knowledge-server/*": ["../server/src/*"]- }+ "allowImportingTsExtensions": true},"include": ["src", "*.ts"],"exclude": ["node_modules", "dist", "**/*.test.ts"]diff --git a/packages/cli/tsdown.config.ts b/packages/cli/tsdown.config.tsindex 9960d2035..dbd85d0ab 100644--- a/packages/cli/tsdown.config.ts+++ b/packages/cli/tsdown.config.ts@@ -10,24 +10,6 @@ import { defineConfig } from 'tsdown';// `jsonc-parser` specifier straight to that ESM entry before bundling.const jsoncParserEsmEntry = createRequire(import.meta.url).resolve('jsonc-parser/lib/esm/main.js');-// rolldown-plugin-dts emits this advisory via raw `console.warn` (not through-// rolldown's log pipeline, so `inputOptions.onLog` can't filter it) when tsc-// emit-skips a cross-package source file. The cli's dts entries import from-// `@inkeep/open-knowledge-server` / `-core` whose .ts sources are not in the-// cli's tsconfig include — tsc skips them, the plugin falls back to a-// different emit path, and emits a correct final dist/index.d.mts. The-// recommended fix (`dts.eager`) forces tsc over the full tsconfig graph and-// OOMs node@22 on this monorepo. Suppress the noise; emit correctness is-// verified by the size of dist/index.d.mts (≈106 kB with the expected types).-const dtsEmitFallbackNotice = '[rolldown-plugin-dts] Warning: Failed to emit declaration file';-const originalWarn = console.warn;-console.warn = (...args: unknown[]) => {- if (typeof args[0] === 'string' && args[0].startsWith(dtsEmitFallbackNotice)) {- return;- }- originalWarn(...args);-};-// Native addons stay external in EVERY build — they ship .node binaries// resolved at runtime and the desktop bundle places them under// app.asar.unpacked/node_modules/.@@ -119,7 +101,7 @@ const sharedPlugins: NonNullable<UserConfig['plugins']> = [];const sharedInputOptions: NonNullable<UserConfig['inputOptions']> = (options) => {- // Filter known false-positive warnings. Each branch documents WHY the+ // Filter a known false-positive warning. The branch below documents WHY the// warning is suppressed — re-evaluate when bumping rolldown / tsdown /// rolldown-plugin-dts. Anything not matched falls through to default.options.onLog = (level, log, defaultHandler) => {@@ -134,28 +116,6 @@ const sharedInputOptions: NonNullable<UserConfig['inputOptions']> = (options) =>) {return;}- // rolldown-plugin-dts strips `type` modifiers from emitted intermediate- // .d.ts before tracing cross-package re-exports, then warns that the- // names "are not exported as values". The recommended fix (`dts.eager`)- // forces tsc over the full tsconfig graph and OOMs node@22 on this- // monorepo. The names ARE exported as types in source and are correctly- // bundled into the final dist/index.d.mts.- if (- log.code === 'MISSING_EXPORT' &&- typeof log.id === 'string' &&- (log.id.endsWith('/src/commands/init.d.ts') || log.id.endsWith('/src/config/schema.d.ts'))- ) {- return;- }- // Same root cause as MISSING_EXPORT above — the plugin advises- // enabling `eager` after a fall-back emit; that path OOMs.- if (- log.pluginCode === 'rolldown-plugin-dts' &&- typeof log.message === 'string' &&- log.message.includes('Failed to emit declaration file')- ) {- return;- }defaultHandler(level, log);};return options;@@ -180,7 +140,7 @@ export default defineConfig([entry: { cli: 'src/cli.ts', 'parse-worker': 'src/parse-worker.ts' },unbundle: false,format: 'esm',- dts: true,+ dts: false,clean: false,minify: true,plugins: sharedPlugins,@@ -200,7 +160,7 @@ export default defineConfig([entry: { index: 'src/index.ts' },unbundle: false,format: 'esm',- dts: true,+ dts: { tsconfig: 'tsconfig.build.json' },clean: false,minify: true,plugins: sharedPlugins,diff --git a/packages/core/package.json b/packages/core/package.jsonindex d5fc0cf33..6ec5f6fb2 100644--- a/packages/core/package.json+++ b/packages/core/package.json@@ -6,63 +6,75 @@"type": "module","exports": {".": {+ "@inkeep/source": "./src/index.ts","development": "./src/index.ts",- "types": "./src/index.ts",+ "types": "./dist/index.d.mts","default": "./dist/index.mjs"},"./shadow-repo-layout": {+ "@inkeep/source": "./src/shadow-repo-layout.ts","development": "./src/shadow-repo-layout.ts",- "types": "./src/shadow-repo-layout.ts",+ "types": "./dist/shadow-repo-layout.d.mts","default": "./dist/shadow-repo-layout.mjs"},"./git-repository": {+ "@inkeep/source": "./src/git-repository.ts","development": "./src/git-repository.ts",- "types": "./src/git-repository.ts",+ "types": "./dist/git-repository.d.mts","default": "./dist/git-repository.mjs"},"./server": {+ "@inkeep/source": "./src/server.ts","development": "./src/server.ts",- "types": "./src/server.ts",+ "types": "./dist/server.d.mts","default": "./dist/server.mjs"},"./keepalive": {+ "@inkeep/source": "./src/keepalive/keepalive.ts","development": "./src/keepalive/keepalive.ts",- "types": "./src/keepalive/keepalive.ts",+ "types": "./dist/keepalive.d.mts","default": "./dist/keepalive.mjs"},"./helper-bundle": {+ "@inkeep/source": "./src/helper-bundle.ts","development": "./src/helper-bundle.ts",- "types": "./src/helper-bundle.ts",+ "types": "./dist/helper-bundle.d.mts","default": "./dist/helper-bundle.mjs"},"./skills-catalog": {+ "@inkeep/source": "./src/skills-catalog/index.ts","development": "./src/skills-catalog/index.ts",- "types": "./src/skills-catalog/index.ts",+ "types": "./dist/skills-catalog.d.mts","default": "./dist/skills-catalog.mjs"},"./acp/thread-protocol": {+ "@inkeep/source": "./src/acp/thread-protocol.ts","development": "./src/acp/thread-protocol.ts",- "types": "./src/acp/thread-protocol.ts",+ "types": "./dist/acp-thread-protocol.d.mts","default": "./dist/acp-thread-protocol.mjs"},"./acp/agent-posture": {+ "@inkeep/source": "./src/acp/agent-posture.ts","development": "./src/acp/agent-posture.ts",- "types": "./src/acp/agent-posture.ts",+ "types": "./dist/acp-agent-posture.d.mts","default": "./dist/acp-agent-posture.mjs"},"./acp/permissive-mode": {+ "@inkeep/source": "./src/acp/permissive-mode.ts","development": "./src/acp/permissive-mode.ts",- "types": "./src/acp/permissive-mode.ts",+ "types": "./dist/acp-permissive-mode.d.mts","default": "./dist/acp-permissive-mode.mjs"},"./acp/codex-legacy-notice": {+ "@inkeep/source": "./src/acp/codex-legacy-notice.ts","development": "./src/acp/codex-legacy-notice.ts",- "types": "./src/acp/codex-legacy-notice.ts",+ "types": "./dist/acp-codex-legacy-notice.d.mts","default": "./dist/acp-codex-legacy-notice.mjs"},"./desktop-bridge": {+ "@inkeep/source": "./src/desktop-bridge.ts","development": "./src/desktop-bridge.ts",- "types": "./src/desktop-bridge.ts",+ "types": "./dist/desktop-bridge.d.mts","default": "./dist/desktop-bridge.mjs"}},@@ -131,9 +143,10 @@"zod": "^4.3.6"},"scripts": {- "build": "tsdown",+ "build": "tsdown && pnpm run verify:exports",+ "verify:exports": "node scripts/verify-exports-targets.mjs","typecheck": "tsc --noEmit",- "test": "vitest run src/ tests/contract/",+ "test": "vitest run src/ tests/contract/ scripts/","test:perf:bench": "RUN_BENCH=1 vitest run tests/perf/markdown-bench.test.ts","test:perf:regression:unit": "vitest run tests/perf/regression-gate.test.ts","test:perf:regression": "tsx tests/perf/run-regression-gate.ts",@@ -161,8 +174,8 @@"mdast-util-to-hast": "^13.2.1","micromark": "^4.0.2","micromark-util-symbol": "^2.0.1",- "tsdown": "^0.21.7",- "typescript": "^5.9.3",+ "tsdown": "^0.22.14",+ "typescript": "~7.0.2","y-prosemirror": "1.3.7"}}diff --git a/packages/core/scripts/verify-exports-targets.mjs b/packages/core/scripts/verify-exports-targets.mjsnew file mode 100644index 000000000..869e3bf18--- /dev/null+++ b/packages/core/scripts/verify-exports-targets.mjs@@ -0,0 +1,134 @@+import { existsSync, readdirSync, readFileSync, statSync } from 'node:fs';+import { dirname, join, relative, resolve } from 'node:path';+import { fileURLToPath } from 'node:url';++const PACKAGE_ROOT = resolve(dirname(fileURLToPath(import.meta.url)), '..');++export const REQUIRED_CONDITIONS = ['types', 'default'];++const RELATIVE_IMPORT = /\bfrom\s*["'](\.\.?\/[^"']+)["']|\bimport\s*["'](\.\.?\/[^"']+)["']/g;++export function nestedRelativeImports(source) {+ const nested = [];+ for (const match of source.matchAll(RELATIVE_IMPORT)) {+ const specifier = match[1] ?? match[2];+ if (specifier.startsWith('../') || specifier.slice(2).includes('/')) nested.push(specifier);+ }+ return nested;+}++export function collectExportTargets(exportsMap) {+ const targets = [];++ const walk = (subpath, condition, node) => {+ if (typeof node === 'string') {+ targets.push({ subpath, condition, target: node });+ return;+ }+ if (Array.isArray(node)) {+ for (const element of node) walk(subpath, condition, element);+ return;+ }+ if (node === null || typeof node !== 'object') return;+ for (const [key, value] of Object.entries(node)) walk(subpath, key, value);+ };++ if (exportsMap === null || typeof exportsMap !== 'object' || Array.isArray(exportsMap)) {+ return targets;+ }+ for (const [subpath, node] of Object.entries(exportsMap)) walk(subpath, 'default', node);+ return targets;+}++export function validateExportsTargets(exportsMap, fileExists, readTarget) {+ const errors = [];++ if (exportsMap === null || typeof exportsMap !== 'object' || Array.isArray(exportsMap)) {+ return ['package.json has no exports map'];+ }++ const subpaths = Object.entries(exportsMap);+ if (subpaths.length === 0) errors.push('package.json exports map is empty');++ for (const [subpath, node] of subpaths) {+ const conditions =+ node !== null && typeof node === 'object' && !Array.isArray(node) ? Object.keys(node) : [];+ for (const required of REQUIRED_CONDITIONS) {+ if (!conditions.includes(required)) {+ errors.push(`exports["${subpath}"] declares no "${required}" condition`);+ }+ }+ }++ const readJsTargets = new Set();+ for (const { subpath, condition, target } of collectExportTargets(exportsMap)) {+ if (!target.startsWith('./')) {+ errors.push(`exports["${subpath}"].${condition} is "${target}", not a "./" relative path`);+ continue;+ }+ if (!fileExists(target)) {+ errors.push(+ `exports["${subpath}"].${condition} points at ${target}, which is not a non-empty file on disk`,+ );+ continue;+ }+ if (/\.[cm]?js$/.test(target) && !readJsTargets.has(target)) {+ readJsTargets.add(target);+ const nested = nestedRelativeImports(readTarget(target));+ if (nested.length > 0) {+ errors.push(+ `exports["${subpath}"].${condition} target ${target} imports ${nested.join(', ')}; a JS entry's relative imports must all be flat siblings (an unbundled JS pass emits nested ones)`,+ );+ }+ }+ }++ return errors;+}++export function jsBelowDistTopLevel(distDir, listEntries = readdirSync) {+ return listEntries(distDir, { recursive: true, withFileTypes: true })+ .filter(+ (entry) => entry.isFile() && /\.[cm]?js$/.test(entry.name) && entry.parentPath !== distDir,+ )+ .map((entry) => relative(distDir, join(entry.parentPath, entry.name)))+ .sort();+}++export function verifyExportsTargets(packageRoot = PACKAGE_ROOT) {+ const packageJson = JSON.parse(readFileSync(join(packageRoot, 'package.json'), 'utf8'));+ const errors = validateExportsTargets(+ packageJson.exports,+ (target) => {+ const absolute = join(packageRoot, target);+ if (!existsSync(absolute)) return false;+ const stats = statSync(absolute);+ return stats.isFile() && stats.size > 0;+ },+ (target) => readFileSync(join(packageRoot, target), 'utf8'),+ );++ const distDir = join(packageRoot, 'dist');+ const nestedJs = existsSync(distDir) ? jsBelowDistTopLevel(distDir) : [];+ if (nestedJs.length > 0) {+ errors.push(+ `dist carries JS below its top level (${nestedJs.join(', ')}); core's dist is contractually flat: a downstream consumer vendors a JS entry's transitive ./*.mjs closure by resolving every specifier against the dist root and writing each member back at that dist-relative path into a flat directory, so a nested member breaks that copy. This check is deliberately stricter than any one entry's closure: a nested chunk reachable only from another entry also reds`,+ );+ }++ if (errors.length > 0) {+ throw new Error(+ `${packageJson.name} exports targets are not all on disk or not flat. Run \`pnpm --filter ${packageJson.name} build\` and check tsdown's entry map against package.json exports.\n- ${errors.join('\n- ')}`,+ );+ }++ const subpathCount = Object.keys(packageJson.exports).length;+ const targetCount = collectExportTargets(packageJson.exports).length;+ console.log(+ `Exports targets verified (${subpathCount} subpaths, ${targetCount} condition targets on disk, JS targets flat).`,+ );+}++if (process.argv[1] && fileURLToPath(import.meta.url) === resolve(process.argv[1])) {+ verifyExportsTargets();+}diff --git a/packages/core/scripts/verify-exports-targets.test.ts b/packages/core/scripts/verify-exports-targets.test.tsnew file mode 100644index 000000000..dac868c94--- /dev/null+++ b/packages/core/scripts/verify-exports-targets.test.ts@@ -0,0 +1,249 @@+import { mkdirSync, mkdtempSync, readFileSync, rmSync, writeFileSync } from 'node:fs';+import { tmpdir } from 'node:os';+import { dirname, join } from 'node:path';+import { fileURLToPath } from 'node:url';+import { afterEach, describe, expect, it } from 'vitest';+import {+ collectExportTargets,+ jsBelowDistTopLevel,+ nestedRelativeImports,+ REQUIRED_CONDITIONS,+ validateExportsTargets,+ verifyExportsTargets,+} from './verify-exports-targets.mjs';++type ExportTarget = { subpath: string; condition: string; target: string };++const PACKAGE_ROOT = join(dirname(fileURLToPath(import.meta.url)), '..');++const CORE_EXPORTS = JSON.parse(readFileSync(join(PACKAGE_ROOT, 'package.json'), 'utf8'))+ .exports as Record<string, Record<string, string>>;++const allExist = () => true;++const scratchRoots: string[] = [];++const makePackageRoot = (packageJson: unknown, files: string[]) => {+ const root = mkdtempSync(join(tmpdir(), 'ok-exports-targets-'));+ scratchRoots.push(root);+ writeFileSync(join(root, 'package.json'), JSON.stringify(packageJson));+ for (const file of files) {+ const absolute = join(root, file);+ mkdirSync(dirname(absolute), { recursive: true });+ writeFileSync(absolute, 'export {};\n');+ }+ return root;+};++afterEach(() => {+ while (scratchRoots.length > 0) {+ rmSync(scratchRoots.pop() as string, { recursive: true, force: true });+ }+});++describe('collectExportTargets', () => {+ it('flattens every subpath and condition of the real core exports map', () => {+ const targets = collectExportTargets(CORE_EXPORTS) as ExportTarget[];++ const expected = Object.entries(CORE_EXPORTS).flatMap(([subpath, conditions]) =>+ Object.entries(conditions).map(([condition, target]) => ({ subpath, condition, target })),+ );++ expect(targets).toEqual(expected);+ expect(targets.length).toBeGreaterThan(0);+ });++ it('descends into nested condition objects and arrays', () => {+ expect(+ collectExportTargets({+ '.': { node: { types: './dist/a.d.mts', default: './dist/a.mjs' } },+ './b': { default: ['./dist/b.mjs'] },+ }),+ ).toEqual([+ { subpath: '.', condition: 'types', target: './dist/a.d.mts' },+ { subpath: '.', condition: 'default', target: './dist/a.mjs' },+ { subpath: './b', condition: 'default', target: './dist/b.mjs' },+ ]);+ });+});++describe('validateExportsTargets', () => {+ const map = {+ '.': { types: './dist/index.d.mts', default: './dist/index.mjs' },+ './acp/agent-posture': {+ types: './dist/acp-agent-posture.d.mts',+ default: './dist/acp-agent-posture.mjs',+ },+ };++ it('accepts the real core exports map when every target is on disk', () => {+ expect(validateExportsTargets(CORE_EXPORTS, allExist, () => '')).toEqual([]);+ });++ it('reds when a declarations target is missing', () => {+ expect(+ validateExportsTargets(+ map,+ (target: string) => target !== './dist/acp-agent-posture.d.mts',+ () => '',+ ),+ ).toEqual([+ 'exports["./acp/agent-posture"].types points at ./dist/acp-agent-posture.d.mts, which is not a non-empty file on disk',+ ]);+ });++ it('reds when a runtime target is missing, which is the entry-rename failure mode', () => {+ expect(+ validateExportsTargets(+ map,+ (target: string) => target !== './dist/acp-agent-posture.mjs',+ () => '',+ ),+ ).toEqual([+ 'exports["./acp/agent-posture"].default points at ./dist/acp-agent-posture.mjs, which is not a non-empty file on disk',+ ]);+ });++ it('reds once per required condition a subpath fails to declare', () => {+ expect(+ validateExportsTargets({ './server': { default: './dist/server.mjs' } }, allExist, () => ''),+ ).toEqual(['exports["./server"] declares no "types" condition']);+ expect(REQUIRED_CONDITIONS).toEqual(['types', 'default']);+ });++ it('reds on a target that is not a relative path', () => {+ expect(+ validateExportsTargets(+ { '.': { types: 'dist/index.d.mts', default: './dist/index.mjs' } },+ allExist,+ () => '',+ ),+ ).toEqual(['exports["."].types is "dist/index.d.mts", not a "./" relative path']);+ });++ it('reds when the exports map is absent or empty', () => {+ expect(validateExportsTargets(undefined, allExist, () => '')).toEqual([+ 'package.json has no exports map',+ ]);+ expect(validateExportsTargets({}, allExist, () => '')).toEqual([+ 'package.json exports map is empty',+ ]);+ });+});++describe('nestedRelativeImports', () => {+ it('reports only multi-segment relative specifiers', () => {+ const source = [+ 'import { a } from "./sleep-B-7-ikbJ.mjs";',+ 'import "./bridge/diff-lines.mjs";',+ 'import { b } from "../core/x.mjs";',+ 'import { c } from "zod";',+ ].join('\n');+ expect(nestedRelativeImports(source)).toEqual(['./bridge/diff-lines.mjs', '../core/x.mjs']);+ });+});++describe('validateExportsTargets flat JS closure', () => {+ const map = {+ '.': { types: './dist/index.d.mts', import: './dist/index.mjs', default: './dist/index.mjs' },+ };+ const allExist = () => true;++ it('is silent when the default target imports only flat siblings', () => {+ const read = () => 'import { x } from "./ok-dir-B1t7FLiw.mjs";';+ expect(validateExportsTargets(map, allExist, read)).toEqual([]);+ });++ it('reds when the default target imports a nested path, the shape an unbundled JS pass emits', () => {+ const read = () => 'import { diffLinesFast } from "./bridge/diff-lines.mjs";';+ const errors = validateExportsTargets(map, allExist, read);+ expect(errors).toHaveLength(1);+ expect(errors[0]).toContain('./bridge/diff-lines.mjs');+ expect(errors[0]).toContain('flat siblings');+ });++ it('reads only JS-valued targets, whatever their condition', () => {+ const seen: string[] = [];+ const read = (target: string) => {+ seen.push(target);+ return '';+ };+ validateExportsTargets(map, allExist, read);+ expect(seen).toEqual(['./dist/index.mjs']);+ });+});++describe('jsBelowDistTopLevel', () => {+ it('lists only JS files that sit below the dist top level', () => {+ const root = mkdtempSync(join(tmpdir(), 'exports-dist-'));+ const dist = join(root, 'dist');+ mkdirSync(join(dist, 'bridge'), { recursive: true });+ writeFileSync(join(dist, 'index.mjs'), 'export {};\n');+ writeFileSync(join(dist, 'index.d.mts'), 'export {};\n');+ writeFileSync(join(dist, 'bridge', 'diff-lines.mjs'), 'export {};\n');+ writeFileSync(join(dist, 'bridge', 'diff-lines.d.mts'), 'export {};\n');+ try {+ expect(jsBelowDistTopLevel(dist)).toEqual(['bridge/diff-lines.mjs']);+ } finally {+ rmSync(root, { recursive: true, force: true });+ }+ });+});++describe('verifyExportsTargets', () => {+ const packageJson = {+ name: '@inkeep/open-knowledge-core-fixture',+ exports: {+ '.': {+ '@inkeep/source': './src/index.ts',+ types: './dist/index.d.mts',+ default: './dist/index.mjs',+ },+ },+ };+ const files = ['src/index.ts', 'dist/index.d.mts', 'dist/index.mjs'];++ it('passes when every declared target is a non-empty file', () => {+ expect(() => verifyExportsTargets(makePackageRoot(packageJson, files))).not.toThrow();+ });++ it('throws naming the missing file when a dist target is absent', () => {+ const root = makePackageRoot(+ packageJson,+ files.filter((file) => file !== 'dist/index.mjs'),+ );++ expect(() => verifyExportsTargets(root)).toThrow(+ /exports\["\."\]\.default points at \.\/dist\/index\.mjs/,+ );+ });++ it('throws when a dist target exists but is empty', () => {+ const root = makePackageRoot(packageJson, files);+ writeFileSync(join(root, 'dist/index.d.mts'), '');++ expect(() => verifyExportsTargets(root)).toThrow(+ /exports\["\."\]\.types points at \.\/dist\/index\.d\.mts/,+ );+ });+ it('throws when the runtime target imports a nested path, so the real reader is wired', () => {+ const root = makePackageRoot(packageJson, files);+ writeFileSync(join(root, 'dist/index.mjs'), 'import { d } from "./bridge/diff-lines.mjs";\n');+ try {+ expect(() => verifyExportsTargets(root)).toThrow(/flat siblings/);+ } finally {+ rmSync(root, { recursive: true, force: true });+ }+ });++ it('throws when dist carries JS below its top level, the shape a dist-relative vendor write into a flat directory cannot take', () => {+ const root = makePackageRoot(packageJson, files);+ mkdirSync(join(root, 'dist/bridge'), { recursive: true });+ writeFileSync(join(root, 'dist/bridge/diff-lines.mjs'), 'export {};\n');+ try {+ expect(() => verifyExportsTargets(root)).toThrow(/below its top level/);+ } finally {+ rmSync(root, { recursive: true, force: true });+ }+ });+});diff --git a/packages/core/src/acp/codex-legacy-notice.test.ts b/packages/core/src/acp/codex-legacy-notice.test.tsindex 5b4da7b4f..aa52e5906 100644--- a/packages/core/src/acp/codex-legacy-notice.test.ts+++ b/packages/core/src/acp/codex-legacy-notice.test.ts@@ -39,11 +39,12 @@ const HEADS = [const TAILS = [TERMINATOR, '\nx', 'x\n', ' ', 'ab'];describe('isCodexLegacyWarningUpdate — recorded producer envelopes', () => {- test.each(- fixture.candidates.map((c) => [c.name, c] as const),- )('accepts %s', (_name, candidate) => {- expect(isCodexLegacyWarningUpdate(asUpdate(candidate.update), CODEX)).toBe(true);- });+ test.each(fixture.candidates.map((c) => [c.name, c] as const))(+ 'accepts %s',+ (_name, candidate) => {+ expect(isCodexLegacyWarningUpdate(asUpdate(candidate.update), CODEX)).toBe(true);+ },+ );test('a config warning with internal detail paragraphs matches as ONE candidate', () => {const configWarning = fixture.candidates.find((c) => c.name === 'config-warning-with-details');diff --git a/packages/core/src/config/write-config-patch.test.ts b/packages/core/src/config/write-config-patch.test.tsindex 04bdf7ae1..462da3bad 100644--- a/packages/core/src/config/write-config-patch.test.ts+++ b/packages/core/src/config/write-config-patch.test.ts@@ -538,25 +538,25 @@ describe('writeConfigPatch — scope-violation gate', () => {expect(existsSync(userConfigPath(testDir))).toBe(false);});- test.each([- 'project',- 'user',- ] as const)('%s writer rejects terminal.shell with SCOPE_VIOLATION', async (scope) => {- const result = await writeConfigPatch({- cwd: testDir,- scope,- homedirOverride: testDir,- patch: { terminal: { shell: 'C:\\Tools\\pwsh.exe' } },- });- expect(result.ok).toBe(false);- if (result.ok) throw new Error('expected SCOPE_VIOLATION');- if (!isKnownConfigError(result.error)) throw new Error('expected known error');- expect(result.error.code).toBe('SCOPE_VIOLATION');- if (result.error.code !== 'SCOPE_VIOLATION') throw new Error('wrong code');- expect(result.error.path).toEqual(['terminal', 'shell']);- expect(result.error.expectedScope).toBe('project-local');- expect(result.error.actualScope).toBe(scope);- });+ test.each(['project', 'user'] as const)(+ '%s writer rejects terminal.shell with SCOPE_VIOLATION',+ async (scope) => {+ const result = await writeConfigPatch({+ cwd: testDir,+ scope,+ homedirOverride: testDir,+ patch: { terminal: { shell: 'C:\\Tools\\pwsh.exe' } },+ });+ expect(result.ok).toBe(false);+ if (result.ok) throw new Error('expected SCOPE_VIOLATION');+ if (!isKnownConfigError(result.error)) throw new Error('expected known error');+ expect(result.error.code).toBe('SCOPE_VIOLATION');+ if (result.error.code !== 'SCOPE_VIOLATION') throw new Error('wrong code');+ expect(result.error.path).toEqual(['terminal', 'shell']);+ expect(result.error.expectedScope).toBe('project-local');+ expect(result.error.actualScope).toBe(scope);+ },+ );});describe('writeConfigPatch — concurrent writes (file lock)', () => {diff --git a/packages/core/src/constants/upload.test.ts b/packages/core/src/constants/upload.test.tsindex 829e6aa98..97c61018f 100644--- a/packages/core/src/constants/upload.test.ts+++ b/packages/core/src/constants/upload.test.ts@@ -232,16 +232,12 @@ describe('mediaKindForSidebarAssetExtension', () => {expect(mediaKindForSidebarAssetExtension('LOCK')).toBe('text');});- test.each([- 'csv',- 'docx',- 'zip',- 'mkv',- 'svg',- 'tiff',- ])('returns null for non-sidebar-renderable extension %s', (ext) => {- expect(mediaKindForSidebarAssetExtension(ext)).toBeNull();- });+ test.each(['csv', 'docx', 'zip', 'mkv', 'svg', 'tiff'])(+ 'returns null for non-sidebar-renderable extension %s',+ (ext) => {+ expect(mediaKindForSidebarAssetExtension(ext)).toBeNull();+ },+ );test('normalizes leading dot + case', () => {expect(mediaKindForSidebarAssetExtension('.MP3')).toBe('audio');diff --git a/packages/core/src/extensions/input-rule-text.test.ts b/packages/core/src/extensions/input-rule-text.test.tsindex 9c16e80a7..7432e8b1e 100644--- a/packages/core/src/extensions/input-rule-text.test.ts+++ b/packages/core/src/extensions/input-rule-text.test.ts@@ -45,23 +45,24 @@ describe('renderInlineObjectText', () => {});describe('input-rule matching text is position-faithful', () => {- it.each(- inlineObjectTypes().map((type) => [type.name, type] as const),- )('%s contributes exactly the positions it occupies', (_name, type) => {- const node = sample(type);- expect(node).not.toBeNull();- const paragraph = schema.nodes.paragraph?.create(null, [- schema.text('x'),- node as PMNode,- schema.text('y'),- ]);- expect(paragraph).toBeDefined();- const doc = schema.nodes.doc?.createAndFill(null, [paragraph as PMNode]);- expect(doc).not.toBeNull();- const $end = (doc as PMNode).resolve(1 + (paragraph as PMNode).content.size);+ it.each(inlineObjectTypes().map((type) => [type.name, type] as const))(+ '%s contributes exactly the positions it occupies',+ (_name, type) => {+ const node = sample(type);+ expect(node).not.toBeNull();+ const paragraph = schema.nodes.paragraph?.create(null, [+ schema.text('x'),+ node as PMNode,+ schema.text('y'),+ ]);+ expect(paragraph).toBeDefined();+ const doc = schema.nodes.doc?.createAndFill(null, [paragraph as PMNode]);+ expect(doc).not.toBeNull();+ const $end = (doc as PMNode).resolve(1 + (paragraph as PMNode).content.size);- expect(getTextContentFromNodes($end)).toHaveLength($end.parentOffset);- });+ expect(getTextContentFromNodes($end)).toHaveLength($end.parentOffset);+ },+ );it('never falls back to the six-character %leaf% sentinel', () => {for (const type of inlineObjectTypes()) {diff --git a/packages/core/src/extensions/link-fidelity.test.ts b/packages/core/src/extensions/link-fidelity.test.tsindex efac5921e..51800f4c0 100644--- a/packages/core/src/extensions/link-fidelity.test.ts+++ b/packages/core/src/extensions/link-fidelity.test.ts@@ -1,9 +1,13 @@+import Link from '@tiptap/extension-link';import { describe, expect, test } from 'vitest';import { LinkFidelity } from './link-fidelity.ts';-const opts = LinkFidelity.config.addOptions?.call({ parent: undefined } as never) as {+const opts = LinkFidelity.config.addOptions?.call({+ parent: () => Link.config.addOptions?.call({ parent: undefined } as never),+} as never) as {isAllowedUri: (url: string) => boolean;- validate: (url: string) => boolean;+ shouldAutoLink: (url: string) => boolean;+ validate?: (url: string) => boolean;};describe('LinkFidelity.isAllowedUri — allowlist posture', () => {@@ -52,11 +56,46 @@ describe('LinkFidelity.isAllowedUri — allowlist posture', () => {});});-describe('LinkFidelity.validate — same gate as isAllowedUri', () => {- test('shares the allowlist with isAllowedUri', () => {- expect(opts.validate('https://example.com')).toBe(true);- expect(opts.validate('javascript:alert(1)')).toBe(false);- expect(opts.validate('file:///etc/passwd')).toBe(false);- expect(opts.validate('/relative')).toBe(true);+describe('LinkFidelity autolink gating — isAllowedUri is the sole allowlist', () => {+ test('shouldAutoLink admits everything, leaving isAllowedUri as the only gate', () => {+ expect(opts.isAllowedUri('https://example.com')).toBe(true);+ expect(opts.isAllowedUri('javascript:alert(1)')).toBe(false);+ expect(opts.isAllowedUri('file:///etc/passwd')).toBe(false);+ expect(opts.isAllowedUri('/relative')).toBe(true);+ expect(opts.shouldAutoLink('https://example.com')).toBe(true);+ expect(opts.shouldAutoLink('javascript:alert(1)')).toBe(true);+ });++ test('the deprecated validate option is inherited, never redeclared as a second gate', () => {+ const own = LinkFidelity.config.addOptions?.call({ parent: () => ({}) } as never) as Record<+ string,+ unknown+ >;+ expect('validate' in own).toBe(false);+ expect('isAllowedUri' in own).toBe(true);+ expect('shouldAutoLink' in own).toBe(true);+ });+});++describe('LinkFidelity refuses to build against no parent', () => {+ test('addOptions throws rather than returning an option set with no Link defaults', () => {+ expect(() => LinkFidelity.config.addOptions?.call({ parent: undefined } as never)).toThrow(+ /must be derived from the Link extension/,+ );+ });++ test('addAttributes throws rather than spreading undefined over the attribute map', () => {+ expect(() => LinkFidelity.config.addAttributes?.call({ parent: undefined } as never)).toThrow(+ /must be derived from the Link extension/,+ );+ });++ test('addAttributes keeps the inherited attributes when a parent is present', () => {+ const attrs = LinkFidelity.config.addAttributes?.call({+ parent: () => ({ href: { default: null } }),+ } as never) as Record<string, unknown>;++ expect('href' in attrs).toBe(true);+ expect('linkStyle' in attrs).toBe(true);});});diff --git a/packages/core/src/extensions/link-fidelity.ts b/packages/core/src/extensions/link-fidelity.tsindex 0c86f5c90..7b6ae485f 100644--- a/packages/core/src/extensions/link-fidelity.ts+++ b/packages/core/src/extensions/link-fidelity.ts@@ -16,11 +16,18 @@ export function isAllowedLinkUri(url: string): boolean {}}+const DERIVATION_ERROR = 'LinkFidelity must be derived from the Link extension';+export const LinkFidelity = Link.extend({priority: 60,addOptions() {+ const inherited = this.parent?.();+ if (inherited === undefined) {+ throw new Error(DERIVATION_ERROR);+ }return {+ ...inherited,openOnClick: false,enableClickSelection: false,linkOnPaste: true,@@ -32,14 +39,17 @@ export const LinkFidelity = Link.extend({rel: 'noopener noreferrer',},isAllowedUri: isAllowedLinkUri,- validate: isAllowedLinkUri,shouldAutoLink: () => true,};},addAttributes() {+ const inherited = this.parent?.();+ if (inherited === undefined) {+ throw new Error(DERIVATION_ERROR);+ }return {- ...this.parent?.(),+ ...inherited,linkStyle: { default: 'inline', rendered: false },refLabel: { default: null, rendered: false },sourceForm: { default: null, rendered: false },diff --git a/packages/core/src/extensions/list-boundary-merge.ts b/packages/core/src/extensions/list-boundary-merge.tsindex ec800cc2e..ad9e81899 100644--- a/packages/core/src/extensions/list-boundary-merge.ts+++ b/packages/core/src/extensions/list-boundary-merge.ts@@ -62,7 +62,7 @@ function cursorOf(state: EditorState): ResolvedPos | null {function isNestedBoundaryBackspace(state: EditorState): boolean {const $cursor = cursorOf(state);- if (!$cursor || $cursor.parentOffset !== 0) return false;+ if ($cursor?.parentOffset !== 0) return false;const li = listItemDepth($cursor);if (li === null) return false;if ($cursor.depth !== li + 1 || $cursor.index(li) !== 0) return false;diff --git a/packages/core/src/i18n/direction.ts b/packages/core/src/i18n/direction.tsindex 4b132cfa7..99c8b8bcd 100644--- a/packages/core/src/i18n/direction.ts+++ b/packages/core/src/i18n/direction.ts@@ -2,7 +2,7 @@ import type { SupportedLocale } from './locales.ts';export type TextDirection = 'ltr' | 'rtl';-interface TextInfoCapable extends Intl.Locale {+interface TextInfoCapable {getTextInfo?: () => { readonly direction?: unknown };}@@ -22,7 +22,7 @@ const STATIC_DIRECTIONS: Record<SupportedLocale, TextDirection> = {};export function localeDirection(locale: SupportedLocale): TextDirection {- const candidate: TextInfoCapable = new Intl.Locale(locale);+ const candidate: Intl.Locale & TextInfoCapable = new Intl.Locale(locale);const direction = candidate.getTextInfo?.().direction;if (direction === 'rtl' || direction === 'ltr') return direction;return STATIC_DIRECTIONS[locale];diff --git a/packages/core/src/index.ts b/packages/core/src/index.tsindex ff6ab74bf..bdc6cf0d8 100644--- a/packages/core/src/index.ts+++ b/packages/core/src/index.ts@@ -870,6 +870,8 @@ export {isFrontmatterScoped,isMarkdownlintJsonConfig,isOkfRuleEnabled,+ isReLintFailedWarning,+ isReLintFailureReason,isSupportedSchemaDialect,isToolManagedSchemaPath,LINKS_VALIDATION_SETTINGS,@@ -923,6 +925,11 @@ export {okfAdvertisedSchemaMappings,okfSchemaPathFor,type PersistedLinterConfig,+ RE_LINT_FAILED_WARNING_PREFIX,+ RE_LINT_FAILURE_REASONS,+ type ReLintFailure,+ type ReLintFailureReason,+ ReLintFailureSchema,type ResolvedFrontmatterSchemaEntry,RULE_DISPLAY_CATEGORIES,type RuleCatalogEntry,@@ -1086,6 +1093,7 @@ export {type ApiConfigSuccess,ApiConfigSuccessSchema,assertNeverProblemType,+ assertNeverWriteWarning,type BacklinkCountsSuccess,BacklinkCountsSuccessSchema,type BacklinkEntry,@@ -1222,6 +1230,7 @@ export {isBranchNotFoundGitError,isLoginFixableGitAuthError,isValidBranchName,+ isWriteWarningKind,type LifecycleStatus,LifecycleStatusSchema,type LinkGraphDocNode,@@ -1630,7 +1639,9 @@ export {type WatcherDecisionEntryWire,type WorkspaceSuccess,WorkspaceSuccessSchema,+ WRITE_WARNING_KINDS,type WriteWarning,+ type WriteWarningKind,WriteWarningSchema,} from './schemas/api/index.ts';export {diff --git a/packages/core/src/logging/renderer-log.test.ts b/packages/core/src/logging/renderer-log.test.tsindex db1679099..ca2be6d1a 100644--- a/packages/core/src/logging/renderer-log.test.ts+++ b/packages/core/src/logging/renderer-log.test.ts@@ -102,7 +102,7 @@ describe('parseStructuredConsoleMessage', () => {);expect(JSON.stringify(out?.fields)).not.toContain(secret);expect(JSON.stringify(out?.fields)).toContain('[REDACTED-GH-PAT]');- expect((out?.fields.nested as Record<string, unknown>).inner).toBeTypeOf('string');+ expect((out?.fields.nested as Record<string, unknown> | undefined)?.inner).toBeTypeOf('string');expect(Array.isArray(out?.fields.list)).toBe(true);});diff --git a/packages/core/src/markdown/image-promoter.ts b/packages/core/src/markdown/image-promoter.tsindex 706fa9afb..9942525e5 100644--- a/packages/core/src/markdown/image-promoter.ts+++ b/packages/core/src/markdown/image-promoter.ts@@ -9,7 +9,7 @@ export function imagePromoterPlugin() {if (node.children.length !== 1) return;const child = node.children[0];- if (!child || child.type !== 'image') return;+ if (child?.type !== 'image') return;const image = child as Image;const element = buildImageElement(image, node);diff --git a/packages/core/src/markdown/indented-code-promoter.ts b/packages/core/src/markdown/indented-code-promoter.tsindex 1f9517dae..eeeeea724 100644--- a/packages/core/src/markdown/indented-code-promoter.ts+++ b/packages/core/src/markdown/indented-code-promoter.ts@@ -74,7 +74,7 @@ export const indentedCodePromoterPlugin: Plugin<[], Root> = function indentedCodif (!source) return;visit(tree, 'paragraph', (node, index, parent) => {- if (!parent || parent.type !== 'root' || index == null) return;+ if (parent?.type !== 'root' || index == null) return;const prev = parent.children[index - 1];if (prev && prev.type === 'list') return;const promoted = promoteParagraphToCode(node, source);diff --git a/packages/core/src/markdown/lint/config-schemas.ts b/packages/core/src/markdown/lint/config-schemas.tsindex cc667b93e..75723530c 100644--- a/packages/core/src/markdown/lint/config-schemas.ts+++ b/packages/core/src/markdown/lint/config-schemas.ts@@ -237,6 +237,26 @@ export const LintFixRequestSchema = z.loose();export type LintFixRequest = z.infer<typeof LintFixRequestSchema>;+export const RE_LINT_FAILED_WARNING_PREFIX = 'Re-lint after fix failed: ';++export function isReLintFailedWarning(warning: string): boolean {+ return warning.startsWith(RE_LINT_FAILED_WARNING_PREFIX);+}++export const RE_LINT_FAILURE_REASONS = ['re-lint-threw', 'source-went-blind'] as const;+export type ReLintFailureReason = (typeof RE_LINT_FAILURE_REASONS)[number];+export function isReLintFailureReason(reason: unknown): reason is ReLintFailureReason {+ return (+ typeof reason === 'string' && (RE_LINT_FAILURE_REASONS as readonly string[]).includes(reason)+ );+}++export const ReLintFailureSchema = z.object({+ reason: z.enum(RE_LINT_FAILURE_REASONS),+ message: z.string().min(1),+});+export type ReLintFailure = z.infer<typeof ReLintFailureSchema>;+export const LintFixResultSchema = z.object({file: z.string(),fixedCount: z.number(),@@ -245,6 +265,7 @@ export const LintFixResultSchema = z.object({warningCount: z.number(),ran: RunSourcesSchema,warnings: z.array(z.string()).optional(),- warning: z.string().optional(),+ diagnosticsArePreFix: z.boolean().optional(),+ reLintFailure: ReLintFailureSchema.optional(),});export type LintFixResult = z.infer<typeof LintFixResultSchema>;diff --git a/packages/core/src/markdown/lint/index.ts b/packages/core/src/markdown/lint/index.tsindex 7eafecb79..31c3b366c 100644--- a/packages/core/src/markdown/lint/index.ts+++ b/packages/core/src/markdown/lint/index.ts@@ -95,6 +95,8 @@ export {FrontmatterSchemasListSuccessSchema,type FrontmatterSchemaWriteRequest,FrontmatterSchemaWriteRequestSchema,+ isReLintFailedWarning,+ isReLintFailureReason,type LintAuditResponse,LintAuditResponseSchema,type LintConfigResponse,@@ -108,6 +110,11 @@ export {LintFixResultSchema,MarkdownlintRuleWriteRequestSchema,type PersistedLinterConfig,+ RE_LINT_FAILED_WARNING_PREFIX,+ RE_LINT_FAILURE_REASONS,+ type ReLintFailure,+ type ReLintFailureReason,+ ReLintFailureSchema,toEffectiveBase,type ValidationAuditCountsResponse,ValidationAuditCountsResponseSchema,diff --git a/packages/core/src/markdown/rehype-plugins/strip-gdocs-wrapper.ts b/packages/core/src/markdown/rehype-plugins/strip-gdocs-wrapper.tsindex 93151d43b..6a98d005d 100644--- a/packages/core/src/markdown/rehype-plugins/strip-gdocs-wrapper.ts+++ b/packages/core/src/markdown/rehype-plugins/strip-gdocs-wrapper.ts@@ -5,7 +5,7 @@ const GUID_PREFIX = 'docs-internal-guid-';function unwrap(parent: Element | Root, index: number): void {const node = parent.children[index] as Element;- if (!node || node.type !== 'element') return;+ if (node?.type !== 'element') return;parent.children.splice(index, 1, ...node.children);}diff --git a/packages/core/src/markdown/strip-trailing-edge.ts b/packages/core/src/markdown/strip-trailing-edge.tsindex d767012bc..356786b5a 100644--- a/packages/core/src/markdown/strip-trailing-edge.ts+++ b/packages/core/src/markdown/strip-trailing-edge.ts@@ -5,7 +5,7 @@ const MARK_WRAPPERS = new Set(['strong', 'emphasis', 'delete', 'link', 'mark', 'const HTML_BREAK_SPELLING = '<br />';function isBareTrailingBreak(node: RootContent | undefined): node is Break {- if (!node || node.type !== 'break') return false;+ if (node?.type !== 'break') return false;const sourceRaw = node.data?.sourceRaw;return typeof sourceRaw !== 'string' || sourceRaw.length === 0;}@@ -17,7 +17,7 @@ function respellAsHtmlBreak(node: Break): void {}function isPlainText(node: RootContent | undefined): node is Text {- if (!node || node.type !== 'text') return false;+ if (node?.type !== 'text') return false;const sourceRaw = (node.data as { sourceRaw?: unknown } | undefined)?.sourceRaw;return typeof sourceRaw !== 'string' || sourceRaw.length === 0;}diff --git a/packages/core/src/registry/registry.test.ts b/packages/core/src/registry/registry.test.tsindex 8ade7fb80..0cf46586c 100644--- a/packages/core/src/registry/registry.test.ts+++ b/packages/core/src/registry/registry.test.ts@@ -610,7 +610,7 @@ describe('placeholder contract — media descriptor src prop invariants', () =>expect(meta).toBeDefined();const src = meta?.props.find((p) => p.name === 'src');expect(src, `${name} must declare a src prop`).toBeDefined();- if (!src || src.type !== 'string') return;+ if (src?.type !== 'string') return;expect(src.defaultValue,`${name}.src must have defaultValue '' so slash-insert pre-populates the placeholder predicate's =='' check`,diff --git a/packages/core/src/schemas/api/agent-write.ts b/packages/core/src/schemas/api/agent-write.tsindex 86e2d7ef1..3a91cbc3e 100644--- a/packages/core/src/schemas/api/agent-write.ts+++ b/packages/core/src/schemas/api/agent-write.ts@@ -132,6 +132,24 @@ export const WriteWarningSchema = z.discriminatedUnion('kind', []);export type WriteWarning = z.infer<typeof WriteWarningSchema>;+const WRITE_WARNING_KIND_TABLE = {+ 'content-divergence': true,+ 'disk-edit-reconciled': true,+} as const satisfies Record<WriteWarning['kind'], true>;++export type WriteWarningKind = keyof typeof WRITE_WARNING_KIND_TABLE;+export const WRITE_WARNING_KINDS = Object.keys(+ WRITE_WARNING_KIND_TABLE,+) as readonly WriteWarningKind[];++export function isWriteWarningKind(kind: string): kind is WriteWarningKind {+ return (WRITE_WARNING_KINDS as readonly string[]).includes(kind);+}++export function assertNeverWriteWarning(value: never): never {+ throw new Error(`Unexpected WriteWarning variant: ${JSON.stringify(value)}`);+}+export const RenderWarningSchema = z.object({kind: z.literal('mermaid-parse-error'),@@ -205,8 +223,6 @@ export const AgentWriteSuccessSchema = z.object({timestamp: z.string().min(1),summary: SummaryResponseFieldSchema.optional(),- /** @deprecated Read `warnings` — kept emitting in parallel for one deprecation window. */- warning: WriteWarningSchema.optional(),warnings: AdvisoryWarningsSchema.optional(),}).loose() satisfies StandardSchemaV1;@@ -219,8 +235,6 @@ export const AgentWriteMdSuccessSchema = zsystemSubscriberCount: z.number().int().nonnegative(),hints: z.array(OrphanHintSchema).optional(),summary: SummaryResponseFieldSchema.optional(),- /** @deprecated Read `warnings` — kept emitting in parallel for one deprecation window. */- warning: WriteWarningSchema.optional(),warnings: AdvisoryWarningsSchema.optional(),brokenLinks: BrokenLinksSchema,})@@ -233,8 +247,6 @@ export const AgentPatchSuccessSchema = zsubscriberCount: z.number().int().nonnegative(),systemSubscriberCount: z.number().int().nonnegative(),summary: SummaryResponseFieldSchema.optional(),- /** @deprecated Read `warnings` — kept emitting in parallel for one deprecation window. */- warning: WriteWarningSchema.optional(),warnings: AdvisoryWarningsSchema.optional(),brokenLinks: BrokenLinksSchema,})@@ -328,8 +340,6 @@ export const FrontmatterPatchSuccessSchema = zsystemSubscriberCount: z.number().int().nonnegative(),appliedKeys: z.array(z.string()),summary: SummaryResponseFieldSchema.optional(),- /** @deprecated Read `warnings` — kept emitting in parallel for one deprecation window. */- warning: WriteWarningSchema.optional(),warnings: AdvisoryWarningsSchema.optional(),brokenLinks: BrokenLinksSchema,})diff --git a/packages/core/src/schemas/api/pages.ts b/packages/core/src/schemas/api/pages.tsindex acb57ca0b..34016d75c 100644--- a/packages/core/src/schemas/api/pages.ts+++ b/packages/core/src/schemas/api/pages.ts@@ -1,11 +1,7 @@import type { StandardSchemaV1 } from '@standard-schema/spec';import { z } from 'zod';import { agentIdentityFields, summaryField } from './_shared.ts';-import {- AdvisoryWarningsSchema,- ContentDivergenceWarningSchema,- SummaryResponseFieldSchema,-} from './agent-write.ts';+import { AdvisoryWarningsSchema, SummaryResponseFieldSchema } from './agent-write.ts';export const RenamedDocMappingSchema = z.object({@@ -192,8 +188,6 @@ export const RollbackSuccessSchema = zrestoredFrom: z.string().min(1),timestamp: z.string().min(1),summary: SummaryResponseFieldSchema.optional(),- /** @deprecated Read `warnings` — kept emitting in parallel for one deprecation window. */- warning: ContentDivergenceWarningSchema.optional(),warnings: AdvisoryWarningsSchema.optional(),}).loose() satisfies StandardSchemaV1;diff --git a/packages/core/src/sharing/share-url-v2.test.ts b/packages/core/src/sharing/share-url-v2.test.tsindex 14f7a29f4..b8cd5a8d4 100644--- a/packages/core/src/sharing/share-url-v2.test.ts+++ b/packages/core/src/sharing/share-url-v2.test.ts@@ -68,18 +68,19 @@ describe('fixed cross-version corpus', () => {});describe('v2 codec and content projection', () => {- test.each(- v2Shares,- )('$id decodes its repository source and content-relative target', (fixture) => {- expect(decodeShareUrl(fixture.token)).toEqual(- expect.objectContaining({- version: 2,- contentRootDepth: fixture.contentRootDepth,- sharedUrl: fixture.sharedUrl,- target: fixture.target,- }),- );- });+ test.each(v2Shares)(+ '$id decodes its repository source and content-relative target',+ (fixture) => {+ expect(decodeShareUrl(fixture.token)).toEqual(+ expect.objectContaining({+ version: 2,+ contentRootDepth: fixture.contentRootDepth,+ sharedUrl: fixture.sharedUrl,+ target: fixture.target,+ }),+ );+ },+ );test.each(v2Shares)('$id encodes to the fixed literal token', (fixture) => {expect(encodeShareUrl(fixture.sharedUrl, fixture.contentRootDepth)).toBe(fixture.token);diff --git a/packages/core/src/skills-catalog/adapters/claude-plugins.test.ts b/packages/core/src/skills-catalog/adapters/claude-plugins.test.tsindex f792c1162..5f0c6e1df 100644--- a/packages/core/src/skills-catalog/adapters/claude-plugins.test.ts+++ b/packages/core/src/skills-catalog/adapters/claude-plugins.test.ts@@ -35,7 +35,7 @@ function writeRegistry(value: unknown): void {function provenanceOf(): Record<string, unknown> {const bundles = enumerateClaudePlugins(root, 'claude');expect(bundles).toHaveLength(1);- return (bundles[0]?.skills[0] as { provenance: Record<string, unknown> }).provenance;+ return (bundles[0]?.skills[0] as { provenance: Record<string, unknown> } | undefined)?.provenance;}describe('enumerateClaudePlugins — repository URL stamp', () => {diff --git a/packages/core/src/utils/link-targets.test.ts b/packages/core/src/utils/link-targets.test.tsindex 283d2e659..8c77a2d40 100644--- a/packages/core/src/utils/link-targets.test.ts+++ b/packages/core/src/utils/link-targets.test.ts@@ -339,20 +339,16 @@ describe('buildRelativeMarkdownHref', () => {);});- test.each([- 'Agent Memory',- 'team plan (draft) #1',- 'Q&A',- 'café',- "it's here",- '100% done',- ])('round-trips %j back through the resolver', (name) => {- const href = buildRelativeMarkdownHref('blogs/drafts/index', `blogs/drafts/${name}`);- expect(resolveInternalHref(href, 'blogs/drafts/index')).toEqual({- docName: `blogs/drafts/${name}`,- anchor: null,- });- });+ test.each(['Agent Memory', 'team plan (draft) #1', 'Q&A', 'café', "it's here", '100% done'])(+ 'round-trips %j back through the resolver',+ (name) => {+ const href = buildRelativeMarkdownHref('blogs/drafts/index', `blogs/drafts/${name}`);+ expect(resolveInternalHref(href, 'blogs/drafts/index')).toEqual({+ docName: `blogs/drafts/${name}`,+ anchor: null,+ });+ },+ );});describe('buildAbsoluteMarkdownHref', () => {diff --git a/packages/core/src/utils/uninstall-feedback-submit.test.ts b/packages/core/src/utils/uninstall-feedback-submit.test.tsindex 5102d75ba..9b6d6d421 100644--- a/packages/core/src/utils/uninstall-feedback-submit.test.ts+++ b/packages/core/src/utils/uninstall-feedback-submit.test.ts@@ -200,52 +200,50 @@ describe('postUninstallFeedback', () => {expect(seen[0]?.url).toBe('https://staging.example.com/api/feedback');});- test.each([- 'me@',- 'me.com',- 'not an address',- ])('never spends a round trip on the obviously-broken address %s', async (email) => {- const seen = recordRequests(() => jsonResponse(200, { reference: 'OK-50' }));-- const result = await postUninstallFeedback({- ...HOST_FACTS,- reason: 'unreliable',- note: 'kept crashing',- email,- });-- expect(result).toEqual({ ok: true, reference: 'OK-50' });- expect(seen).toHaveLength(1);- expect(seen[0]?.body).toMatchObject({ reasons: ['unreliable'], message: 'kept crashing' });- expect(seen[0]?.body).not.toHaveProperty('email');- });+ test.each(['me@', 'me.com', 'not an address'])(+ 'never spends a round trip on the obviously-broken address %s',+ async (email) => {+ const seen = recordRequests(() => jsonResponse(200, { reference: 'OK-50' }));++ const result = await postUninstallFeedback({+ ...HOST_FACTS,+ reason: 'unreliable',+ note: 'kept crashing',+ email,+ });- test.each([- '[email protected]',- 'josé@example.com',- '[email protected]',- ])('refiles without the address when the intake rejects %s', async (email) => {- let attempts = 0;- const seen = recordRequests(() => {- attempts += 1;- return attempts === 1- ? new Response('', { status: 400 })- : jsonResponse(200, { reference: 'OK-51' });- });+ expect(result).toEqual({ ok: true, reference: 'OK-50' });+ expect(seen).toHaveLength(1);+ expect(seen[0]?.body).toMatchObject({ reasons: ['unreliable'], message: 'kept crashing' });+ expect(seen[0]?.body).not.toHaveProperty('email');+ },+ );++ test.each(['[email protected]', 'josé@example.com', '[email protected]'])(+ 'refiles without the address when the intake rejects %s',+ async (email) => {+ let attempts = 0;+ const seen = recordRequests(() => {+ attempts += 1;+ return attempts === 1+ ? new Response('', { status: 400 })+ : jsonResponse(200, { reference: 'OK-51' });+ });- const result = await postUninstallFeedback({- ...HOST_FACTS,- reason: 'unreliable',- note: 'kept crashing',- email,- });+ const result = await postUninstallFeedback({+ ...HOST_FACTS,+ reason: 'unreliable',+ note: 'kept crashing',+ email,+ });- expect(result).toEqual({ ok: true, reference: 'OK-51' });- expect(seen).toHaveLength(2);- expect(seen[0]?.body).toMatchObject({ email });- expect(seen[1]?.body).toMatchObject({ reasons: ['unreliable'], message: 'kept crashing' });- expect(seen[1]?.body).not.toHaveProperty('email');- });+ expect(result).toEqual({ ok: true, reference: 'OK-51' });+ expect(seen).toHaveLength(2);+ expect(seen[0]?.body).toMatchObject({ email });+ expect(seen[1]?.body).toMatchObject({ reasons: ['unreliable'], message: 'kept crashing' });+ expect(seen[1]?.body).not.toHaveProperty('email');+ },+ );test('retries at most once, so a body rejected for another reason still settles', async () => {const seen = recordRequests(() => new Response('', { status: 400 }));diff --git a/packages/core/tsconfig.build.json b/packages/core/tsconfig.build.jsonnew file mode 100644index 000000000..6fe93e8fb--- /dev/null+++ b/packages/core/tsconfig.build.json@@ -0,0 +1,7 @@+{+ "extends": "./tsconfig.json",+ "compilerOptions": {+ "customConditions": []+ },+ "include": ["src"]+}diff --git a/packages/core/tsdown.config.ts b/packages/core/tsdown.config.tsindex e99c9cd41..ec94adc19 100644--- a/packages/core/tsdown.config.ts+++ b/packages/core/tsdown.config.ts@@ -1,22 +1,33 @@import { defineConfig } from 'tsdown';-export default defineConfig({- entry: {- index: 'src/index.ts',- 'git-repository': 'src/git-repository.ts',- 'shadow-repo-layout': 'src/shadow-repo-layout.ts',- server: 'src/server.ts',- keepalive: 'src/keepalive/keepalive.ts',- 'helper-bundle': 'src/helper-bundle.ts',- 'skills-catalog': 'src/skills-catalog/index.ts',- 'acp-thread-protocol': 'src/acp/thread-protocol.ts',- 'acp-agent-posture': 'src/acp/agent-posture.ts',- 'acp-permissive-mode': 'src/acp/permissive-mode.ts',- 'acp-codex-legacy-notice': 'src/acp/codex-legacy-notice.ts',- 'desktop-bridge': 'src/desktop-bridge.ts',+const entry = {+ index: 'src/index.ts',+ 'git-repository': 'src/git-repository.ts',+ 'shadow-repo-layout': 'src/shadow-repo-layout.ts',+ server: 'src/server.ts',+ keepalive: 'src/keepalive/keepalive.ts',+ 'helper-bundle': 'src/helper-bundle.ts',+ 'skills-catalog': 'src/skills-catalog/index.ts',+ 'acp-thread-protocol': 'src/acp/thread-protocol.ts',+ 'acp-agent-posture': 'src/acp/agent-posture.ts',+ 'acp-permissive-mode': 'src/acp/permissive-mode.ts',+ 'acp-codex-legacy-notice': 'src/acp/codex-legacy-notice.ts',+ 'desktop-bridge': 'src/desktop-bridge.ts',+};++export default defineConfig([+ {+ entry,+ unbundle: false,+ format: 'esm',+ dts: false,+ clean: true,+ },+ {+ entry,+ unbundle: true,+ format: 'esm',+ dts: { tsconfig: 'tsconfig.build.json', emitDtsOnly: true },+ clean: false,},- unbundle: false,- format: 'esm',- dts: false,- clean: true,-});+]);diff --git a/packages/desktop/electron.vite.config.ts b/packages/desktop/electron.vite.config.tsindex 01cf8c09b..ef1ee97fa 100644--- a/packages/desktop/electron.vite.config.ts+++ b/packages/desktop/electron.vite.config.ts@@ -52,7 +52,7 @@ export default defineConfig({build: {externalizeDeps: true,sourcemap: 'hidden',- rollupOptions: {+ rolldownOptions: {// node-pty lives in optionalDependencies (a failed native build must// not fail `bun install` on toolchain-less machines), but electron-vite's// `externalizeDeps: true` externalizes `dependencies` ONLY. Without this@@ -90,7 +90,7 @@ export default defineConfig({preload: {build: {sourcemap: 'hidden',- rollupOptions: {+ rolldownOptions: {// ONE preload entry, deliberately. A sandboxed preload's `require` is// a polyfill over an allowlist of module NAMES (`electron`, a few node// builtins) and cannot resolve a relative path, so every preload must@@ -147,7 +147,7 @@ export default defineConfig({build: {outDir: resolve(__dirname, 'out/renderer'),sourcemap: 'hidden',- rollupOptions: {+ rolldownOptions: {// Keyed multi-entry: the editor shell plus the self-uninstall window.// Shared with `packages/app/vite.config.ts` via `vite.entries.ts` —// the app build is what a PACKAGED window loads (its `dist/` ships asdiff --git a/packages/desktop/package.json b/packages/desktop/package.jsonindex b96075582..44a132f3a 100644--- a/packages/desktop/package.json+++ b/packages/desktop/package.json@@ -64,7 +64,7 @@"electron-builder": "^26.9.0","electron-vite": "^6.0.0-beta.1","ts-morph": "^28.0.0",- "typescript": "^5.7.2",+ "typescript": "~7.0.2","vite": "^8.0.0"}}diff --git a/packages/desktop/src/main/crash-detection.test.ts b/packages/desktop/src/main/crash-detection.test.tsindex ceada5f60..fbaed2d3b 100644--- a/packages/desktop/src/main/crash-detection.test.ts+++ b/packages/desktop/src/main/crash-detection.test.ts@@ -1600,17 +1600,17 @@ describe('non-crash minidumps', () => {expect(createCrashDetection(rig.deps).detectBootCrash()).not.toBeNull();});- test.each<NodeJS.Platform>([- 'linux',- 'win32',- ])('on %s the snapshot still arms, because the predicate is gated off there', (platform) => {- const rig = makeRig();- rig.deps.platform = platform;- afterCleanQuit(rig);- seedMinidump(rig, 'pending/watchdog.dmp', rig.tick(), rig.ownDumpSimulated);-- expect(createCrashDetection(rig.deps).detectBootCrash()).not.toBeNull();- });+ test.each<NodeJS.Platform>(['linux', 'win32'])(+ 'on %s the snapshot still arms, because the predicate is gated off there',+ (platform) => {+ const rig = makeRig();+ rig.deps.platform = platform;+ afterCleanQuit(rig);+ seedMinidump(rig, 'pending/watchdog.dmp', rig.tick(), rig.ownDumpSimulated);++ expect(createCrashDetection(rig.deps).detectBootCrash()).not.toBeNull();+ },+ );test('a snapshot alone offers no dump to attach', () => {const rig = makeRig();diff --git a/packages/desktop/src/main/debug-ipc.ts b/packages/desktop/src/main/debug-ipc.tsindex 174a85ef7..ed9a694e4 100644--- a/packages/desktop/src/main/debug-ipc.ts+++ b/packages/desktop/src/main/debug-ipc.ts@@ -89,7 +89,7 @@ export function createDebugIpc(deps: DebugIpcDeps): DebugIpcHandle {function handleUtilityMessage(msg: unknown): void {const typed = msg as Partial<UtilityDebugKeyringSmokeResultMessage> | null | undefined;- if (!typed || typed.type !== 'debug-keyring-smoke-result') return;+ if (typed?.type !== 'debug-keyring-smoke-result') return;if (typeof typed.correlationId !== 'string' || !typed.result) return;settle(typed.correlationId, { kind: 'ok', result: typed.result });}diff --git a/packages/desktop/src/main/desktop-logger.test.ts b/packages/desktop/src/main/desktop-logger.test.tsindex 0ffc8f24d..fede95e23 100644--- a/packages/desktop/src/main/desktop-logger.test.ts+++ b/packages/desktop/src/main/desktop-logger.test.ts@@ -20,8 +20,9 @@ describe('error serialization (what the raw-err discipline buys)', () => {getRootDesktopLogger() as unknown as Record<symbol, Record<string, unknown>>)[pino.symbols.serializersSym];for (const key of ['err', 'error'] as const) {- expect(serializers?.[key]).toBe(pino.stdSerializers.err);- const rendered = (serializers?.[key] as (e: Error) => { message?: string; stack?: string })(+ const serializer = serializers?.[key];+ expect(serializer).toBe(pino.stdSerializers.err);+ const rendered = (serializer as (e: Error) => { message?: string; stack?: string })(new Error('boom-probe'),);expect(rendered.message).toBe('boom-probe');diff --git a/packages/desktop/src/main/folder-admission.test.ts b/packages/desktop/src/main/folder-admission.test.tsindex 5750a01e6..7351ac31a 100644--- a/packages/desktop/src/main/folder-admission.test.ts+++ b/packages/desktop/src/main/folder-admission.test.ts@@ -283,26 +283,27 @@ describe('discoverProject — managed kind (ancestor walk)', () => {expect(result.ancestorPromoted).toBe(true);});- test.each([- 1, 2, 3, 4, 5,- ])('promotes to ancestor at depth %i levels above picked', async (depth) => {- const segments = Array.from({ length: depth }, (_, i) => `level${i + 1}`);- const project = resolve(fakeHome, 'project');- const sub = resolve(project, ...segments);- mkdirSync(sub, { recursive: true });- writeOkConfig(project);-- const result = await discoverProject(sub, {- homeDir: fakeHome,- gitTopLevel: stubGitTopLevel({}),- dirSizeProbe: null,- });-- expect(result.kind).toBe('managed');- if (result.kind !== 'managed') return;- expect(result.projectDir).toBe(project);- expect(result.ancestorPromoted).toBe(true);- });+ test.each([1, 2, 3, 4, 5])(+ 'promotes to ancestor at depth %i levels above picked',+ async (depth) => {+ const segments = Array.from({ length: depth }, (_, i) => `level${i + 1}`);+ const project = resolve(fakeHome, 'project');+ const sub = resolve(project, ...segments);+ mkdirSync(sub, { recursive: true });+ writeOkConfig(project);++ const result = await discoverProject(sub, {+ homeDir: fakeHome,+ gitTopLevel: stubGitTopLevel({}),+ dirSizeProbe: null,+ });++ expect(result.kind).toBe('managed');+ if (result.kind !== 'managed') return;+ expect(result.projectDir).toBe(project);+ expect(result.ancestorPromoted).toBe(true);+ },+ );test('walk excludes home itself — a home .ok/ never promotes a child', async () => {writeOkConfig(fakeHome);diff --git a/packages/desktop/src/main/ipc/bug-report.test.ts b/packages/desktop/src/main/ipc/bug-report.test.tsindex 2c053a1f6..627909c15 100644--- a/packages/desktop/src/main/ipc/bug-report.test.ts+++ b/packages/desktop/src/main/ipc/bug-report.test.ts@@ -2238,7 +2238,7 @@ describe('handleBugReportCaptureScreenshot', () => {expect(await handleBugReportCaptureScreenshot(deps)).toBeNull();expect(store.has(7)).toBe(false);expect(warnings).toHaveLength(1);- expect((warnings[0]?.payload.err as Error).message).toContain('offscreen surface');+ expect((warnings[0]?.payload.err as Error | undefined)?.message).toContain('offscreen surface');});});diff --git a/packages/desktop/src/main/mcp-wiring.test.ts b/packages/desktop/src/main/mcp-wiring.test.tsindex 01d1bcd85..c33fc8f60 100644--- a/packages/desktop/src/main/mcp-wiring.test.ts+++ b/packages/desktop/src/main/mcp-wiring.test.ts@@ -1158,7 +1158,7 @@ describe('runMcpWiringOnFirstLaunch — PATH consent leg', () => {);expect(wc.sent).toHaveLength(1);- expect((wc.sent[0]?.payload as { pathInstall: unknown }).pathInstall).toEqual({+ expect((wc.sent[0]?.payload as { pathInstall: unknown } | undefined)?.pathInstall).toEqual({shellDetected: false,rcFilesToTouch: [],alreadyInstalled: false,@@ -1185,7 +1185,9 @@ describe('runMcpWiringOnFirstLaunch — PATH consent leg', () => {);expect(wc.sent).toHaveLength(1);- expect((wc.sent[0]?.payload as { globalSkills: unknown }).globalSkills).toEqual([]);+ expect((wc.sent[0]?.payload as { globalSkills: unknown } | undefined)?.globalSkills).toEqual(+ [],+ );expect(events.some((e) => e.event === 'mcp-wiring-skill-descriptors-failed')).toBe(true);expect(ipcMain.handlers.has('ok:mcp-wiring:confirm')).toBe(true);});diff --git a/packages/desktop/src/main/minidump-ownership.test.ts b/packages/desktop/src/main/minidump-ownership.test.tsindex 4aab67b42..16e5a3f2a 100644--- a/packages/desktop/src/main/minidump-ownership.test.ts+++ b/packages/desktop/src/main/minidump-ownership.test.ts@@ -491,12 +491,12 @@ describe('classifyMinidumpCrashKind', () => {);});- test.each<NodeJS.Platform>([- 'linux',- 'win32',- ])('stays inert on %s even when the dump carries the macOS sentinel', (platform) => {- expect(kindOf({ exceptionCode: SIMULATED }, platform)).toBe('indeterminate');- });+ test.each<NodeJS.Platform>(['linux', 'win32'])(+ 'stays inert on %s even when the dump carries the macOS sentinel',+ (platform) => {+ expect(kindOf({ exceptionCode: SIMULATED }, platform)).toBe('indeterminate');+ },+ );test('reading the crash kind leaves the ownership verdict untouched', () => {const dir = makeDir();diff --git a/packages/desktop/src/main/note-window.test.ts b/packages/desktop/src/main/note-window.test.tsindex b33e533cd..59ad2d269 100644--- a/packages/desktop/src/main/note-window.test.ts+++ b/packages/desktop/src/main/note-window.test.ts@@ -270,12 +270,12 @@ describe('noteWindowNativeChromeOptions', () => {});});- test.each([- 'win32',- 'linux',- ] as const)('leaves %s chrome to the shared WCO policy', (platform) => {- expect(noteWindowNativeChromeOptions(platform)).toEqual({});- });+ test.each(['win32', 'linux'] as const)(+ 'leaves %s chrome to the shared WCO policy',+ (platform) => {+ expect(noteWindowNativeChromeOptions(platform)).toEqual({});+ },+ );});describe('createNoteWindow', () => {diff --git a/packages/desktop/src/main/renderer-ready-sink.test.ts b/packages/desktop/src/main/renderer-ready-sink.test.tsindex 5b3b6b044..738c69cd9 100644--- a/packages/desktop/src/main/renderer-ready-sink.test.ts+++ b/packages/desktop/src/main/renderer-ready-sink.test.ts@@ -55,7 +55,7 @@ describe('createRendererReadySink', () => {sink.ipcMain.handle('ok:mcp-wiring:renderer-ready', listener);await expect(real.invoke('ok:mcp-wiring:renderer-ready')).resolves.toBeUndefined();expect(listener).toHaveBeenCalledTimes(1);- expect((listener.mock.calls[0]?.[0] as IpcMainInvokeEvent).sender.id).toBe(7);+ expect((listener.mock.calls[0]?.[0] as IpcMainInvokeEvent | undefined)?.sender.id).toBe(7);await expect(real.invoke('ok:onboarding:renderer-ready')).resolves.toBeUndefined();});diff --git a/packages/desktop/src/main/renderer-recovery.test.ts b/packages/desktop/src/main/renderer-recovery.test.tsindex 3b4c71c1b..b1ee37b86 100644--- a/packages/desktop/src/main/renderer-recovery.test.ts+++ b/packages/desktop/src/main/renderer-recovery.test.ts@@ -128,19 +128,18 @@ describe('renderer crash recovery', () => {expect(rig.logs.some((l) => l.obj.event === 'renderer-recovery.reload-abandoned')).toBe(true);});- test.each([- ['oom' as const],- ['launch-failed' as const],- ['integrity-failure' as const],- ])('reloads on abnormal reason %s', (reason) => {- const rig = makeRig();- const contents = makeContents();+ test.each([['oom' as const], ['launch-failed' as const], ['integrity-failure' as const]])(+ 'reloads on abnormal reason %s',+ (reason) => {+ const rig = makeRig();+ const contents = makeContents();- rig.recovery.handleRenderProcessGone(contents, { reason, exitCode: 1 });- rig.drainDeferred();+ rig.recovery.handleRenderProcessGone(contents, { reason, exitCode: 1 });+ rig.drainDeferred();- expect(contents.reload).toHaveBeenCalledTimes(1);- });+ expect(contents.reload).toHaveBeenCalledTimes(1);+ },+ );test.each([['clean-exit' as const],diff --git a/packages/desktop/src/main/restore-focus.test.ts b/packages/desktop/src/main/restore-focus.test.tsindex ab19b94f8..86fbf83b5 100644--- a/packages/desktop/src/main/restore-focus.test.ts+++ b/packages/desktop/src/main/restore-focus.test.ts@@ -74,12 +74,12 @@ describe('shouldRevealInactiveNow', () => {{ restoreInProgress: true, appHasEverBeenActive: false, appIsActive: true, expected: false },{ restoreInProgress: true, appHasEverBeenActive: true, appIsActive: false, expected: true },{ restoreInProgress: true, appHasEverBeenActive: true, appIsActive: true, expected: false },- ])('restore=$restoreInProgress everActive=$appHasEverBeenActive active=$appIsActive → $expected', ({- expected,- ...state- }) => {- expect(shouldRevealInactiveNow(state)).toBe(expected);- });+ ])(+ 'restore=$restoreInProgress everActive=$appHasEverBeenActive active=$appIsActive → $expected',+ ({ expected, ...state }) => {+ expect(shouldRevealInactiveNow(state)).toBe(expected);+ },+ );test('a restore that has never been frontmost reveals normally, not quietly', () => {expect(diff --git a/packages/desktop/src/main/shell-env.test.ts b/packages/desktop/src/main/shell-env.test.tsindex 892bb7b82..a44b7f919 100644--- a/packages/desktop/src/main/shell-env.test.ts+++ b/packages/desktop/src/main/shell-env.test.ts@@ -85,7 +85,7 @@ describe('harvestShellAuthSock', () => {expect(events).toContain('shell-authsock-harvest-failed');const failure = payloads.find((p) => p.event === 'shell-authsock-harvest-failed');expect(failure?.stderr).toMatch(/^zsh: bad substitution/);- expect((failure?.stderr as string).length).toBeLessThanOrEqual(300);+ expect((failure?.stderr as string | undefined)?.length).toBeLessThanOrEqual(300);});it('returns null and logs on timeout', async () => {@@ -117,7 +117,7 @@ describe('harvestShellAuthSock', () => {const failure = payloads.find((p) => p.event === 'shell-authsock-harvest-failed');expect(failure?.reason).toBe('marker-missing');expect(failure?.stdout).toMatch(/^rc noise only/);- expect((failure?.stdout as string).length).toBeLessThanOrEqual(300);+ expect((failure?.stdout as string | undefined)?.length).toBeLessThanOrEqual(300);});it('returns null and logs when spawn throws', async () => {diff --git a/packages/desktop/src/main/url-scheme.test.ts b/packages/desktop/src/main/url-scheme.test.tsindex 3c4f64ef3..00c511baf 100644--- a/packages/desktop/src/main/url-scheme.test.ts+++ b/packages/desktop/src/main/url-scheme.test.ts@@ -12,19 +12,20 @@ describe('frozen pre-v2 reader compatibility oracle', () => {expect(frozenV1CustomSchemeOutcome(entry.uri)).toBe(entry.baseline);});- test.each(- fixture.validShares.filter((entry) => entry.version === 2),- )('$id remains unsupported in universal and deferred old-app delivery', (entry) => {- expect(frozenV1DecodeShareToken(entry.token)).toEqual({- kind: 'unsupported-version',- version: 2,- });- expect(- frozenV1DecodeShareToken(- new URL(`https://openknowledge.ai/d/${entry.token}`).pathname.slice(3),- ),- ).toEqual({ kind: 'unsupported-version', version: 2 });- });+ test.each(fixture.validShares.filter((entry) => entry.version === 2))(+ '$id remains unsupported in universal and deferred old-app delivery',+ (entry) => {+ expect(frozenV1DecodeShareToken(entry.token)).toEqual({+ kind: 'unsupported-version',+ version: 2,+ });+ expect(+ frozenV1DecodeShareToken(+ new URL(`https://openknowledge.ai/d/${entry.token}`).pathname.slice(3),+ ),+ ).toEqual({ kind: 'unsupported-version', version: 2 });+ },+ );});describe('parseOpenKnowledgeUrl — valid inputs', () => {@@ -250,18 +251,19 @@ describe('parseOpenKnowledgeUrl — MCP producer/consumer round-trip', () => {});describe('parseShareUrl — universal-link happy path', () => {- test.each(- fixture.validShares.filter((entry) => entry.version === 2),- )('projects canonical $id to its content-relative target', (entry) => {- expect(parseShareUrl(`https://openknowledge.ai/d/${entry.token}`)).toMatchObject({- kind: 'ok',- source: 'universal-link',- payload: {- sharedUrl: entry.sharedUrl,- target: entry.target,- },- });- });+ test.each(fixture.validShares.filter((entry) => entry.version === 2))(+ 'projects canonical $id to its content-relative target',+ (entry) => {+ expect(parseShareUrl(`https://openknowledge.ai/d/${entry.token}`)).toMatchObject({+ kind: 'ok',+ source: 'universal-link',+ payload: {+ sharedUrl: entry.sharedUrl,+ target: entry.target,+ },+ });+ },+ );test.each(fixture.legacyAliases)('preserves tolerated v1 alias $id', (entry) => {expect(parseShareUrl(`https://openknowledge.ai/d/${entry.token}`)).toMatchObject({diff --git a/packages/desktop/src/main/window-manager.ts b/packages/desktop/src/main/window-manager.tsindex 3690f1fb9..37e437234 100644--- a/packages/desktop/src/main/window-manager.ts+++ b/packages/desktop/src/main/window-manager.ts@@ -352,7 +352,11 @@ export class WindowManager {private readonly keepalives = new Map<string, KeepaliveHandle>();- constructor(private readonly deps: WindowManagerDeps) {}+ private readonly deps: WindowManagerDeps;++ constructor(deps: WindowManagerDeps) {+ this.deps = deps;+ }private canonicalizeKey(projectPath: string): string {const absolute = resolve(projectPath);diff --git a/packages/desktop/tests/integration/auto-updater.test.ts b/packages/desktop/tests/integration/auto-updater.test.tsindex 9d55209a2..8459bf3af 100644--- a/packages/desktop/tests/integration/auto-updater.test.ts+++ b/packages/desktop/tests/integration/auto-updater.test.ts@@ -919,60 +919,60 @@ describe('startAutoUpdater — initial configuration (parent §8.10 LOCKED)', ()expect(rig.updater.setFeedURL).toHaveBeenCalledTimes(1);});- test.each([- 'resolve',- 'reject',- ])('proxyFeed: periodic checks wait for the GitHub retry to %s before restoring the proxy', async (settlement) => {- const initialCheck = Promise.withResolvers<undefined>();- const retry = Promise.withResolvers<undefined>();- const error = Object.assign(new Error('proxy unavailable'), { code: 'HTTP_ERROR_503' });- const { rig } = makeRig({- appVersion: '0.4.0',- proxyFeed: { base: PROXY_BASE, channels: new Set(['latest']) },- updaterSetup: (updater) => {- updater.checkForUpdates = vi- .fn(() => retry.promise)- .mockImplementationOnce(() => initialCheck.promise);- },- });+ test.each(['resolve', 'reject'])(+ 'proxyFeed: periodic checks wait for the GitHub retry to %s before restoring the proxy',+ async (settlement) => {+ const initialCheck = Promise.withResolvers<undefined>();+ const retry = Promise.withResolvers<undefined>();+ const error = Object.assign(new Error('proxy unavailable'), { code: 'HTTP_ERROR_503' });+ const { rig } = makeRig({+ appVersion: '0.4.0',+ proxyFeed: { base: PROXY_BASE, channels: new Set(['latest']) },+ updaterSetup: (updater) => {+ updater.checkForUpdates = vi+ .fn(() => retry.promise)+ .mockImplementationOnce(() => initialCheck.promise);+ },+ });- rig.updater.emit('error', error);- initialCheck.reject(error);- await new Promise((resolve) => setTimeout(resolve, 0));- expect(rig.updater.checkForUpdates).toHaveBeenCalledTimes(2);- expect(rig.updater.setFeedURL).toHaveBeenLastCalledWith({- provider: 'github',- owner: 'inkeep',- repo: 'open-knowledge',- });+ rig.updater.emit('error', error);+ initialCheck.reject(error);+ await new Promise((resolve) => setTimeout(resolve, 0));+ expect(rig.updater.checkForUpdates).toHaveBeenCalledTimes(2);+ expect(rig.updater.setFeedURL).toHaveBeenLastCalledWith({+ provider: 'github',+ owner: 'inkeep',+ repo: 'open-knowledge',+ });- fireTimerFor(rig.clock, UPDATE_CHECK_INTERVAL_MS);- rig.ipc.invoke('ok:update:check-now');- rig.updater.emit('error', error);- expect(rig.updater.checkForUpdates).toHaveBeenCalledTimes(2);- expect(rig.updater.setFeedURL).toHaveBeenCalledTimes(2);- expect(rig.updater.requestHeaders).toBeNull();- expect(rig.logger.warn).not.toHaveBeenCalledWith(- 'proxy check failed, not fallback-eligible, staying on proxy',- expect.anything(),- );+ fireTimerFor(rig.clock, UPDATE_CHECK_INTERVAL_MS);+ rig.ipc.invoke('ok:update:check-now');+ rig.updater.emit('error', error);+ expect(rig.updater.checkForUpdates).toHaveBeenCalledTimes(2);+ expect(rig.updater.setFeedURL).toHaveBeenCalledTimes(2);+ expect(rig.updater.requestHeaders).toBeNull();+ expect(rig.logger.warn).not.toHaveBeenCalledWith(+ 'proxy check failed, not fallback-eligible, staying on proxy',+ expect.anything(),+ );- if (settlement === 'resolve') retry.resolve(undefined);- else retry.reject(error);- await new Promise((resolve) => setTimeout(resolve, 0));- rig.updater.checkForUpdates.mockResolvedValue(undefined);- fireTimerFor(rig.clock, UPDATE_CHECK_INTERVAL_MS);- expect(rig.updater.checkForUpdates).toHaveBeenCalledTimes(3);- expect(rig.updater.setFeedURL).toHaveBeenCalledTimes(3);- expect(rig.updater.setFeedURL).toHaveBeenLastCalledWith({- provider: 'generic',- url: `${PROXY_BASE}/stable`,- });- expect(rig.updater.requestHeaders).toEqual({- 'x-ok-from-version': '0.4.0',- 'x-ok-channel': 'stable',- });- });+ if (settlement === 'resolve') retry.resolve(undefined);+ else retry.reject(error);+ await new Promise((resolve) => setTimeout(resolve, 0));+ rig.updater.checkForUpdates.mockResolvedValue(undefined);+ fireTimerFor(rig.clock, UPDATE_CHECK_INTERVAL_MS);+ expect(rig.updater.checkForUpdates).toHaveBeenCalledTimes(3);+ expect(rig.updater.setFeedURL).toHaveBeenCalledTimes(3);+ expect(rig.updater.setFeedURL).toHaveBeenLastCalledWith({+ provider: 'generic',+ url: `${PROXY_BASE}/stable`,+ });+ expect(rig.updater.requestHeaders).toEqual({+ 'x-ok-from-version': '0.4.0',+ 'x-ok-channel': 'stable',+ });+ },+ );test('proxyFeed: a synchronous proxy-restore failure rejects without stopping periodic checks', async () => {const { rig } = makeRig({@@ -3450,130 +3450,134 @@ describe('ok:update:check-now IPC handler', () => {});describe('check-now → showCheckNowResult feedback dispatch', () => {- test.each([- 'update-available',- 'update-not-available',- ] as const)('a verdict arriving after the deadline but before the watchdog still settles the manual check: %s', async (event) => {- const showCheckNowResult = vi.fn(() => {});- const pending = Promise.withResolvers<undefined>();- const { rig } = makeRig({- appVersion: '0.4.0',- proxyFeed: { base: PROXY_BASE, channels: new Set(['latest']) },- showCheckNowResult,- updaterSetup: (updater) => {- updater.checkForUpdates = vi.fn(() => pending.promise);- },- });- rig.ipc.invoke('ok:update:check-now');- rig.now = new Date(rig.now.getTime() + UPDATE_CHECK_DEADLINE_MS);- fireTimerFor(rig.clock, UPDATE_CHECK_DEADLINE_MS);- expect(showCheckNowResult).not.toHaveBeenCalled();- expect(manualCheckPhases(rig)).toEqual(['started']);- rig.updater.emit(event, { version: '0.5.0' });- expect(showCheckNowResult).toHaveBeenCalledExactlyOnceWith(- event === 'update-available'- ? { kind: 'available', currentVersion: '0.4.0', latestVersion: '0.5.0' }- : { kind: 'not-available', currentVersion: '0.4.0' },- );- expect(manualCheckPhases(rig)).toEqual(['started', 'settled']);- expect(() => fireTimerFor(rig.clock, MANUAL_CHECK_WATCHDOG_MS)).toThrow();- expect(rig.dispatches).not.toContain('check-now-watchdog-fired');- pending.resolve(undefined);- await new Promise((resolve) => setTimeout(resolve, 0));- expect(showCheckNowResult).toHaveBeenCalledTimes(1);- expect(rig.updater.downloadUpdate).toHaveBeenCalledTimes(event === 'update-available' ? 1 : 0);- expect(rig.updater.checkForUpdates).toHaveBeenCalledTimes(1);- });-- test.each([- 'update-available',- 'update-not-available',- ] as const)('a verdict arriving after the watchdog neither re-dispatches a dialog nor blocks the download: %s', async (event) => {- const showCheckNowResult = vi.fn(() => {});- const pending = Promise.withResolvers<undefined>();- const { rig } = makeRig({- appVersion: '0.4.0',- proxyFeed: { base: PROXY_BASE, channels: new Set(['latest']) },- showCheckNowResult,- updaterSetup: (updater) => {- updater.checkForUpdates = vi.fn(() => pending.promise);- },- });- rig.ipc.invoke('ok:update:check-now');- rig.now = new Date(rig.now.getTime() + UPDATE_CHECK_DEADLINE_MS);- fireTimerFor(rig.clock, UPDATE_CHECK_DEADLINE_MS);- expect(showCheckNowResult).not.toHaveBeenCalled();- expect(manualCheckPhases(rig)).toEqual(['started']);- rig.now = new Date(rig.now.getTime() + MANUAL_CHECK_WATCHDOG_MS - UPDATE_CHECK_DEADLINE_MS);- fireTimerFor(rig.clock, MANUAL_CHECK_WATCHDOG_MS);- expect(showCheckNowResult).toHaveBeenCalledExactlyOnceWith({- kind: 'error',- message: MANUAL_CHECK_TIMED_OUT_MESSAGE,- });- expect(rig.dispatches).toContain('check-now-watchdog-fired');- expect(manualCheckPhases(rig)).toEqual(['started', 'settled']);- rig.updater.emit(event, { version: '0.5.0' });- pending.resolve(undefined);- await new Promise((resolve) => setTimeout(resolve, 0));- expect(showCheckNowResult).toHaveBeenCalledTimes(1);- expect(manualCheckPhases(rig)).toEqual(['started', 'settled']);- expect(rig.updater.downloadUpdate).toHaveBeenCalledTimes(event === 'update-available' ? 1 : 0);- expect(rig.updater.checkForUpdates).toHaveBeenCalledTimes(1);- });+ test.each(['update-available', 'update-not-available'] as const)(+ 'a verdict arriving after the deadline but before the watchdog still settles the manual check: %s',+ async (event) => {+ const showCheckNowResult = vi.fn(() => {});+ const pending = Promise.withResolvers<undefined>();+ const { rig } = makeRig({+ appVersion: '0.4.0',+ proxyFeed: { base: PROXY_BASE, channels: new Set(['latest']) },+ showCheckNowResult,+ updaterSetup: (updater) => {+ updater.checkForUpdates = vi.fn(() => pending.promise);+ },+ });+ rig.ipc.invoke('ok:update:check-now');+ rig.now = new Date(rig.now.getTime() + UPDATE_CHECK_DEADLINE_MS);+ fireTimerFor(rig.clock, UPDATE_CHECK_DEADLINE_MS);+ expect(showCheckNowResult).not.toHaveBeenCalled();+ expect(manualCheckPhases(rig)).toEqual(['started']);+ rig.updater.emit(event, { version: '0.5.0' });+ expect(showCheckNowResult).toHaveBeenCalledExactlyOnceWith(+ event === 'update-available'+ ? { kind: 'available', currentVersion: '0.4.0', latestVersion: '0.5.0' }+ : { kind: 'not-available', currentVersion: '0.4.0' },+ );+ expect(manualCheckPhases(rig)).toEqual(['started', 'settled']);+ expect(() => fireTimerFor(rig.clock, MANUAL_CHECK_WATCHDOG_MS)).toThrow();+ expect(rig.dispatches).not.toContain('check-now-watchdog-fired');+ pending.resolve(undefined);+ await new Promise((resolve) => setTimeout(resolve, 0));+ expect(showCheckNowResult).toHaveBeenCalledTimes(1);+ expect(rig.updater.downloadUpdate).toHaveBeenCalledTimes(+ event === 'update-available' ? 1 : 0,+ );+ expect(rig.updater.checkForUpdates).toHaveBeenCalledTimes(1);+ },+ );- test.each([- 'deadline',- 'reuse',- ] as const)('a hung launch check starts scheduling and reaches the stuck hint from %s', (path) => {- const nowAt = new Date('2026-04-21T12:00:00.000Z');- const lastSuccessfulCheckAt = new Date(- nowAt.getTime() -- STUCK_HINT_THRESHOLD_MS +- (path === 'deadline' ? -1 : UPDATE_CHECK_DEADLINE_MS + 1),- ).toISOString();- const { rig } = makeRig({- appVersion: '0.4.0',- proxyFeed: { base: PROXY_BASE, channels: new Set(['latest']) },- nowAt,- lastSuccessfulCheckAt,- stuckHintShown: false,- updaterSetup: (updater) => {- updater.checkForUpdates = vi.fn(() => new Promise(() => {}));- },- });- expect(- rig.clock.setTimeout.mock.calls.filter(([, ms]) => ms === UPDATE_CHECK_INTERVAL_MS),- ).toHaveLength(0);- rig.now = new Date(rig.now.getTime() + UPDATE_CHECK_DEADLINE_MS);- fireTimerFor(rig.clock, UPDATE_CHECK_DEADLINE_MS);- expect(- rig.clock.setTimeout.mock.calls.filter(([, ms]) => ms === UPDATE_CHECK_INTERVAL_MS),- ).toHaveLength(1);- expect(() => fireTimerFor(rig.clock, UPDATE_CHECK_DEADLINE_MS)).toThrow();- if (path === 'reuse') {- expect(rig.captured.filter((c) => c.channel === 'ok:update:stuck-hint')).toHaveLength(0);- expect(rig.state.stuckHintShown).toBe(false);- rig.now = new Date(rig.now.getTime() + 2);+ test.each(['update-available', 'update-not-available'] as const)(+ 'a verdict arriving after the watchdog neither re-dispatches a dialog nor blocks the download: %s',+ async (event) => {+ const showCheckNowResult = vi.fn(() => {});+ const pending = Promise.withResolvers<undefined>();+ const { rig } = makeRig({+ appVersion: '0.4.0',+ proxyFeed: { base: PROXY_BASE, channels: new Set(['latest']) },+ showCheckNowResult,+ updaterSetup: (updater) => {+ updater.checkForUpdates = vi.fn(() => pending.promise);+ },+ });rig.ipc.invoke('ok:update:check-now');- }- expect(rig.captured.filter((c) => c.channel === 'ok:update:stuck-hint')).toEqual([- { channel: 'ok:update:stuck-hint', payload: { downloadUrl: STUCK_HINT_DOWNLOAD_URL } },- ]);- expect(rig.state.stuckHintShown).toBe(true);- expect(rig.dispatches.filter((kind) => kind === 'stuck-hint-toast-c')).toHaveLength(1);- rig.now = new Date(rig.now.getTime() + UPDATE_CHECK_INTERVAL_MS);- fireTimerFor(rig.clock, UPDATE_CHECK_INTERVAL_MS);- expect(- rig.clock.setTimeout.mock.calls.filter(([, ms]) => ms === UPDATE_CHECK_INTERVAL_MS),- ).toHaveLength(2);- rig.now = new Date(rig.now.getTime() + UPDATE_CHECK_INTERVAL_MS);- fireTimerFor(rig.clock, UPDATE_CHECK_INTERVAL_MS);- expect(- rig.clock.setTimeout.mock.calls.filter(([, ms]) => ms === UPDATE_CHECK_INTERVAL_MS),- ).toHaveLength(3);- expect(rig.updater.checkForUpdates).toHaveBeenCalledTimes(1);- expect(rig.captured.filter((c) => c.channel === 'ok:update:stuck-hint')).toHaveLength(1);- });+ rig.now = new Date(rig.now.getTime() + UPDATE_CHECK_DEADLINE_MS);+ fireTimerFor(rig.clock, UPDATE_CHECK_DEADLINE_MS);+ expect(showCheckNowResult).not.toHaveBeenCalled();+ expect(manualCheckPhases(rig)).toEqual(['started']);+ rig.now = new Date(rig.now.getTime() + MANUAL_CHECK_WATCHDOG_MS - UPDATE_CHECK_DEADLINE_MS);+ fireTimerFor(rig.clock, MANUAL_CHECK_WATCHDOG_MS);+ expect(showCheckNowResult).toHaveBeenCalledExactlyOnceWith({+ kind: 'error',+ message: MANUAL_CHECK_TIMED_OUT_MESSAGE,+ });+ expect(rig.dispatches).toContain('check-now-watchdog-fired');+ expect(manualCheckPhases(rig)).toEqual(['started', 'settled']);+ rig.updater.emit(event, { version: '0.5.0' });+ pending.resolve(undefined);+ await new Promise((resolve) => setTimeout(resolve, 0));+ expect(showCheckNowResult).toHaveBeenCalledTimes(1);+ expect(manualCheckPhases(rig)).toEqual(['started', 'settled']);+ expect(rig.updater.downloadUpdate).toHaveBeenCalledTimes(+ event === 'update-available' ? 1 : 0,+ );+ expect(rig.updater.checkForUpdates).toHaveBeenCalledTimes(1);+ },+ );++ test.each(['deadline', 'reuse'] as const)(+ 'a hung launch check starts scheduling and reaches the stuck hint from %s',+ (path) => {+ const nowAt = new Date('2026-04-21T12:00:00.000Z');+ const lastSuccessfulCheckAt = new Date(+ nowAt.getTime() -+ STUCK_HINT_THRESHOLD_MS ++ (path === 'deadline' ? -1 : UPDATE_CHECK_DEADLINE_MS + 1),+ ).toISOString();+ const { rig } = makeRig({+ appVersion: '0.4.0',+ proxyFeed: { base: PROXY_BASE, channels: new Set(['latest']) },+ nowAt,+ lastSuccessfulCheckAt,+ stuckHintShown: false,+ updaterSetup: (updater) => {+ updater.checkForUpdates = vi.fn(() => new Promise(() => {}));+ },+ });+ expect(+ rig.clock.setTimeout.mock.calls.filter(([, ms]) => ms === UPDATE_CHECK_INTERVAL_MS),+ ).toHaveLength(0);+ rig.now = new Date(rig.now.getTime() + UPDATE_CHECK_DEADLINE_MS);+ fireTimerFor(rig.clock, UPDATE_CHECK_DEADLINE_MS);+ expect(+ rig.clock.setTimeout.mock.calls.filter(([, ms]) => ms === UPDATE_CHECK_INTERVAL_MS),+ ).toHaveLength(1);+ expect(() => fireTimerFor(rig.clock, UPDATE_CHECK_DEADLINE_MS)).toThrow();+ if (path === 'reuse') {+ expect(rig.captured.filter((c) => c.channel === 'ok:update:stuck-hint')).toHaveLength(0);+ expect(rig.state.stuckHintShown).toBe(false);+ rig.now = new Date(rig.now.getTime() + 2);+ rig.ipc.invoke('ok:update:check-now');+ }+ expect(rig.captured.filter((c) => c.channel === 'ok:update:stuck-hint')).toEqual([+ { channel: 'ok:update:stuck-hint', payload: { downloadUrl: STUCK_HINT_DOWNLOAD_URL } },+ ]);+ expect(rig.state.stuckHintShown).toBe(true);+ expect(rig.dispatches.filter((kind) => kind === 'stuck-hint-toast-c')).toHaveLength(1);+ rig.now = new Date(rig.now.getTime() + UPDATE_CHECK_INTERVAL_MS);+ fireTimerFor(rig.clock, UPDATE_CHECK_INTERVAL_MS);+ expect(+ rig.clock.setTimeout.mock.calls.filter(([, ms]) => ms === UPDATE_CHECK_INTERVAL_MS),+ ).toHaveLength(2);+ rig.now = new Date(rig.now.getTime() + UPDATE_CHECK_INTERVAL_MS);+ fireTimerFor(rig.clock, UPDATE_CHECK_INTERVAL_MS);+ expect(+ rig.clock.setTimeout.mock.calls.filter(([, ms]) => ms === UPDATE_CHECK_INTERVAL_MS),+ ).toHaveLength(3);+ expect(rig.updater.checkForUpdates).toHaveBeenCalledTimes(1);+ expect(rig.captured.filter((c) => c.channel === 'ok:update:stuck-hint')).toHaveLength(1);+ },+ );test('a timed-out background proxy check settles later manual checks without redispatching', async () => {const showCheckNowResult = vi.fn(() => {});@@ -3633,368 +3637,373 @@ describe('check-now → showCheckNowResult feedback dispatch', () => {);});+ test.each(['deadline', 'destroy'] as const)(+ 'a pending initial proxy check handles %s',+ async (outcome) => {+ const showCheckNowResult = vi.fn(() => {});+ const pending = Promise.withResolvers<undefined>();+ const { rig, handle } = makeRig({+ appVersion: '0.4.0',+ proxyFeed: { base: PROXY_BASE, channels: new Set(['latest']) },+ showCheckNowResult,+ updaterSetup: (updater) => {+ updater.checkForUpdates = vi.fn(() => {+ const feed = updater.setFeedURL.mock.calls.at(-1)?.[0];+ if (typeof feed === 'object' && feed.provider === 'generic') return pending.promise;+ throw new Error('unexpected updater feed');+ });+ },+ });+ rig.ipc.invoke('ok:update:check-now');+ expect(showCheckNowResult).not.toHaveBeenCalled();+ rig.now = new Date(rig.now.getTime() + UPDATE_CHECK_DEADLINE_MS);+ if (outcome === 'destroy') {+ const deadlineIndex = rig.clock.setTimeout.mock.calls.findLastIndex(+ ([, ms]) => ms === UPDATE_CHECK_DEADLINE_MS,+ );+ const deadlineHandle = rig.clock.setTimeout.mock.results[deadlineIndex]?.value;+ handle.destroy();+ expect(rig.clock.clearTimeout).toHaveBeenCalledWith(deadlineHandle);+ for (const log of Object.values(rig.logger)) log.mockClear();+ expect(() => fireTimerFor(rig.clock, UPDATE_CHECK_DEADLINE_MS)).toThrow();+ expect(showCheckNowResult).not.toHaveBeenCalled();+ for (const log of Object.values(rig.logger)) expect(log).not.toHaveBeenCalled();+ expect(() => handle.destroy()).not.toThrow();+ for (const log of Object.values(rig.logger)) expect(log).not.toHaveBeenCalled();+ pending.reject(Object.assign(new Error('proxy unavailable'), { code: 'HTTP_ERROR_503' }));+ await new Promise((resolve) => setTimeout(resolve, 0));+ expect(showCheckNowResult).not.toHaveBeenCalled();+ expect(() => fireTimerFor(rig.clock, UPDATE_CHECK_INTERVAL_MS)).toThrow();+ } else {+ fireTimerFor(rig.clock, UPDATE_CHECK_DEADLINE_MS);+ expect(showCheckNowResult).not.toHaveBeenCalled();+ expect(manualCheckPhases(rig)).toEqual(['started']);+ expect(rig.logger.warn).toHaveBeenCalledWith('update check exceeded its deadline', {+ ms: UPDATE_CHECK_DEADLINE_MS,+ ageMs: UPDATE_CHECK_DEADLINE_MS,+ menuCheckPending: true,+ fallbackRetryPending: false,+ usingProxyFeed: true,+ proxyFallbackTried: false,+ });+ rig.now = new Date(rig.now.getTime() + MANUAL_CHECK_WATCHDOG_MS - UPDATE_CHECK_DEADLINE_MS);+ fireTimerFor(rig.clock, MANUAL_CHECK_WATCHDOG_MS);+ expect(showCheckNowResult).toHaveBeenCalledExactlyOnceWith({+ kind: 'error',+ message: MANUAL_CHECK_TIMED_OUT_MESSAGE,+ });+ expect(rig.dispatches).toContain('check-now-watchdog-fired');+ expect(manualCheckPhases(rig)).toEqual(['started', 'settled']);+ }+ expect(rig.updater.checkForUpdates).toHaveBeenCalledTimes(1);+ expect(rig.updater.setFeedURL).not.toHaveBeenCalledWith(+ expect.objectContaining({ provider: 'github' }),+ );+ if (outcome === 'deadline') {+ pending.resolve(undefined);+ await new Promise((resolve) => setTimeout(resolve, 0));+ expect(showCheckNowResult).toHaveBeenCalledTimes(1);+ }+ },+ );+test.each([+ { code: 'HTTP_ERROR_503', kind: 'error' },+ { code: 'ERR_UPDATER_CHANNEL_FILE_NOT_FOUND', kind: 'not-available' },+ ])(+ 'a beta proxy-class failure reports the manual check error without a GitHub retry ($code)',+ async ({ code, kind }) => {+ const showCheckNowResult = vi.fn(() => {});+ const { rig } = makeRig({+ appVersion: '0.4.0-beta.7',+ proxyFeed: { base: PROXY_BASE, channels: new Set(['beta']) },+ showCheckNowResult,+ });+ await Promise.resolve();+ const error = Object.assign(new Error('beta proxy unavailable'), { code });+ rig.updater.checkForUpdates.mockImplementation(() =>+ rejectAfterErrorEvent(rig.updater, error),+ );+ rig.ipc.invoke('ok:update:check-now');+ await new Promise((resolve) => setTimeout(resolve, 0));+ expect(showCheckNowResult).toHaveBeenCalledTimes(1);+ expect(showCheckNowResult).toHaveBeenCalledWith(+ kind === 'error'+ ? { kind, message: expect.any(String) }+ : { kind, currentVersion: '0.4.0-beta.7' },+ );+ expect(rig.updater.setFeedURL).not.toHaveBeenCalledWith(+ expect.objectContaining({ provider: 'github' }),+ );+ },+ );++ test.each([+ 'reject',+ 'resolve','deadline','destroy',- ] as const)('a pending initial proxy check handles %s', async (outcome) => {- const showCheckNowResult = vi.fn(() => {});- const pending = Promise.withResolvers<undefined>();- const { rig, handle } = makeRig({- appVersion: '0.4.0',- proxyFeed: { base: PROXY_BASE, channels: new Set(['latest']) },- showCheckNowResult,- updaterSetup: (updater) => {- updater.checkForUpdates = vi.fn(() => {- const feed = updater.setFeedURL.mock.calls.at(-1)?.[0];- if (typeof feed === 'object' && feed.provider === 'generic') return pending.promise;- throw new Error('unexpected updater feed');+ 'destroy-reject',+ 'dispatch-throw',+ ] as const)(+ 'a stable manual check handles a GitHub retry with no verdict event: %s',+ async (outcome) => {+ const showCheckNowResult = vi.fn(() => {});+ const { rig, handle } = makeRig({+ appVersion: '0.4.0',+ proxyFeed: { base: PROXY_BASE, channels: new Set(['latest']) },+ showCheckNowResult,+ });+ await Promise.resolve();+ rig.updater.checkForUpdates.mockClear();+ const retry = Promise.withResolvers<undefined>();+ const proxyError = Object.assign(new Error('proxy channel missing'), {+ code: 'ERR_UPDATER_CHANNEL_FILE_NOT_FOUND',+ });+ const retryError = Object.assign(new Error('GitHub unavailable'), { code: 'HTTP_ERROR_503' });+ rig.updater.checkForUpdates.mockImplementation(() => {+ const feed = rig.updater.setFeedURL.mock.calls.at(-1)?.[0];+ if (typeof feed === 'object' && feed.provider === 'generic') {+ return rejectAfterErrorEvent(rig.updater, proxyError);+ }+ if (typeof feed === 'object' && feed.provider === 'github') {+ if (outcome === 'dispatch-throw') throw retryError;+ return retry.promise;+ }+ throw new Error('unexpected updater feed');+ });+ rig.ipc.invoke('ok:update:check-now');+ await new Promise((resolve) => setTimeout(resolve, 0));+ if (outcome === 'dispatch-throw') {+ expect(rig.logger.error).toHaveBeenCalledWith('proxy-feed fallback checkForUpdates threw', {+ cause: proxyError.code,+ err: retryError,});- },- });- rig.ipc.invoke('ok:update:check-now');- expect(showCheckNowResult).not.toHaveBeenCalled();- rig.now = new Date(rig.now.getTime() + UPDATE_CHECK_DEADLINE_MS);- if (outcome === 'destroy') {+ expect(showCheckNowResult).toHaveBeenCalledTimes(1);+ expect(showCheckNowResult).toHaveBeenCalledWith(+ buildCheckNowResultFromError(proxyError, '0.4.0'),+ );+ expect(manualCheckPhases(rig)).toEqual(['started', 'settled']);+ expect(+ rig.clock.setTimeout.mock.calls.filter(([, ms]) => ms === UPDATE_CHECK_DEADLINE_MS),+ ).toHaveLength(2);+ return;+ }+ expect(showCheckNowResult).not.toHaveBeenCalled();+ expect(rig.logger.warn).toHaveBeenCalledWith(+ 'menu check verdict deferred to the GitHub retry',+ { code: proxyError.code, err: proxyError },+ );const deadlineIndex = rig.clock.setTimeout.mock.calls.findLastIndex(([, ms]) => ms === UPDATE_CHECK_DEADLINE_MS,);+ expect(deadlineIndex).toBeGreaterThanOrEqual(0);const deadlineHandle = rig.clock.setTimeout.mock.results[deadlineIndex]?.value;- handle.destroy();- expect(rig.clock.clearTimeout).toHaveBeenCalledWith(deadlineHandle);- for (const log of Object.values(rig.logger)) log.mockClear();- expect(() => fireTimerFor(rig.clock, UPDATE_CHECK_DEADLINE_MS)).toThrow();- expect(showCheckNowResult).not.toHaveBeenCalled();- for (const log of Object.values(rig.logger)) expect(log).not.toHaveBeenCalled();- expect(() => handle.destroy()).not.toThrow();- for (const log of Object.values(rig.logger)) expect(log).not.toHaveBeenCalled();- pending.reject(Object.assign(new Error('proxy unavailable'), { code: 'HTTP_ERROR_503' }));- await new Promise((resolve) => setTimeout(resolve, 0));- expect(showCheckNowResult).not.toHaveBeenCalled();- expect(() => fireTimerFor(rig.clock, UPDATE_CHECK_INTERVAL_MS)).toThrow();- } else {- fireTimerFor(rig.clock, UPDATE_CHECK_DEADLINE_MS);- expect(showCheckNowResult).not.toHaveBeenCalled();- expect(manualCheckPhases(rig)).toEqual(['started']);- expect(rig.logger.warn).toHaveBeenCalledWith('update check exceeded its deadline', {- ms: UPDATE_CHECK_DEADLINE_MS,- ageMs: UPDATE_CHECK_DEADLINE_MS,- menuCheckPending: true,- fallbackRetryPending: false,- usingProxyFeed: true,- proxyFallbackTried: false,- });- rig.now = new Date(rig.now.getTime() + MANUAL_CHECK_WATCHDOG_MS - UPDATE_CHECK_DEADLINE_MS);- fireTimerFor(rig.clock, MANUAL_CHECK_WATCHDOG_MS);- expect(showCheckNowResult).toHaveBeenCalledExactlyOnceWith({- kind: 'error',- message: MANUAL_CHECK_TIMED_OUT_MESSAGE,- });- expect(rig.dispatches).toContain('check-now-watchdog-fired');- expect(manualCheckPhases(rig)).toEqual(['started', 'settled']);- }- expect(rig.updater.checkForUpdates).toHaveBeenCalledTimes(1);- expect(rig.updater.setFeedURL).not.toHaveBeenCalledWith(- expect.objectContaining({ provider: 'github' }),- );- if (outcome === 'deadline') {- pending.resolve(undefined);- await new Promise((resolve) => setTimeout(resolve, 0));- expect(showCheckNowResult).toHaveBeenCalledTimes(1);- }- });-- test.each([- { code: 'HTTP_ERROR_503', kind: 'error' },- { code: 'ERR_UPDATER_CHANNEL_FILE_NOT_FOUND', kind: 'not-available' },- ])('a beta proxy-class failure reports the manual check error without a GitHub retry ($code)', async ({- code,- kind,- }) => {- const showCheckNowResult = vi.fn(() => {});- const { rig } = makeRig({- appVersion: '0.4.0-beta.7',- proxyFeed: { base: PROXY_BASE, channels: new Set(['beta']) },- showCheckNowResult,- });- await Promise.resolve();- const error = Object.assign(new Error('beta proxy unavailable'), { code });- rig.updater.checkForUpdates.mockImplementation(() => rejectAfterErrorEvent(rig.updater, error));- rig.ipc.invoke('ok:update:check-now');- await new Promise((resolve) => setTimeout(resolve, 0));- expect(showCheckNowResult).toHaveBeenCalledTimes(1);- expect(showCheckNowResult).toHaveBeenCalledWith(- kind === 'error'- ? { kind, message: expect.any(String) }- : { kind, currentVersion: '0.4.0-beta.7' },- );- expect(rig.updater.setFeedURL).not.toHaveBeenCalledWith(- expect.objectContaining({ provider: 'github' }),- );- });-- test.each([- 'reject',- 'resolve',- 'deadline',- 'destroy',- 'destroy-reject',- 'dispatch-throw',- ] as const)('a stable manual check handles a GitHub retry with no verdict event: %s', async (outcome) => {- const showCheckNowResult = vi.fn(() => {});- const { rig, handle } = makeRig({- appVersion: '0.4.0',- proxyFeed: { base: PROXY_BASE, channels: new Set(['latest']) },- showCheckNowResult,- });- await Promise.resolve();- rig.updater.checkForUpdates.mockClear();- const retry = Promise.withResolvers<undefined>();- const proxyError = Object.assign(new Error('proxy channel missing'), {- code: 'ERR_UPDATER_CHANNEL_FILE_NOT_FOUND',- });- const retryError = Object.assign(new Error('GitHub unavailable'), { code: 'HTTP_ERROR_503' });- rig.updater.checkForUpdates.mockImplementation(() => {- const feed = rig.updater.setFeedURL.mock.calls.at(-1)?.[0];- if (typeof feed === 'object' && feed.provider === 'generic') {- return rejectAfterErrorEvent(rig.updater, proxyError);+ if (outcome === 'destroy' || outcome === 'destroy-reject') {+ handle.destroy();+ expect(manualCheckPhases(rig)).toEqual(['started', 'settled']);+ expect(rig.clock.clearTimeout).toHaveBeenCalledWith(deadlineHandle);+ expect(() => fireTimerFor(rig.clock, UPDATE_CHECK_DEADLINE_MS)).toThrow();+ for (const log of Object.values(rig.logger)) log.mockClear();+ if (outcome === 'destroy-reject') retry.reject(retryError);+ else retry.resolve(undefined);+ await new Promise((resolve) => setTimeout(resolve, 0));+ expect(showCheckNowResult).not.toHaveBeenCalled();+ for (const log of Object.values(rig.logger)) expect(log).not.toHaveBeenCalled();+ expect(rig.updater.checkForUpdates).toHaveBeenCalledTimes(2);+ return;}- if (typeof feed === 'object' && feed.provider === 'github') {- if (outcome === 'dispatch-throw') throw retryError;- return retry.promise;+ if (outcome === 'reject') retry.reject(retryError);+ else if (outcome === 'resolve') retry.resolve(undefined);+ else {+ const reuseLogsBeforeClick = rig.logger.info.mock.calls.filter(+ ([message]) => message === 'check already in flight, reusing the pending promise',+ ).length;+ rig.ipc.invoke('ok:update:check-now');+ expect(showCheckNowResult).not.toHaveBeenCalled();+ expect(rig.updater.checkForUpdates).toHaveBeenCalledTimes(2);+ expect(rig.dispatches).toContain('check-now-already-pending');+ expect(+ rig.logger.info.mock.calls.filter(+ ([message]) => message === 'check already in flight, reusing the pending promise',+ ),+ ).toHaveLength(reuseLogsBeforeClick);+ rig.now = new Date(rig.now.getTime() + UPDATE_CHECK_DEADLINE_MS);+ fireTimerFor(rig.clock, UPDATE_CHECK_DEADLINE_MS);+ expect(showCheckNowResult).not.toHaveBeenCalled();+ expect(manualCheckPhases(rig)).toEqual(['started', 'started']);+ rig.now = new Date(rig.now.getTime() + MANUAL_CHECK_WATCHDOG_MS - UPDATE_CHECK_DEADLINE_MS);+ fireTimerFor(rig.clock, MANUAL_CHECK_WATCHDOG_MS);+ expect(rig.dispatches).toContain('check-now-watchdog-fired');+ expect(manualCheckPhases(rig)).toEqual(['started', 'started', 'settled']);}- throw new Error('unexpected updater feed');- });- rig.ipc.invoke('ok:update:check-now');- await new Promise((resolve) => setTimeout(resolve, 0));- if (outcome === 'dispatch-throw') {- expect(rig.logger.error).toHaveBeenCalledWith('proxy-feed fallback checkForUpdates threw', {- cause: proxyError.code,- err: retryError,- });+ await new Promise((resolve) => setTimeout(resolve, 0));expect(showCheckNowResult).toHaveBeenCalledTimes(1);expect(showCheckNowResult).toHaveBeenCalledWith(- buildCheckNowResultFromError(proxyError, '0.4.0'),- );- expect(manualCheckPhases(rig)).toEqual(['started', 'settled']);- expect(- rig.clock.setTimeout.mock.calls.filter(([, ms]) => ms === UPDATE_CHECK_DEADLINE_MS),- ).toHaveLength(2);- return;- }- expect(showCheckNowResult).not.toHaveBeenCalled();- expect(rig.logger.warn).toHaveBeenCalledWith(- 'menu check verdict deferred to the GitHub retry',- { code: proxyError.code, err: proxyError },- );- const deadlineIndex = rig.clock.setTimeout.mock.calls.findLastIndex(- ([, ms]) => ms === UPDATE_CHECK_DEADLINE_MS,- );- expect(deadlineIndex).toBeGreaterThanOrEqual(0);- const deadlineHandle = rig.clock.setTimeout.mock.results[deadlineIndex]?.value;- if (outcome === 'destroy' || outcome === 'destroy-reject') {- handle.destroy();- expect(manualCheckPhases(rig)).toEqual(['started', 'settled']);- expect(rig.clock.clearTimeout).toHaveBeenCalledWith(deadlineHandle);- expect(() => fireTimerFor(rig.clock, UPDATE_CHECK_DEADLINE_MS)).toThrow();- for (const log of Object.values(rig.logger)) log.mockClear();- if (outcome === 'destroy-reject') retry.reject(retryError);- else retry.resolve(undefined);- await new Promise((resolve) => setTimeout(resolve, 0));- expect(showCheckNowResult).not.toHaveBeenCalled();- for (const log of Object.values(rig.logger)) expect(log).not.toHaveBeenCalled();- expect(rig.updater.checkForUpdates).toHaveBeenCalledTimes(2);- return;- }- if (outcome === 'reject') retry.reject(retryError);- else if (outcome === 'resolve') retry.resolve(undefined);- else {- const reuseLogsBeforeClick = rig.logger.info.mock.calls.filter(- ([message]) => message === 'check already in flight, reusing the pending promise',- ).length;- rig.ipc.invoke('ok:update:check-now');- expect(showCheckNowResult).not.toHaveBeenCalled();- expect(rig.updater.checkForUpdates).toHaveBeenCalledTimes(2);- expect(rig.dispatches).toContain('check-now-already-pending');- expect(- rig.logger.info.mock.calls.filter(- ([message]) => message === 'check already in flight, reusing the pending promise',- ),- ).toHaveLength(reuseLogsBeforeClick);- rig.now = new Date(rig.now.getTime() + UPDATE_CHECK_DEADLINE_MS);- fireTimerFor(rig.clock, UPDATE_CHECK_DEADLINE_MS);- expect(showCheckNowResult).not.toHaveBeenCalled();- expect(manualCheckPhases(rig)).toEqual(['started', 'started']);- rig.now = new Date(rig.now.getTime() + MANUAL_CHECK_WATCHDOG_MS - UPDATE_CHECK_DEADLINE_MS);- fireTimerFor(rig.clock, MANUAL_CHECK_WATCHDOG_MS);- expect(rig.dispatches).toContain('check-now-watchdog-fired');- expect(manualCheckPhases(rig)).toEqual(['started', 'started', 'settled']);- }- await new Promise((resolve) => setTimeout(resolve, 0));- expect(showCheckNowResult).toHaveBeenCalledTimes(1);- expect(showCheckNowResult).toHaveBeenCalledWith(- outcome === 'reject'- ? { kind: 'error', message: retryError.message }- : outcome === 'deadline'- ? { kind: 'error', message: MANUAL_CHECK_TIMED_OUT_MESSAGE }- : { kind: 'not-available', currentVersion: '0.4.0' },- );- expect(manualCheckPhases(rig)).toEqual(- outcome === 'deadline' ? ['started', 'started', 'settled'] : ['started', 'settled'],- );- if (outcome !== 'deadline') expect(rig.clock.clearTimeout).toHaveBeenCalledWith(deadlineHandle);- if (outcome === 'resolve') {- expect(rig.logger.info).toHaveBeenCalledWith('post-fallback checkForUpdates resolved', {- menuCheckPending: true,- });- }- if (outcome === 'reject') {- expect(rig.logger.warn).toHaveBeenCalledWith('post-fallback checkForUpdates rejected', {- code: retryError.code,- err: retryError,- menuCheckPending: true,- });- }- if (outcome === 'deadline') {- expect(rig.logger.warn).toHaveBeenCalledWith('update check exceeded its deadline', {- ms: UPDATE_CHECK_DEADLINE_MS,- ageMs: UPDATE_CHECK_DEADLINE_MS,- menuCheckPending: true,- fallbackRetryPending: true,- usingProxyFeed: false,- proxyFallbackTried: true,- });- expect(rig.updater.checkForUpdates).toHaveBeenCalledTimes(2);- expect(rig.logger.warn).not.toHaveBeenCalledWith(- 'post-fallback checkForUpdates rejected',- expect.anything(),+ outcome === 'reject'+ ? { kind: 'error', message: retryError.message }+ : outcome === 'deadline'+ ? { kind: 'error', message: MANUAL_CHECK_TIMED_OUT_MESSAGE }+ : { kind: 'not-available', currentVersion: '0.4.0' },);- expect(rig.logger.debug).not.toHaveBeenCalledWith(- 'post-fallback checkForUpdates rejected',- expect.anything(),+ expect(manualCheckPhases(rig)).toEqual(+ outcome === 'deadline' ? ['started', 'started', 'settled'] : ['started', 'settled'],);- expect(rig.clock.clearTimeout).not.toHaveBeenCalledWith(deadlineHandle);- const feedCalls = rig.updater.setFeedURL.mock.calls.length;- rig.ipc.invoke('ok:update:check-now');- expect(manualCheckPhases(rig)).toEqual([- 'started',- 'started',- 'settled',- 'started',- 'settled',- ]);- await new Promise((resolve) => setTimeout(resolve, 0));- expect(rig.updater.checkForUpdates).toHaveBeenCalledTimes(2);- expect(rig.updater.setFeedURL).toHaveBeenCalledTimes(feedCalls);- expect(showCheckNowResult).toHaveBeenCalledTimes(2);- expect(showCheckNowResult).toHaveBeenLastCalledWith({- kind: 'error',- message: UPDATE_CHECK_WEDGED_MESSAGE,- });- expect(manualCheckPhases(rig)).toEqual([- 'started',- 'started',- 'settled',- 'started',- 'settled',- ]);- expect(rig.logger.warn).toHaveBeenCalledWith(- 'check already in flight, reusing the pending promise',- {- ageMs: MANUAL_CHECK_WATCHDOG_MS,- timedOut: true,+ if (outcome !== 'deadline')+ expect(rig.clock.clearTimeout).toHaveBeenCalledWith(deadlineHandle);+ if (outcome === 'resolve') {+ expect(rig.logger.info).toHaveBeenCalledWith('post-fallback checkForUpdates resolved', {+ menuCheckPending: true,+ });+ }+ if (outcome === 'reject') {+ expect(rig.logger.warn).toHaveBeenCalledWith('post-fallback checkForUpdates rejected', {+ code: retryError.code,+ err: retryError,+ menuCheckPending: true,+ });+ }+ if (outcome === 'deadline') {+ expect(rig.logger.warn).toHaveBeenCalledWith('update check exceeded its deadline', {+ ms: UPDATE_CHECK_DEADLINE_MS,+ ageMs: UPDATE_CHECK_DEADLINE_MS,menuCheckPending: true,fallbackRetryPending: true,usingProxyFeed: false,proxyFallbackTried: true,- },- );- expect(rig.updater.checkForUpdates).toHaveBeenCalledTimes(2);- expect(rig.updater.setFeedURL).toHaveBeenCalledTimes(feedCalls);- retry.resolve(undefined);- await new Promise((resolve) => setTimeout(resolve, 0));- expect(showCheckNowResult).toHaveBeenCalledTimes(2);- expect(rig.clock.clearTimeout).toHaveBeenCalledWith(deadlineHandle);- rig.updater.checkForUpdates.mockResolvedValue(undefined);- fireTimerFor(rig.clock, UPDATE_CHECK_INTERVAL_MS);- expect(rig.updater.checkForUpdates).toHaveBeenCalledTimes(3);- expect(rig.updater.setFeedURL).toHaveBeenLastCalledWith({- provider: 'generic',- url: `${PROXY_BASE}/stable`,- });- await new Promise((resolve) => setTimeout(resolve, 0));- expect(showCheckNowResult).toHaveBeenCalledTimes(2);- }- });-- test.each([- 'available',- 'not-available',- 'error',- ] as const)('a stable proxy channel-file failure lets the GitHub retry report %s exactly once', async (outcome) => {- const showCheckNowResult = vi.fn(() => {});- const { rig } = makeRig({- appVersion: '0.4.0',- proxyFeed: { base: PROXY_BASE, channels: new Set(['latest']) },- showCheckNowResult,- });- await Promise.resolve();- const finishRetry = Promise.withResolvers<undefined>();- const proxyError = Object.assign(new Error('proxy channel missing'), {- code: 'ERR_UPDATER_CHANNEL_FILE_NOT_FOUND',- });- const retryError = Object.assign(new Error('GitHub unavailable'), { code: 'HTTP_ERROR_503' });- rig.updater.checkForUpdates.mockImplementation(async () => {- const feed = rig.updater.setFeedURL.mock.calls.at(-1)?.[0];- if (typeof feed === 'object' && feed.provider === 'generic') {- return rejectAfterErrorEvent(rig.updater, proxyError);- }- if (typeof feed === 'object' && feed.provider === 'github') {- await finishRetry.promise;- if (outcome === 'error') {- return rejectAfterErrorEvent(rig.updater, retryError);- }- rig.updater.emit(`update-${outcome}`, {- version: outcome === 'available' ? '0.4.1' : '0.4.0',});- return undefined;+ expect(rig.updater.checkForUpdates).toHaveBeenCalledTimes(2);+ expect(rig.logger.warn).not.toHaveBeenCalledWith(+ 'post-fallback checkForUpdates rejected',+ expect.anything(),+ );+ expect(rig.logger.debug).not.toHaveBeenCalledWith(+ 'post-fallback checkForUpdates rejected',+ expect.anything(),+ );+ expect(rig.clock.clearTimeout).not.toHaveBeenCalledWith(deadlineHandle);+ const feedCalls = rig.updater.setFeedURL.mock.calls.length;+ rig.ipc.invoke('ok:update:check-now');+ expect(manualCheckPhases(rig)).toEqual([+ 'started',+ 'started',+ 'settled',+ 'started',+ 'settled',+ ]);+ await new Promise((resolve) => setTimeout(resolve, 0));+ expect(rig.updater.checkForUpdates).toHaveBeenCalledTimes(2);+ expect(rig.updater.setFeedURL).toHaveBeenCalledTimes(feedCalls);+ expect(showCheckNowResult).toHaveBeenCalledTimes(2);+ expect(showCheckNowResult).toHaveBeenLastCalledWith({+ kind: 'error',+ message: UPDATE_CHECK_WEDGED_MESSAGE,+ });+ expect(manualCheckPhases(rig)).toEqual([+ 'started',+ 'started',+ 'settled',+ 'started',+ 'settled',+ ]);+ expect(rig.logger.warn).toHaveBeenCalledWith(+ 'check already in flight, reusing the pending promise',+ {+ ageMs: MANUAL_CHECK_WATCHDOG_MS,+ timedOut: true,+ menuCheckPending: true,+ fallbackRetryPending: true,+ usingProxyFeed: false,+ proxyFallbackTried: true,+ },+ );+ expect(rig.updater.checkForUpdates).toHaveBeenCalledTimes(2);+ expect(rig.updater.setFeedURL).toHaveBeenCalledTimes(feedCalls);+ retry.resolve(undefined);+ await new Promise((resolve) => setTimeout(resolve, 0));+ expect(showCheckNowResult).toHaveBeenCalledTimes(2);+ expect(rig.clock.clearTimeout).toHaveBeenCalledWith(deadlineHandle);+ rig.updater.checkForUpdates.mockResolvedValue(undefined);+ fireTimerFor(rig.clock, UPDATE_CHECK_INTERVAL_MS);+ expect(rig.updater.checkForUpdates).toHaveBeenCalledTimes(3);+ expect(rig.updater.setFeedURL).toHaveBeenLastCalledWith({+ provider: 'generic',+ url: `${PROXY_BASE}/stable`,+ });+ await new Promise((resolve) => setTimeout(resolve, 0));+ expect(showCheckNowResult).toHaveBeenCalledTimes(2);}- throw new Error('unexpected updater feed');- });-- rig.ipc.invoke('ok:update:check-now');- await new Promise((resolve) => setTimeout(resolve, 0));- expect(showCheckNowResult).not.toHaveBeenCalled();- finishRetry.resolve(undefined);- await new Promise((resolve) => setTimeout(resolve, 0));+ },+ );- expect(showCheckNowResult).toHaveBeenCalledTimes(1);- if (outcome === 'available') {- expect(showCheckNowResult).toHaveBeenCalledWith({- kind: 'available',- currentVersion: '0.4.0',- latestVersion: '0.4.1',+ test.each(['available', 'not-available', 'error'] as const)(+ 'a stable proxy channel-file failure lets the GitHub retry report %s exactly once',+ async (outcome) => {+ const showCheckNowResult = vi.fn(() => {});+ const { rig } = makeRig({+ appVersion: '0.4.0',+ proxyFeed: { base: PROXY_BASE, channels: new Set(['latest']) },+ showCheckNowResult,});- expect(showCheckNowResult).not.toHaveBeenCalledWith(- expect.objectContaining({ kind: 'not-available' }),- );- } else if (outcome === 'not-available') {- expect(showCheckNowResult).toHaveBeenCalledWith({- kind: 'not-available',- currentVersion: '0.4.0',+ await Promise.resolve();+ const finishRetry = Promise.withResolvers<undefined>();+ const proxyError = Object.assign(new Error('proxy channel missing'), {+ code: 'ERR_UPDATER_CHANNEL_FILE_NOT_FOUND',});- } else {- expect(showCheckNowResult).toHaveBeenCalledWith({- kind: 'error',- message: retryError.message,+ const retryError = Object.assign(new Error('GitHub unavailable'), { code: 'HTTP_ERROR_503' });+ rig.updater.checkForUpdates.mockImplementation(async () => {+ const feed = rig.updater.setFeedURL.mock.calls.at(-1)?.[0];+ if (typeof feed === 'object' && feed.provider === 'generic') {+ return rejectAfterErrorEvent(rig.updater, proxyError);+ }+ if (typeof feed === 'object' && feed.provider === 'github') {+ await finishRetry.promise;+ if (outcome === 'error') {+ return rejectAfterErrorEvent(rig.updater, retryError);+ }+ rig.updater.emit(`update-${outcome}`, {+ version: outcome === 'available' ? '0.4.1' : '0.4.0',+ });+ return undefined;+ }+ throw new Error('unexpected updater feed');});- }- expect(- rig.updater.setFeedURL.mock.calls.filter(- ([feed]) => typeof feed === 'object' && feed.provider === 'github',- ),- ).toHaveLength(1);- expect(rig.updater.checkForUpdates).toHaveBeenCalledTimes(3);- });++ rig.ipc.invoke('ok:update:check-now');+ await new Promise((resolve) => setTimeout(resolve, 0));+ expect(showCheckNowResult).not.toHaveBeenCalled();+ finishRetry.resolve(undefined);+ await new Promise((resolve) => setTimeout(resolve, 0));++ expect(showCheckNowResult).toHaveBeenCalledTimes(1);+ if (outcome === 'available') {+ expect(showCheckNowResult).toHaveBeenCalledWith({+ kind: 'available',+ currentVersion: '0.4.0',+ latestVersion: '0.4.1',+ });+ expect(showCheckNowResult).not.toHaveBeenCalledWith(+ expect.objectContaining({ kind: 'not-available' }),+ );+ } else if (outcome === 'not-available') {+ expect(showCheckNowResult).toHaveBeenCalledWith({+ kind: 'not-available',+ currentVersion: '0.4.0',+ });+ } else {+ expect(showCheckNowResult).toHaveBeenCalledWith({+ kind: 'error',+ message: retryError.message,+ });+ }+ expect(+ rig.updater.setFeedURL.mock.calls.filter(+ ([feed]) => typeof feed === 'object' && feed.provider === 'github',+ ),+ ).toHaveLength(1);+ expect(rig.updater.checkForUpdates).toHaveBeenCalledTimes(3);+ },+ );test('a synchronous GitHub feed switch failure reports the manual check error exactly once', async () => {const showCheckNowResult = vi.fn(() => {});@@ -4026,37 +4035,34 @@ describe('check-now → showCheckNowResult feedback dispatch', () => {).toHaveLength(1);});- test.each([- 'update-available',- 'update-not-available',- 'error',- 'resolve',- 'reject',- ] as const)('%s clears the manual watchdog and prevents a later timeout dialog', async (outcome) => {- const showCheckNowResult = vi.fn(() => {});- const { rig } = makeRig({ showCheckNowResult, isPackaged: false });- rig.updater.checkForUpdates = vi.fn(() =>- outcome === 'reject'- ? Promise.reject(new Error('network unavailable'))- : Promise.resolve(null),- );- rig.ipc.invoke('ok:update:check-now');- const [watchdogHandle, watchdog] = liveTimerFor(rig.clock, MANUAL_CHECK_WATCHDOG_MS);- expect(watchdog.state).toBe('live');+ test.each(['update-available', 'update-not-available', 'error', 'resolve', 'reject'] as const)(+ '%s clears the manual watchdog and prevents a later timeout dialog',+ async (outcome) => {+ const showCheckNowResult = vi.fn(() => {});+ const { rig } = makeRig({ showCheckNowResult, isPackaged: false });+ rig.updater.checkForUpdates = vi.fn(() =>+ outcome === 'reject'+ ? Promise.reject(new Error('network unavailable'))+ : Promise.resolve(null),+ );+ rig.ipc.invoke('ok:update:check-now');+ const [watchdogHandle, watchdog] = liveTimerFor(rig.clock, MANUAL_CHECK_WATCHDOG_MS);+ expect(watchdog.state).toBe('live');- if (outcome === 'error') rig.updater.emit('error', new Error('network unavailable'));- else if (outcome !== 'resolve' && outcome !== 'reject') {- rig.updater.emit(outcome, { version: '0.3.2' });- }- await new Promise((resolve) => setTimeout(resolve, 0));- expect(rig.clock.clearTimeout).toHaveBeenCalledWith(watchdogHandle);- expect(manualCheckPhases(rig)).toEqual(['started', 'settled']);- expect(showCheckNowResult).toHaveBeenCalledTimes(outcome === 'resolve' ? 0 : 1);- showCheckNowResult.mockClear();- watchdog.cb();- expect(showCheckNowResult).not.toHaveBeenCalled();- expect(manualCheckPhases(rig)).toEqual(['started', 'settled']);- });+ if (outcome === 'error') rig.updater.emit('error', new Error('network unavailable'));+ else if (outcome !== 'resolve' && outcome !== 'reject') {+ rig.updater.emit(outcome, { version: '0.3.2' });+ }+ await new Promise((resolve) => setTimeout(resolve, 0));+ expect(rig.clock.clearTimeout).toHaveBeenCalledWith(watchdogHandle);+ expect(manualCheckPhases(rig)).toEqual(['started', 'settled']);+ expect(showCheckNowResult).toHaveBeenCalledTimes(outcome === 'resolve' ? 0 : 1);+ showCheckNowResult.mockClear();+ watchdog.cb();+ expect(showCheckNowResult).not.toHaveBeenCalled();+ expect(manualCheckPhases(rig)).toEqual(['started', 'settled']);+ },+ );test('destroy clears a pending manual watchdog without showing a dialog', () => {const showCheckNowResult = vi.fn(() => {});@@ -5370,42 +5376,42 @@ describe('single-flight install handoff', () => {expect(rig.dispatches).not.toContain('download-skipped-install-armed' as DispatchKind);});- test.each([- 'win32',- 'linux',- ] as const)('on %s a manual check for a newer offer reports it as downloading', (platform) => {- const showCheckNowResult = vi.fn(() => {});- const { rig } = makeRig({- appVersion: '0.3.1',- versionPendingInstall: null,- platform,- showCheckNowResult,- });- stageInSession(rig, '0.3.2');- showCheckNowResult.mockClear();+ test.each(['win32', 'linux'] as const)(+ 'on %s a manual check for a newer offer reports it as downloading',+ (platform) => {+ const showCheckNowResult = vi.fn(() => {});+ const { rig } = makeRig({+ appVersion: '0.3.1',+ versionPendingInstall: null,+ platform,+ showCheckNowResult,+ });+ stageInSession(rig, '0.3.2');+ showCheckNowResult.mockClear();- rig.ipc.invoke('ok:update:check-now');- rig.updater.emit('update-available', { version: '0.3.3' });+ rig.ipc.invoke('ok:update:check-now');+ rig.updater.emit('update-available', { version: '0.3.3' });- expect(showCheckNowResult).toHaveBeenCalledWith({- kind: 'available',- currentVersion: '0.3.1',- latestVersion: '0.3.3',- });- });+ expect(showCheckNowResult).toHaveBeenCalledWith({+ kind: 'available',+ currentVersion: '0.3.1',+ latestVersion: '0.3.3',+ });+ },+ );- test.each([- 'win32',- 'linux',- ] as const)('on %s the same-version skip still applies', (platform) => {- const { rig } = makeRig({ versionPendingInstall: null, platform });- stageInSession(rig, '0.3.2');+ test.each(['win32', 'linux'] as const)(+ 'on %s the same-version skip still applies',+ (platform) => {+ const { rig } = makeRig({ versionPendingInstall: null, platform });+ stageInSession(rig, '0.3.2');- rig.updater.emit('update-available', { version: '0.3.2' });+ rig.updater.emit('update-available', { version: '0.3.2' });- expect(rig.updater.downloadUpdate).not.toHaveBeenCalled();- expect(rig.dispatches).toContain('download-skipped-already-staged' as DispatchKind);- });+ expect(rig.updater.downloadUpdate).not.toHaveBeenCalled();+ expect(rig.dispatches).toContain('download-skipped-already-staged' as DispatchKind);+ },+ );test('a manual check names the build that will install, not the declined offer', () => {const showCheckNowResult = vi.fn(() => {});@@ -5449,53 +5455,53 @@ describe('single-flight install handoff', () => {});});- test.each([- 'win32',- 'linux',- ] as const)('on %s a manual check for the armed build still reads as ready', (platform) => {- const showCheckNowResult = vi.fn(() => {});- const { rig } = makeRig({- appVersion: '0.3.1',- versionPendingInstall: null,- platform,- showCheckNowResult,- });- stageInSession(rig, '0.3.2');- showCheckNowResult.mockClear();+ test.each(['win32', 'linux'] as const)(+ 'on %s a manual check for the armed build still reads as ready',+ (platform) => {+ const showCheckNowResult = vi.fn(() => {});+ const { rig } = makeRig({+ appVersion: '0.3.1',+ versionPendingInstall: null,+ platform,+ showCheckNowResult,+ });+ stageInSession(rig, '0.3.2');+ showCheckNowResult.mockClear();- rig.ipc.invoke('ok:update:check-now');- rig.updater.emit('update-available', { version: '0.3.2' });+ rig.ipc.invoke('ok:update:check-now');+ rig.updater.emit('update-available', { version: '0.3.2' });- expect(rig.updater.downloadUpdate).not.toHaveBeenCalled();- expect(showCheckNowResult).toHaveBeenCalledWith({- kind: 'ready-to-install',- currentVersion: '0.3.1',- stagedVersion: '0.3.2',- });- });+ expect(rig.updater.downloadUpdate).not.toHaveBeenCalled();+ expect(showCheckNowResult).toHaveBeenCalledWith({+ kind: 'ready-to-install',+ currentVersion: '0.3.1',+ stagedVersion: '0.3.2',+ });+ },+ );- test.each([- 'win32',- 'linux',- ] as const)('on %s a relaunch that cannot restore its state releases the arm', async (platform) => {- const { rig } = makeRig({ versionPendingInstall: null, platform });- stageInSession(rig, '0.3.2');- rig.updater.quitAndInstall = vi.fn(() => {- rig.failNextPersist = true;- throw new Error('installer refused the handoff');- });+ test.each(['win32', 'linux'] as const)(+ 'on %s a relaunch that cannot restore its state releases the arm',+ async (platform) => {+ const { rig } = makeRig({ versionPendingInstall: null, platform });+ stageInSession(rig, '0.3.2');+ rig.updater.quitAndInstall = vi.fn(() => {+ rig.failNextPersist = true;+ throw new Error('installer refused the handoff');+ });- await expect(Promise.resolve(rig.ipc.invoke('ok:update:relaunch-now'))).rejects.toThrow(- 'installer refused the handoff',- );- expect(rig.state.versionPendingInstall).toBeNull();- rig.failNextPersist = false;- rig.updater.downloadUpdate.mockClear();+ await expect(Promise.resolve(rig.ipc.invoke('ok:update:relaunch-now'))).rejects.toThrow(+ 'installer refused the handoff',+ );+ expect(rig.state.versionPendingInstall).toBeNull();+ rig.failNextPersist = false;+ rig.updater.downloadUpdate.mockClear();- rig.updater.emit('update-available', { version: '0.3.2' });+ rig.updater.emit('update-available', { version: '0.3.2' });- expect(rig.updater.downloadUpdate).toHaveBeenCalledTimes(1);- });+ expect(rig.updater.downloadUpdate).toHaveBeenCalledTimes(1);+ },+ );test('on macOS a watchdog fire that cannot restore KEEPS the arm', async () => {const { rig } = makeRig({ versionPendingInstall: null });@@ -5728,7 +5734,9 @@ describe('the commit flag releases on every path that re-offers the click', () =const failed = rig.captured.filter((c) => c.channel === 'ok:update:relaunch-failed');expect(failed).toHaveLength(1);- expect((failed[0]?.payload as { dismissPending?: boolean }).dismissPending).toBeUndefined();+ expect(+ (failed[0]?.payload as { dismissPending?: boolean } | undefined)?.dismissPending,+ ).toBeUndefined();expect(rig.captured.filter((c) => c.channel === 'ok:update:downloaded')).toHaveLength(1);});diff --git a/packages/desktop/tests/main/navigator-window.test.ts b/packages/desktop/tests/main/navigator-window.test.tsindex bdfae9002..112ee6b1c 100644--- a/packages/desktop/tests/main/navigator-window.test.ts+++ b/packages/desktop/tests/main/navigator-window.test.ts@@ -417,7 +417,9 @@ describe('navigator boot narration (the phase consent-dialog waits over)', () =>expect(h.intervals.every((i) => i.cleared)).toBe(true);const failure = h.lines.find((l) => l.event === 'desktop-navigator-load-failed');expect(failure).toMatchObject({ level: 'warn' });- expect((failure?.err as Error).message).toBe('ERR_FILE_NOT_FOUND');+ const failureErr = failure?.err;+ expect(failureErr).toBeInstanceOf(Error);+ expect((failureErr as Error).message).toBe('ERR_FILE_NOT_FOUND');const resolved = h.lines.find((l) => l.event === 'desktop-navigator-load-resolved');expect(resolved).toBeUndefined();});diff --git a/packages/desktop/tests/main/show-gate.test.ts b/packages/desktop/tests/main/show-gate.test.tsindex 3abd46a27..5ba0b07e2 100644--- a/packages/desktop/tests/main/show-gate.test.ts+++ b/packages/desktop/tests/main/show-gate.test.ts@@ -437,7 +437,9 @@ describe('createShowGateRegistry — show() throws past the destroyed-window guaevent: 'show-gate-show-failed',windowKind: 'editor',});- expect((failure?.obj as { err?: Error }).err?.message).toBe('Object has been destroyed');+ expect((failure?.obj as { err?: Error } | undefined)?.err?.message).toBe(+ 'Object has been destroyed',+ );});test('happy-path show throws → states Map entry is released (no leak)', () => {@@ -462,7 +464,9 @@ describe('createShowGateRegistry — show() throws past the destroyed-window guaevent: 'show-gate-show-failed',windowKind: 'navigator',});- expect((failure?.obj as { err?: Error }).err?.message).toBe('Object has been destroyed');+ expect((failure?.obj as { err?: Error } | undefined)?.err?.message).toBe(+ 'Object has been destroyed',+ );const timeout = env.warns.find((w) => (w.obj as { event?: unknown }).event === 'show-gate-timeout',);diff --git a/packages/desktop/tests/main/terminal-manager.test.ts b/packages/desktop/tests/main/terminal-manager.test.tsindex 8651cb1a9..41511e197 100644--- a/packages/desktop/tests/main/terminal-manager.test.ts+++ b/packages/desktop/tests/main/terminal-manager.test.ts@@ -218,80 +218,83 @@ describe('createTerminalManager — create', () => {});});- test.each([- ...TERMINAL_SHELL_NOTICE_REASONS,- ])('forwards the shared invalid-override reason %s to the renderer', (reason) => {- const h = makeManager();- h.mgr.create({- windowId: 1,- webContents: makeWebContents(),- projectRoot: PROJECT,- cols: 80,- rows: 24,- });+ test.each([...TERMINAL_SHELL_NOTICE_REASONS])(+ 'forwards the shared invalid-override reason %s to the renderer',+ (reason) => {+ const h = makeManager();+ h.mgr.create({+ windowId: 1,+ webContents: makeWebContents(),+ projectRoot: PROJECT,+ cols: 80,+ rows: 24,+ });- h.forked[0]?.emitMessage({- type: 'shell-notice',- ptyId: 'pty-1',- notice: 'invalid-shell-override',- reason,- });+ h.forked[0]?.emitMessage({+ type: 'shell-notice',+ ptyId: 'pty-1',+ notice: 'invalid-shell-override',+ reason,+ });- expect(h.sent).toContainEqual({- channel: 'ok:pty:notice',- payload: { ptyId: 'pty-1', notice: 'invalid-shell-override', reason },- });- });+ expect(h.sent).toContainEqual({+ channel: 'ok:pty:notice',+ payload: { ptyId: 'pty-1', notice: 'invalid-shell-override', reason },+ });+ },+ );- test.each([- ...WINDOWS_SHELL_FAMILIES,- ])('forwards the shared resolved shell family %s to the renderer', (shellFamily) => {- const h = makeManager();- h.mgr.create({- windowId: 1,- webContents: makeWebContents(),- projectRoot: PROJECT,- cols: 80,- rows: 24,- });+ test.each([...WINDOWS_SHELL_FAMILIES])(+ 'forwards the shared resolved shell family %s to the renderer',+ (shellFamily) => {+ const h = makeManager();+ h.mgr.create({+ windowId: 1,+ webContents: makeWebContents(),+ projectRoot: PROJECT,+ cols: 80,+ rows: 24,+ });- h.forked[0]?.emitMessage({- type: 'shell-notice',- ptyId: 'pty-1',- notice: 'shell-resolved',- shellFamily,- });+ h.forked[0]?.emitMessage({+ type: 'shell-notice',+ ptyId: 'pty-1',+ notice: 'shell-resolved',+ shellFamily,+ });- expect(h.sent).toContainEqual({- channel: 'ok:pty:notice',- payload: { ptyId: 'pty-1', notice: 'shell-resolved', shellFamily },- });- });+ expect(h.sent).toContainEqual({+ channel: 'ok:pty:notice',+ payload: { ptyId: 'pty-1', notice: 'shell-resolved', shellFamily },+ });+ },+ );- test.each([- ...TERMINAL_SUPPORT_FILE_NOTICE_REASONS,- ])('forwards the support-file degradation reason %s to the renderer', (reason) => {- const h = makeManager();- h.mgr.create({- windowId: 1,- webContents: makeWebContents(),- projectRoot: PROJECT,- cols: 80,- rows: 24,- });+ test.each([...TERMINAL_SUPPORT_FILE_NOTICE_REASONS])(+ 'forwards the support-file degradation reason %s to the renderer',+ (reason) => {+ const h = makeManager();+ h.mgr.create({+ windowId: 1,+ webContents: makeWebContents(),+ projectRoot: PROJECT,+ cols: 80,+ rows: 24,+ });- h.forked[0]?.emitMessage({- type: 'shell-notice',- ptyId: 'pty-1',- notice: 'support-file-degraded',- reason,- });+ h.forked[0]?.emitMessage({+ type: 'shell-notice',+ ptyId: 'pty-1',+ notice: 'support-file-degraded',+ reason,+ });- expect(h.sent).toContainEqual({- channel: 'ok:pty:notice',- payload: { ptyId: 'pty-1', notice: 'support-file-degraded', reason },- });- });+ expect(h.sent).toContainEqual({+ channel: 'ok:pty:notice',+ payload: { ptyId: 'pty-1', notice: 'support-file-degraded', reason },+ });+ },+ );test('drops a shell notice whose reason or family is outside the shared sets', () => {const h = makeManager();diff --git a/packages/desktop/tests/main/theme-applied-handler.test.ts b/packages/desktop/tests/main/theme-applied-handler.test.tsindex ea25dad7c..c4e8014ff 100644--- a/packages/desktop/tests/main/theme-applied-handler.test.ts+++ b/packages/desktop/tests/main/theme-applied-handler.test.ts@@ -51,7 +51,7 @@ describe('applyThemeApplied — show-gate dispatch', () => {applyThemeApplied(deps, null, undefined);const warns = trace.filter((t) => t.step === 'warn');expect(warns).toHaveLength(1);- const line = (warns[0]?.args as { line: string }).line;+ const line = (warns[0]?.args as { line: string } | undefined)?.line;expect(JSON.parse(line)).toEqual({event: 'theme-applied-no-window-for-sender',});diff --git a/packages/desktop/tests/main/theme-handler.test.ts b/packages/desktop/tests/main/theme-handler.test.tsindex 3af55cf63..b6b623f68 100644--- a/packages/desktop/tests/main/theme-handler.test.ts+++ b/packages/desktop/tests/main/theme-handler.test.ts@@ -42,7 +42,7 @@ describe('applyThemeSource happy path', () => {applyThemeSource(deps, 'dark');const warns = trace.filter((t) => t.step === 'warn');expect(warns).toHaveLength(1);- const line = (warns[0]?.args as { line: string }).line;+ const line = (warns[0]?.args as { line: string } | undefined)?.line;expect(JSON.parse(line)).toEqual({event: 'theme-source-set',source: 'dark',@@ -51,16 +51,15 @@ describe('applyThemeSource happy path', () => {});});- test.each([- ['system' as OkThemeSource],- ['light' as OkThemeSource],- ['dark' as OkThemeSource],- ])('accepts each user-intent value: %s', (source) => {- const { deps, getCurrent } = makeDeps('system');- const result = applyThemeSource(deps, source);- expect(result).toEqual({ ok: true });- expect(getCurrent()).toBe(source);- });+ test.each([['system' as OkThemeSource], ['light' as OkThemeSource], ['dark' as OkThemeSource]])(+ 'accepts each user-intent value: %s',+ (source) => {+ const { deps, getCurrent } = makeDeps('system');+ const result = applyThemeSource(deps, source);+ expect(result).toEqual({ ok: true });+ expect(getCurrent()).toBe(source);+ },+ );});describe('applyThemeSource defensive rejection', () => {@@ -77,7 +76,7 @@ describe('applyThemeSource defensive rejection', () => {applyThemeSource(deps, 'rainbow' as unknown as OkThemeSource);const warns = trace.filter((t) => t.step === 'warn');expect(warns).toHaveLength(1);- const line = (warns[0]?.args as { line: string }).line;+ const line = (warns[0]?.args as { line: string } | undefined)?.line;expect(JSON.parse(line)).toEqual({event: 'theme-source-set-rejected',received: 'rainbow',@@ -95,32 +94,24 @@ describe('applyThemeSource side-effect boundaries', () => {});describe('isOkThemeSource type predicate', () => {- test.each([- ['system'],- ['light'],- ['dark'],- ])('accepts canonical OkThemeSource value: %s', (value) => {- expect(isOkThemeSource(value)).toBe(true);- });+ test.each([['system'], ['light'], ['dark']])(+ 'accepts canonical OkThemeSource value: %s',+ (value) => {+ expect(isOkThemeSource(value)).toBe(true);+ },+ );- test.each([- ['auto'],- ['Light'],- [''],- ['SYSTEM'],- ['system '],- ])('rejects out-of-range string: %s', (value) => {- expect(isOkThemeSource(value)).toBe(false);- });+ test.each([['auto'], ['Light'], [''], ['SYSTEM'], ['system ']])(+ 'rejects out-of-range string: %s',+ (value) => {+ expect(isOkThemeSource(value)).toBe(false);+ },+ );- test.each([- [null],- [undefined],- [42],- [true],- [{}],- [['system']],- ])('rejects non-string input: %p', (value) => {- expect(isOkThemeSource(value)).toBe(false);- });+ test.each([[null], [undefined], [42], [true], [{}], [['system']]])(+ 'rejects non-string input: %p',+ (value) => {+ expect(isOkThemeSource(value)).toBe(false);+ },+ );});diff --git a/packages/desktop/tests/main/url-scheme-handler.test.ts b/packages/desktop/tests/main/url-scheme-handler.test.tsindex b33d0f096..887b8d625 100644--- a/packages/desktop/tests/main/url-scheme-handler.test.ts+++ b/packages/desktop/tests/main/url-scheme-handler.test.ts@@ -1101,7 +1101,7 @@ describe('registerProtocolHandler — share-flow routing', () => {const fixtureEntry = shareFixture.validShares.find((entry) => entry.id === 'v2-one-segment-document',);- if (!fixtureEntry || fixtureEntry.version !== 2) throw new Error('missing v2 fixture');+ if (fixtureEntry?.version !== 2) throw new Error('missing v2 fixture');registerProtocolHandler({app: env.app,diff --git a/packages/desktop/tests/unit/desktop-host-contract-single-source.test.ts b/packages/desktop/tests/unit/desktop-host-contract-single-source.test.tsindex c4c375119..0a991adf0 100644--- a/packages/desktop/tests/unit/desktop-host-contract-single-source.test.ts+++ b/packages/desktop/tests/unit/desktop-host-contract-single-source.test.ts@@ -103,8 +103,9 @@ describe('desktop host contract single source', () => {}expect(corePackageJson.exports['./desktop-bridge']).toEqual({+ '@inkeep/source': './src/desktop-bridge.ts',development: './src/desktop-bridge.ts',- types: './src/desktop-bridge.ts',+ types: './dist/desktop-bridge.d.mts',default: './dist/desktop-bridge.mjs',});diff --git a/packages/desktop/tests/unit/electron-builder-node-pty-deps.test.ts b/packages/desktop/tests/unit/electron-builder-node-pty-deps.test.tsindex 875b0cdf2..1d0370ab1 100644--- a/packages/desktop/tests/unit/electron-builder-node-pty-deps.test.ts+++ b/packages/desktop/tests/unit/electron-builder-node-pty-deps.test.ts@@ -123,31 +123,34 @@ describe('node-pty desktop packaging config', () => {test.each([['win32-x64', 0x8664],['win32-arm64', 0xaa64],- ])('%s ships PE conpty addons with the Microsoft ConPTY pair beside them', (platformArch, peMachine) => {- for (const name of [- 'conpty.node',- 'conpty_console_list.node',- 'conpty/conpty.dll',- 'conpty/OpenConsole.exe',- ]) {- const file = resolve(- desktopRoot,- 'node_modules',- 'node-pty',- 'prebuilds',- platformArch,- name,- );- expect(existsSync(file), `node-pty must ship ${platformArch}/${name}`).toBe(true);- const binary = readFileSync(file);- expect(binary.readUInt16LE(0), `${platformArch}/${name}: MZ magic`).toBe(0x5a4d);- const peOffset = binary.readUInt32LE(0x3c);- expect(binary.readUInt32LE(peOffset), `${platformArch}/${name}: PE signature`).toBe(0x4550);- expect(binary.readUInt16LE(peOffset + 4), `${platformArch}/${name}: PE machine word`).toBe(- peMachine,- );- }- });+ ])(+ '%s ships PE conpty addons with the Microsoft ConPTY pair beside them',+ (platformArch, peMachine) => {+ for (const name of [+ 'conpty.node',+ 'conpty_console_list.node',+ 'conpty/conpty.dll',+ 'conpty/OpenConsole.exe',+ ]) {+ const file = resolve(+ desktopRoot,+ 'node_modules',+ 'node-pty',+ 'prebuilds',+ platformArch,+ name,+ );+ expect(existsSync(file), `node-pty must ship ${platformArch}/${name}`).toBe(true);+ const binary = readFileSync(file);+ expect(binary.readUInt16LE(0), `${platformArch}/${name}: MZ magic`).toBe(0x5a4d);+ const peOffset = binary.readUInt32LE(0x3c);+ expect(binary.readUInt32LE(peOffset), `${platformArch}/${name}: PE signature`).toBe(0x4550);+ expect(binary.readUInt16LE(peOffset + 4), `${platformArch}/${name}: PE machine word`).toBe(+ peMachine,+ );+ }+ },+ );test('asarUnpack covers node-pty lib/ and package.json (conout worker runs off the real filesystem)', () => {const patterns = readBuilderConfig().asarUnpack ?? [];@@ -203,9 +206,9 @@ describe('node-pty desktop packaging config', () => {describe('node-pty electron-vite externalization', () => {test('node-pty is externalized in the main build despite optionalDependencies placement', async () => {const config = (await import('../../electron.vite.config.ts')).default as {- main?: { build?: { rollupOptions?: { external?: unknown } } };+ main?: { build?: { rolldownOptions?: { external?: unknown } } };};- const external = config.main?.build?.rollupOptions?.external;+ const external = config.main?.build?.rolldownOptions?.external;const externals = Array.isArray(external) ? external : [external];const pkg = readPkg();const autoExternalized = 'node-pty' in (pkg.dependencies ?? {});@@ -213,7 +216,7 @@ describe('node-pty electron-vite externalization', () => {autoExternalized || externals.includes('node-pty'),'node-pty must be externalized in the electron-vite main build. It lives in optionalDependencies, ' +"which externalizeDeps: true does NOT cover (it reads pkg.dependencies only) — add 'node-pty' to " +- 'main.build.rollupOptions.external in electron.vite.config.ts, or the bundled loader breaks every ' ++ 'main.build.rolldownOptions.external in electron.vite.config.ts, or the bundled loader breaks every ' +'packaged terminal spawn.',).toBe(true);});diff --git a/packages/desktop/tests/unit/preload-single-entry.test.ts b/packages/desktop/tests/unit/preload-single-entry.test.tsindex 6b9ebb024..410318d16 100644--- a/packages/desktop/tests/unit/preload-single-entry.test.ts+++ b/packages/desktop/tests/unit/preload-single-entry.test.ts@@ -7,14 +7,14 @@ import { describe, expect, test } from 'vitest';const desktopRoot = resolve(fileURLToPath(new URL('../../', import.meta.url)));interface PreloadBuild {- rollupOptions?: { input?: Record<string, string> };+ rolldownOptions?: { input?: Record<string, string> };}async function preloadInput(): Promise<Record<string, string>> {const config: { preload?: { build?: PreloadBuild } } = (await import('../../electron.vite.config')).default;- const input = config.preload?.build?.rollupOptions?.input;+ const input = config.preload?.build?.rolldownOptions?.input;if (input === undefined) throw new Error('preload build declares no entry input');return input;}diff --git a/packages/desktop/tests/unit/renderer-html-entries.test.ts b/packages/desktop/tests/unit/renderer-html-entries.test.tsindex 541ee1d43..c4d28cd43 100644--- a/packages/desktop/tests/unit/renderer-html-entries.test.ts+++ b/packages/desktop/tests/unit/renderer-html-entries.test.ts@@ -9,12 +9,11 @@ const appRoot = resolve(fileURLToPath(new URL('../../../app/', import.meta.url))type EntryInput = Record<string, string>;interface RendererBuild {- rollupOptions?: { input?: EntryInput };rolldownOptions?: { input?: EntryInput };}function entryInput(build: RendererBuild | undefined): EntryInput {- const input = build?.rolldownOptions?.input ?? build?.rollupOptions?.input;+ const input = build?.rolldownOptions?.input;if (input === undefined) throw new Error('renderer build declares no HTML entry input');return input;}diff --git a/packages/desktop/tests/unit/windows-package-native-guards.test.ts b/packages/desktop/tests/unit/windows-package-native-guards.test.tsindex f7541c69e..01f7e5571 100644--- a/packages/desktop/tests/unit/windows-package-native-guards.test.ts+++ b/packages/desktop/tests/unit/windows-package-native-guards.test.ts@@ -200,18 +200,19 @@ describe.skipIf(packageDir === null)('packaged Windows node-pty payload', () =>).toBeGreaterThan(0);});- test.each(- WIN32_ARCHES,- )('%s prebuild ships arch-correct PE addons with the ConPTY pair beside them', (arch) => {- const archDir = join(nodePtyUnpackedRoot, 'prebuilds', arch);- for (const name of CONPTY_FILES) {- const file = join(archDir, name);- expect(existsSync(file), `missing ${arch}/${name}`).toBe(true);- expect(peMachineType(readFileSync(file)), `${arch}/${name}: PE machine word`).toBe(- PE_MACHINE[arch],- );- }- });+ test.each(WIN32_ARCHES)(+ '%s prebuild ships arch-correct PE addons with the ConPTY pair beside them',+ (arch) => {+ const archDir = join(nodePtyUnpackedRoot, 'prebuilds', arch);+ for (const name of CONPTY_FILES) {+ const file = join(archDir, name);+ expect(existsSync(file), `missing ${arch}/${name}`).toBe(true);+ expect(peMachineType(readFileSync(file)), `${arch}/${name}: PE machine word`).toBe(+ PE_MACHINE[arch],+ );+ }+ },+ );test('unpacked tree carries no debug symbols, foreign prebuilds, or native-build output', () => {const offenders = walkFiles(nodePtyUnpackedRoot).filter(diff --git a/packages/desktop/tests/utility/pty-host.test.ts b/packages/desktop/tests/utility/pty-host.test.tsindex 3fb3f7dc0..064d42d3b 100644--- a/packages/desktop/tests/utility/pty-host.test.ts+++ b/packages/desktop/tests/utility/pty-host.test.ts@@ -977,34 +977,35 @@ describe('setupPtyHost — incoming message validation (asIncomingMessage guard)expect(logger.warnings.length).toBeGreaterThan(0);});- test.each([- ...TERMINAL_SHELL_NOTICE_REASONS,- ])('accepts a create carrying the shared reason %s and relays it verbatim', (reason) => {- const h = makeHarness({- platform: 'win32',- env: { SystemRoot: 'C:\\Windows' },- shellExists: () => false,- pathProbe: () => null,- listDirectory: () => [],- });+ test.each([...TERMINAL_SHELL_NOTICE_REASONS])(+ 'accepts a create carrying the shared reason %s and relays it verbatim',+ (reason) => {+ const h = makeHarness({+ platform: 'win32',+ env: { SystemRoot: 'C:\\Windows' },+ shellExists: () => false,+ pathProbe: () => null,+ listDirectory: () => [],+ });- h.fireRaw({- type: 'create',- ptyId: 'p1',- cwd: 'C:\\project',- cols: 80,- rows: 24,- shellInvalidReason: reason,- });+ h.fireRaw({+ type: 'create',+ ptyId: 'p1',+ cwd: 'C:\\project',+ cols: 80,+ rows: 24,+ shellInvalidReason: reason,+ });- expect(h.spawnCalls).toHaveLength(1);- expect(h.posted).toContainEqual({- type: 'shell-notice',- ptyId: 'p1',- notice: 'invalid-shell-override',- reason,- });- });+ expect(h.spawnCalls).toHaveLength(1);+ expect(h.posted).toContainEqual({+ type: 'shell-notice',+ ptyId: 'p1',+ notice: 'invalid-shell-override',+ reason,+ });+ },+ );test('drops a create whose shellInvalidReason is outside the shared reason set', () => {const logger = makeLogger();diff --git a/packages/server/assets/skills/project/references/doc-editing.md b/packages/server/assets/skills/project/references/doc-editing.mdindex 196e5df4d..8fac059df 100644--- a/packages/server/assets/skills/project/references/doc-editing.md+++ b/packages/server/assets/skills/project/references/doc-editing.md@@ -8,4 +8,4 @@**MDX.** To author an MDX doc (the KB renders MDX/JSX components), set `extension: ".mdx"` on the create: `write({ document: { path: "guides/widget", content, extension: ".mdx", position: "replace" } })` lands `guides/widget.mdx`. A `.mdx` suffix typed into `path` works too (the `extension` field wins if you pass both); omit both and it lands `.md`. An existing doc keeps its on-disk extension regardless — changing it in place isn't available via the MCP today.-**Advisory warnings on writes.** `write` and `edit` responses may include `structuredContent.document.warnings` (batch: per-doc `structuredContent.documents[].warnings`) — advisory entries discriminated by `kind`, each also summarized as a `⚠` line in the response text. The write always landed; the entries tell you what to do next. Write-integrity kinds mean re-read the doc (`exec("cat <path>")`) before continuing: `content-divergence` (`{ kind, intendedBytes, actualBytes, byteDelta, hint }` — the converged Y.Text doesn't match what the payload composed to: concurrent peer residue, or — rare — a primitive regression) and `disk-edit-reconciled` (an out-of-band disk edit was folded in before your write landed on top). The renderability kind `mermaid-parse-error` (`{ kind, fenceIndex, fenceFirstLine, message, line? }`) means that mermaid fence will not render — fix the fence and re-edit. (A deprecated single-valued `warning` field on the HTTP body mirrors the highest-precedence integrity entry for older consumers.) Distinct from the preview-attach `warning` field (`action: "attach-preview-once" | "start-ui"`), which stays at the top level — separate keys, can coexist.+**Advisory warnings on writes.** `write` and `edit` responses may include `structuredContent.document.warnings` (batch: per-doc `structuredContent.documents[].warnings`) — advisory entries discriminated by `kind`, each also summarized as a `⚠` line in the response text. The write always landed; the entries tell you what to do next. Write-integrity kinds mean re-read the doc (`exec("cat <path>")`) before continuing: `content-divergence` (`{ kind, intendedBytes, actualBytes, byteDelta, hint }` — the converged Y.Text doesn't match what the payload composed to: concurrent peer residue, or — rare — a primitive regression) and `disk-edit-reconciled` (an out-of-band disk edit was folded in before your write landed on top). The renderability kind `mermaid-parse-error` (`{ kind, fenceIndex, fenceFirstLine, message, line? }`) means that mermaid fence will not render — fix the fence and re-edit. The top-level `warning` field on write tools is unrelated: it is the preview-attach hint (`action: "attach-preview-once" | "start-ui"`), not an advisory — a separate key from `document.warnings`, and the two can coexist on one response.diff --git a/packages/server/package.json b/packages/server/package.jsonindex 8c0ac24df..6e970012d 100644--- a/packages/server/package.json+++ b/packages/server/package.json@@ -6,13 +6,15 @@"type": "module","exports": {".": {+ "@inkeep/source": "./src/index.ts","development": "./src/index.ts",- "types": "./src/index.ts",+ "types": "./dist/index.d.mts","default": "./dist/index.mjs"},"./parse-worker": {+ "@inkeep/source": "./src/parse-worker.ts","development": "./src/parse-worker.ts",- "types": "./src/parse-worker.ts",+ "types": "./dist/parse-worker.d.mts","default": "./dist/parse-worker.mjs"}},@@ -79,13 +81,14 @@},"devDependencies": {"@types/mdast": "^4.0.4",+ "@types/node": "^24.7.0","@types/shell-quote": "^1.7.5","@types/ws": "^8.18.1","@types/yauzl": "^2.10.3","@types/yazl": "^2.4.6","lib0": "^0.2.117","ts-morph": "^28.0.0",- "tsdown": "^0.21.7",- "typescript": "^5.9.3"+ "tsdown": "^0.22.14",+ "typescript": "~7.0.2"}}diff --git a/packages/server/src/acp/event-log-bounds.test.ts b/packages/server/src/acp/event-log-bounds.test.tsindex 05db87f49..3baa74066 100644--- a/packages/server/src/acp/event-log-bounds.test.ts+++ b/packages/server/src/acp/event-log-bounds.test.ts@@ -261,28 +261,29 @@ describe('coalesceChunkInto — Codex legacy warning boundaries', () => {expect(coalesceChunkInto(warning, neighbor('contextCompacted'), CODEX_CUSTOM)).toBe(true);});- test.each(- fixture.negatives.map((n) => [n.name, n] as const),- )('near miss %s folds as if the guard were not there', (_name, negative) => {- const agentKey = (negative as { agent?: string }).agent;- const declared =- agentKey === undefined- ? CODEX- : (fixture.agents as Record<string, CodexLegacyAgentIdentity>)[agentKey];-- const asDeclared = coalesceChunkInto(- nearMiss(negative),- neighbor('contextCompacted'),- declared,- );- const guardUnreachable = coalesceChunkInto(- nearMiss(negative),- neighbor('contextCompacted'),- OTHER_AGENT,- );-- expect(asDeclared).toBe(guardUnreachable);- });+ test.each(fixture.negatives.map((n) => [n.name, n] as const))(+ 'near miss %s folds as if the guard were not there',+ (_name, negative) => {+ const agentKey = (negative as { agent?: string }).agent;+ const declared =+ agentKey === undefined+ ? CODEX+ : (fixture.agents as Record<string, CodexLegacyAgentIdentity>)[agentKey];++ const asDeclared = coalesceChunkInto(+ nearMiss(negative),+ neighbor('contextCompacted'),+ declared,+ );+ const guardUnreachable = coalesceChunkInto(+ nearMiss(negative),+ neighbor('contextCompacted'),+ OTHER_AGENT,+ );++ expect(asDeclared).toBe(guardUnreachable);+ },+ );test('a warning is preserved even when the neighbour would otherwise fold', () => {const chrome = neighbor('turnError');diff --git a/packages/server/src/acp/launch.test.ts b/packages/server/src/acp/launch.test.tsindex 54c8c2541..101ba5ee5 100644--- a/packages/server/src/acp/launch.test.ts+++ b/packages/server/src/acp/launch.test.ts@@ -751,26 +751,25 @@ describe('spawnAcpAgent — cwd isolation for npx launches', () => {void dir;});- test.each([- 'uvx',- 'binary',- 'custom',- ] as const)('%s-kind spawns still run from the record cwd (agent contract)', async (kind) => {- const dir = tmp();- const script = makeEchoCwdScript(dir);- const launch: ResolvedLaunch = {- cmd: 'node',- args: [script],- env: plainEnv(),- kind,- pathFromOverlay: false,- };- const child = spawnAcpAgent(launch, dir);- if (child.pid !== undefined) strayPids.push(child.pid);- await waitFor(() => existsSync(`${script}.out`), 10_000, 'spawned agent to report its cwd');- const observed = readFileSync(`${script}.out`, 'utf8');- expect(observed.endsWith(dir) || dir.endsWith(observed)).toBe(true);- });+ test.each(['uvx', 'binary', 'custom'] as const)(+ '%s-kind spawns still run from the record cwd (agent contract)',+ async (kind) => {+ const dir = tmp();+ const script = makeEchoCwdScript(dir);+ const launch: ResolvedLaunch = {+ cmd: 'node',+ args: [script],+ env: plainEnv(),+ kind,+ pathFromOverlay: false,+ };+ const child = spawnAcpAgent(launch, dir);+ if (child.pid !== undefined) strayPids.push(child.pid);+ await waitFor(() => existsSync(`${script}.out`), 10_000, 'spawned agent to report its cwd');+ const observed = readFileSync(`${script}.out`, 'utf8');+ expect(observed.endsWith(dir) || dir.endsWith(observed)).toBe(true);+ },+ );});describe('preflightLaunch', () => {diff --git a/packages/server/src/api-asset.test.ts b/packages/server/src/api-asset.test.tsindex ad9fd97d0..134549200 100644--- a/packages/server/src/api-asset.test.ts+++ b/packages/server/src/api-asset.test.ts@@ -138,20 +138,20 @@ describe('GET /api/asset', () => {expect(res.status).toBe(415);});- test.each([- 'docs/page.html',- 'docs/legacy.htm',- ])('serves %s inside a sandboxed opaque origin (scripts run, network blocked, isolated from OK)', async (assetPath) => {- const res = await fetch(assetUrl(harness.baseURL, assetPath));-- expect(res.status).toBe(200);- expect(res.headers.get('content-type')).toMatch(/^text\/html/);- expect(res.headers.get('content-disposition')).toBe('inline');- expect(res.headers.get('content-security-policy')).toBe(- "sandbox allow-scripts; connect-src 'none'",- );- expect(res.headers.get('x-content-type-options')).toBe('nosniff');- });+ test.each(['docs/page.html', 'docs/legacy.htm'])(+ 'serves %s inside a sandboxed opaque origin (scripts run, network blocked, isolated from OK)',+ async (assetPath) => {+ const res = await fetch(assetUrl(harness.baseURL, assetPath));++ expect(res.status).toBe(200);+ expect(res.headers.get('content-type')).toMatch(/^text\/html/);+ expect(res.headers.get('content-disposition')).toBe('inline');+ expect(res.headers.get('content-security-policy')).toBe(+ "sandbox allow-scripts; connect-src 'none'",+ );+ expect(res.headers.get('x-content-type-options')).toBe('nosniff');+ },+ );test('rejects traversal and symlink escapes', async () => {expect((await fetch(assetUrl(harness.baseURL, '../outside.png'))).status).toBe(400);diff --git a/packages/server/src/api-extension.ts b/packages/server/src/api-extension.tsindex 0a74ccbbe..d23dc7e1f 100644--- a/packages/server/src/api-extension.ts+++ b/packages/server/src/api-extension.ts@@ -85,6 +85,7 @@ import {prependFrontmatter,projectSkillContentDocName,RENAMED_PACK_SKILLS,+ type ReLintFailure,RollbackRequestSchema,RollbackSuccessSchema,readFmMap,@@ -3541,9 +3542,7 @@ export function createApiExtension({timestamp,...(summaryResponse ? { summary: summaryResponse } : {}),- ...(agentWriteWarning- ? { warning: agentWriteWarning, warnings: [agentWriteWarning] }- : {}),+ ...(agentWriteWarning ? { warnings: [agentWriteWarning] } : {}),},{ handler: 'agent-write' },);@@ -3782,11 +3781,6 @@ export function createApiExtension(systemSubscriberCount,...(hints ? { hints } : {}),...(summaryResponse ? { summary: summaryResponse } : {}),- ...(writeMdDivergenceEntry- ? { warning: writeMdDivergenceEntry }- : writeMdWarning- ? { warning: writeMdWarning }- : {}),...(writeMdAdvisories.length > 0 ? { warnings: writeMdAdvisories } : {}),brokenLinks,},@@ -4376,7 +4370,7 @@ export function createApiExtension(systemSubscriberCount,appliedKeys,...(summaryResponse ? { summary: summaryResponse } : {}),- ...(fmWarning ? { warning: fmWarning, warnings: [fmWarning] } : {}),+ ...(fmWarning ? { warnings: [fmWarning] } : {}),brokenLinks,},{ handler: 'frontmatter-patch' },@@ -4700,11 +4694,6 @@ export function createApiExtension(subscriberCount,systemSubscriberCount,...(summaryResponse ? { summary: summaryResponse } : {}),- ...(patchDivergenceEntry- ? { warning: patchDivergenceEntry }- : patchWarning- ? { warning: patchWarning }- : {}),...(patchAdvisories.length > 0 ? { warnings: patchAdvisories } : {}),brokenLinks,},@@ -5468,9 +5457,7 @@ export function createApiExtension(restoredFrom: commitSha,timestamp,...(summaryResponse ? { summary: summaryResponse } : {}),- ...(rollbackDivergenceEntry- ? { warning: rollbackDivergenceEntry, warnings: [rollbackDivergenceEntry] }- : {}),+ ...(rollbackDivergenceEntry ? { warnings: [rollbackDivergenceEntry] } : {}),},{ handler: 'rollback' },);@@ -10805,7 +10792,7 @@ export function createApiExtension(});let after = before;- let reLintWarning: string | undefined;+ let reLintFailure: ReLintFailure | undefined;const reLintFailures: LintPluginFailure[] = [];if (fixed !== source) {try {@@ -10872,22 +10859,55 @@ export function createApiExtension((failure) => reLintFailures.push(failure),);} catch (relintErr) {- reLintWarning = `Re-lint after fix failed: ${relintErr instanceof Error ? relintErr.message : String(relintErr)}`;+ const relintMessage =+ relintErr instanceof Error ? relintErr.message : String(relintErr);+ reLintFailure = {+ reason: 're-lint-threw',+ message:+ relintMessage.trim().length > 0+ ? relintMessage+ : `${relintErr instanceof Error ? relintErr.name : 'non-Error value'} thrown with no message`,+ };log.warn(- { err: relintErr, handler: 'lint-fix' },+ { err: relintErr, handler: 'lint-fix', doc: resolvedDocName, agentId },'post-write re-lint failed; reporting pre-fix diagnostics',);after = before;}}+ const blindBeforeFix = new Set(+ failures.filter((f) => f.phase === 'lint').map((f) => f.source),+ );+ const blindOnlyAfterFix = [+ ...new Set(+ reLintFailures+ .filter((f) => f.phase === 'lint' && !blindBeforeFix.has(f.source))+ .map((f) => f.source),+ ),+ ];+ if (reLintFailure === undefined && blindOnlyAfterFix.length > 0) {+ reLintFailure = {+ reason: 'source-went-blind',+ message: `${blindOnlyAfterFix.join(', ')} linted the pre-fix text and failed on the post-fix text, so the re-lint is short their diagnostics and cannot be compared against the pre-fix run`,+ };+ log.warn(+ { handler: 'lint-fix', doc: resolvedDocName, agentId, sources: blindOnlyAfterFix },+ 'post-write re-lint lost a source that linted before the fix; reporting pre-fix diagnostics',+ );+ after = before;+ }+const errorCount = after.filter((d) => d.severity === 'error').length;const warningCount = after.length - errorCount;- const fixedCount = Math.max(0, before.length - after.length);+ const comparable = (d: (typeof before)[number]) => !blindBeforeFix.has(d.source);+ const fixedCount = Math.max(+ 0,+ before.filter(comparable).length - after.filter(comparable).length,+ );const responseWarnings = [...configWarnings,...summarizeLintPluginFailures([...failures, ...reLintFailures]),- ...(reLintWarning ? [reLintWarning] : []),];successResponse(@@ -10902,7 +10922,7 @@ export function createApiExtension(warningCount,ran,...(responseWarnings.length > 0 ? { warnings: responseWarnings } : {}),- ...(reLintWarning ? { warning: reLintWarning } : {}),+ ...(reLintFailure ? { diagnosticsArePreFix: true, reLintFailure } : {}),},{ handler: 'lint-fix' },);diff --git a/packages/server/src/api-request-id.test.ts b/packages/server/src/api-request-id.test.tsindex 1a3aba5c2..78725e66e 100644--- a/packages/server/src/api-request-id.test.ts+++ b/packages/server/src/api-request-id.test.ts@@ -164,7 +164,7 @@ describe('onRequest request identity + access log', () => {(c) => (c[0] as { event?: string })?.event === 'api.access',);expect(accessCalls).toHaveLength(1);- expect((accessCalls[0]?.[0] as { route: string }).route).toBe('/api/*');+ expect((accessCalls[0]?.[0] as { route: string } | undefined)?.route).toBe('/api/*');});test('non-API requests get no x-request-id echo and no access line', async () => {diff --git a/packages/server/src/backlink-index.ts b/packages/server/src/backlink-index.tsindex 4c1c9d2fe..ac953105b 100644--- a/packages/server/src/backlink-index.ts+++ b/packages/server/src/backlink-index.ts@@ -955,7 +955,7 @@ export function computeBrokenOutboundLinks(const recordWikiLink = (target: string, anchor: string | null): void => {const resolved = resolveWikiLinkTarget(target, anchor, wikiLookup);- if (!resolved || resolved.kind !== 'doc') return;+ if (resolved?.kind !== 'doc') return;if (resolveWikiLinkTargetDocName(resolved.docName, wikiLookup) === undefined &&folderExists?.(resolved.docName) !== truediff --git a/packages/server/src/bash/parse-command.test.ts b/packages/server/src/bash/parse-command.test.tsindex 076d93f1e..c590a5dd5 100644--- a/packages/server/src/bash/parse-command.test.ts+++ b/packages/server/src/bash/parse-command.test.ts@@ -82,28 +82,15 @@ describe('parseCommand — write_blocked (redirection and write flags)', () => {test('`>>` append', () => expectError('cat a >> b', 'write_blocked'));test('`<` input redirection', () => expectError('cat < file', 'shell_construct_blocked'));- test.each([- '||',- '&&',- ';;',- '|&',- '<(',- '<<<',- '>>',- '>&',- '<&',- '&',- ';',- '(',- ')',- '<',- '>',- ])('%s is classified, not left to the generic operator message', (op) => {- const result = parseCommand(`cat a.md ${op} b.md`);- expect('error' in result).toBe(true);- if (!('error' in result)) return;- expect(result.error.message).not.toMatch(/^Operator /);- });+ test.each(['||', '&&', ';;', '|&', '<(', '<<<', '>>', '>&', '<&', '&', ';', '(', ')', '<', '>'])(+ '%s is classified, not left to the generic operator message',+ (op) => {+ const result = parseCommand(`cat a.md ${op} b.md`);+ expect('error' in result).toBe(true);+ if (!('error' in result)) return;+ expect(result.error.message).not.toMatch(/^Operator /);+ },+ );test('find -exec rejected (via ; op token)', () =>expectError('find . -exec rm {} ;', 'shell_construct_blocked'));test('find -execdir rejected (via ; op token)', () =>@@ -412,13 +399,10 @@ describe('glob operands', () => {});describe('find flags that run another command', () => {- test.each([- '-exec',- '-execdir',- '-ok',- '-okdir',- ])('find %s is refused by the parser, since it runs a command the allowlist never sees', (flag) =>- expectError(`find . ${flag} rm {} +`, 'shell_construct_blocked'));+ test.each(['-exec', '-execdir', '-ok', '-okdir'])(+ 'find %s is refused by the parser, since it runs a command the allowlist never sees',+ (flag) => expectError(`find . ${flag} rm {} +`, 'shell_construct_blocked'),+ );});describe('a flag value is not a positional', () => {diff --git a/packages/server/src/bash/read-only-contract.test.ts b/packages/server/src/bash/read-only-contract.test.tsindex 73d5367d8..96748f7a1 100644--- a/packages/server/src/bash/read-only-contract.test.ts+++ b/packages/server/src/bash/read-only-contract.test.ts@@ -132,27 +132,29 @@ describe('exec is read-only — no allowlisted command may alter the tree', () =expect(snapshot(root)).toEqual(before);});- test.each(- ENGINE_DOES_NOT_IMPLEMENT,- )('%s dies on an option just-bash does not implement, which is not the mount', async (command) => {- const root = build();- const before = snapshot(root);- const result = await attempt(root, command);- expect(result.disposition).toBe('engine-rejected');- expect(result.stderr).toMatch(- /invalid option|unrecognized option|unknown predicate|No such file/,- );- expect(snapshot(root)).toEqual(before);- });-- test.each(- INERT_UNDER_THIS_ENGINE,- )('%s runs to completion because this engine never writes for it', async (command) => {- const root = build();- const before = snapshot(root);- expect(await attempt(root, command)).toEqual({ disposition: 'ran' });- expect(snapshot(root)).toEqual(before);- });+ test.each(ENGINE_DOES_NOT_IMPLEMENT)(+ '%s dies on an option just-bash does not implement, which is not the mount',+ async (command) => {+ const root = build();+ const before = snapshot(root);+ const result = await attempt(root, command);+ expect(result.disposition).toBe('engine-rejected');+ expect(result.stderr).toMatch(+ /invalid option|unrecognized option|unknown predicate|No such file/,+ );+ expect(snapshot(root)).toEqual(before);+ },+ );++ test.each(INERT_UNDER_THIS_ENGINE)(+ '%s runs to completion because this engine never writes for it',+ async (command) => {+ const root = build();+ const before = snapshot(root);+ expect(await attempt(root, command)).toEqual({ disposition: 'ran' });+ expect(snapshot(root)).toEqual(before);+ },+ );test('expansion can hand sort a genuine -o, and the filesystem refuses it', async () => {const root = build();diff --git a/packages/server/src/content/generate-index-conformance.test.ts b/packages/server/src/content/generate-index-conformance.test.tsindex 0fb5afc7c..01efd4a66 100644--- a/packages/server/src/content/generate-index-conformance.test.ts+++ b/packages/server/src/content/generate-index-conformance.test.ts@@ -247,27 +247,26 @@ describe('generated index — heading-identity agreement with MD024', () => {expect(mdOnly(await findingCodes(markdown, 'index.md')), `emitted:\n${markdown}`).toEqual([]);});- test.each([- [['#', '##']],- [['#', '<b></b>']],- [['<b></b>', '<i></i>']],- ])('types whose rendered heading text is empty merge with each other: %j', async (pair) => {- const markdown = buildIndexMarkdown(- [- { path: 'a.md', title: 'A', description: undefined, type: pair[0] },- { path: 'b.md', title: 'B', description: undefined, type: pair[1] },- ],- { isRoot: false, directory: '' },- );-- expect(mdOnly(await findingCodes(markdown, 'index.md')), `emitted:\n${markdown}`).toEqual([]);- expect(markdown).toContain('](./a.md)');- expect(markdown).toContain('](./b.md)');-- const sections = (markdown.match(/^## .+$/gm) ?? []).map((line) => line.slice(3));- expect(sections, `emitted:\n${markdown}`).toHaveLength(1);- expect(pair, `emitted:\n${markdown}`).toContain(sections[0]);- });+ test.each([[['#', '##']], [['#', '<b></b>']], [['<b></b>', '<i></i>']]])(+ 'types whose rendered heading text is empty merge with each other: %j',+ async (pair) => {+ const markdown = buildIndexMarkdown(+ [+ { path: 'a.md', title: 'A', description: undefined, type: pair[0] },+ { path: 'b.md', title: 'B', description: undefined, type: pair[1] },+ ],+ { isRoot: false, directory: '' },+ );++ expect(mdOnly(await findingCodes(markdown, 'index.md')), `emitted:\n${markdown}`).toEqual([]);+ expect(markdown).toContain('](./a.md)');+ expect(markdown).toContain('](./b.md)');++ const sections = (markdown.match(/^## .+$/gm) ?? []).map((line) => line.slice(3));+ expect(sections, `emitted:\n${markdown}`).toHaveLength(1);+ expect(pair, `emitted:\n${markdown}`).toContain(sections[0]);+ },+ );test('two derived sections reducing to the same content merge with each other', async () => {const markdown = buildIndexMarkdown(diff --git a/packages/server/src/content/generate-index.test.ts b/packages/server/src/content/generate-index.test.tsindex 1e5b1e9f7..f76053052 100644--- a/packages/server/src/content/generate-index.test.ts+++ b/packages/server/src/content/generate-index.test.ts@@ -189,28 +189,29 @@ describe('buildIndexMarkdown', () => {}});- test.each([- ...GENERATOR_OWNED_HEADINGS,- ])('a colliding type cannot rename the generator-owned heading %j, reached from the entry loop alone', (owned) => {- for (const order of [- [- entry({ path: 'a.md', title: 'Alpha', type: owned }),- entry({ path: 'b.md', title: 'Beta', type: `<b></b>${owned}` }),- ],- [- entry({ path: 'b.md', title: 'Beta', type: `<b></b>${owned}` }),- entry({ path: 'a.md', title: 'Alpha', type: owned }),- ],- ]) {- const label = `${owned} order=${order.map((e) => e.type).join(',')}`;- const out = buildIndexMarkdown(order, { isRoot: false });+ test.each([...GENERATOR_OWNED_HEADINGS])(+ 'a colliding type cannot rename the generator-owned heading %j, reached from the entry loop alone',+ (owned) => {+ for (const order of [+ [+ entry({ path: 'a.md', title: 'Alpha', type: owned }),+ entry({ path: 'b.md', title: 'Beta', type: `<b></b>${owned}` }),+ ],+ [+ entry({ path: 'b.md', title: 'Beta', type: `<b></b>${owned}` }),+ entry({ path: 'a.md', title: 'Alpha', type: owned }),+ ],+ ]) {+ const label = `${owned} order=${order.map((e) => e.type).join(',')}`;+ const out = buildIndexMarkdown(order, { isRoot: false });- expect(headingContents(out), label).toContain(owned);- expect(out, label).not.toContain('<b>');- expect(out, label).toContain('](./a.md)');- expect(out, label).toContain('](./b.md)');- }- });+ expect(headingContents(out), label).toContain(owned);+ expect(out, label).not.toContain('<b>');+ expect(out, label).toContain('](./a.md)');+ expect(out, label).toContain('](./b.md)');+ }+ },+ );test('a document sharing the title heading renders under it, byte for byte', () => {const out = buildIndexMarkdown(diff --git a/packages/server/src/embeddings/embedder.ts b/packages/server/src/embeddings/embedder.tsindex 3ce56ced5..c2af120af 100644--- a/packages/server/src/embeddings/embedder.ts+++ b/packages/server/src/embeddings/embedder.ts@@ -36,24 +36,29 @@ export interface EmbeddingsKeyStore {}export class EmbeddingProviderError extends Error {+ readonly reason: EmbeddingErrorReason;+ readonly status?: number;constructor(- readonly reason: EmbeddingErrorReason,+ reason: EmbeddingErrorReason,message: string,- readonly status?: number,+ status?: number,options?: { cause?: unknown },) {super(message, options);+ this.reason = reason;+ this.status = status;this.name = 'EmbeddingProviderError';}}export class EmbeddingDimsMismatchError extends EmbeddingProviderError {readonly name = 'EmbeddingDimsMismatchError';- constructor(- readonly expected: number,- readonly got: number,- ) {+ readonly expected: number;+ readonly got: number;+ constructor(expected: number, got: number) {super('dims_mismatch', `embeddings provider returned ${got}-dim vectors, expected ${expected}`);+ this.expected = expected;+ this.got = got;}}diff --git a/packages/server/src/embeddings/semantic-search-service.ts b/packages/server/src/embeddings/semantic-search-service.tsindex abc0da4de..ef044188d 100644--- a/packages/server/src/embeddings/semantic-search-service.ts+++ b/packages/server/src/embeddings/semantic-search-service.ts@@ -25,8 +25,10 @@ export const MAX_DIMS_DRIFT_RESETS = 2;class DimsMismatchSignal extends Error {readonly name = 'DimsMismatchSignal';- constructor(readonly cause: EmbeddingDimsMismatchError) {+ override readonly cause: EmbeddingDimsMismatchError;+ constructor(cause: EmbeddingDimsMismatchError) {super(cause.message);+ this.cause = cause;}}diff --git a/packages/server/src/github-permissions.test.ts b/packages/server/src/github-permissions.test.tsindex cfe821c0a..ec9c96504 100644--- a/packages/server/src/github-permissions.test.ts+++ b/packages/server/src/github-permissions.test.ts@@ -701,7 +701,7 @@ describe('checkPushPermission — telemetry', () => {const hist = dataPoints(harness, 'ok.permissions.probe.duration_ms');expect(hist).toHaveLength(1);- expect((hist[0]?.value as HistogramData).count).toBe(1);+ expect((hist[0]?.value as HistogramData | undefined)?.count).toBe(1);});test('denied probe records its reason; error_class stays none', async () => {diff --git a/packages/server/src/in-place-skills.test.ts b/packages/server/src/in-place-skills.test.tsindex 7c5a3d36d..8ff5e1106 100644--- a/packages/server/src/in-place-skills.test.ts+++ b/packages/server/src/in-place-skills.test.ts@@ -33,14 +33,14 @@ describe('resolveDefaultSkillHomeRel', () => {rmSync(base, { recursive: true, force: true });});- test.each([- 'project',- 'global',- ] as const)('returns no %s home and creates nothing when no host root exists', (scope) => {- expect(resolveDefaultSkillHomeRel(base, scope)).toBeNull();- expect(existsSync(join(base, '.claude'))).toBe(false);- expect(existsSync(join(base, '.agents'))).toBe(false);- });+ test.each(['project', 'global'] as const)(+ 'returns no %s home and creates nothing when no host root exists',+ (scope) => {+ expect(resolveDefaultSkillHomeRel(base, scope)).toBeNull();+ expect(existsSync(join(base, '.claude'))).toBe(false);+ expect(existsSync(join(base, '.agents'))).toBe(false);+ },+ );test('keeps existing hub and concrete roots selectable by precedence', () => {mkdirSync(join(base, '.codex'), { recursive: true });diff --git a/packages/server/src/link-preview/guarded-fetch.test.ts b/packages/server/src/link-preview/guarded-fetch.test.tsindex b4d871394..d5e28a42d 100644--- a/packages/server/src/link-preview/guarded-fetch.test.ts+++ b/packages/server/src/link-preview/guarded-fetch.test.ts@@ -105,15 +105,16 @@ describe('createHeadEndScanner (chunk-boundary-safe head-end detection)', () =>expect(scan(bytes(html))).toBe(html.indexOf('</head>') + '</head>'.length);});- test.each([- 1, 2, 3, 4, 5, 6,- ])('finds </head> split across a chunk boundary after %i marker byte(s)', (splitAt) => {- const scan = createHeadEndScanner();- const marker = '</head>';- expect(scan(bytes(`<html><head><title>t</title>${marker.slice(0, splitAt)}`))).toBe(-1);- const rest = `${marker.slice(splitAt)}<body>tail`;- expect(scan(bytes(rest))).toBe(marker.length - splitAt);- });+ test.each([1, 2, 3, 4, 5, 6])(+ 'finds </head> split across a chunk boundary after %i marker byte(s)',+ (splitAt) => {+ const scan = createHeadEndScanner();+ const marker = '</head>';+ expect(scan(bytes(`<html><head><title>t</title>${marker.slice(0, splitAt)}`))).toBe(-1);+ const rest = `${marker.slice(splitAt)}<body>tail`;+ expect(scan(bytes(rest))).toBe(marker.length - splitAt);+ },+ );test('finds an opening <body> when no </head> precedes it', () => {const scan = createHeadEndScanner();diff --git a/packages/server/src/maintenance-coordinator.ts b/packages/server/src/maintenance-coordinator.tsindex 50cbe0ad3..b6b375a35 100644--- a/packages/server/src/maintenance-coordinator.ts+++ b/packages/server/src/maintenance-coordinator.ts@@ -89,7 +89,11 @@ export class MaintenanceCoordinator {private lastConsolidationAt = 0;private lastGcLatch = false;- constructor(private readonly deps: MaintenanceCoordinatorDeps) {}+ private readonly deps: MaintenanceCoordinatorDeps;++ constructor(deps: MaintenanceCoordinatorDeps) {+ this.deps = deps;+ }get isRunning(): boolean {return this.running;diff --git a/packages/server/src/map-driven-observer-a.test.ts b/packages/server/src/map-driven-observer-a.test.tsindex 52764f05e..9ac1445ea 100644--- a/packages/server/src/map-driven-observer-a.test.ts+++ b/packages/server/src/map-driven-observer-a.test.ts@@ -385,7 +385,7 @@ describe('map-driven Observer A — default Path A behavior', () => {String(args[1]).includes('Map-driven splice'),);expect(spliceWarns).toHaveLength(1);- expect((spliceWarns[0]?.[0] as { err?: Error }).err?.message).toBe(+ expect((spliceWarns[0]?.[0] as { err?: Error } | undefined)?.err?.message).toBe('synthetic parser regression',);@@ -440,7 +440,8 @@ describe('map-driven Observer A — default Path A behavior', () => {String(args[1]).includes('Spliced-body memo composition threw'),);expect(memoWarns).toHaveLength(1);- expect((memoWarns[0]?.[0] as { err?: Error }).err?.name).toBe('DataCloneError');+ const memoWarn = memoWarns[0]?.[0] as { err?: Error } | undefined;+ expect(memoWarn?.err?.name).toBe('DataCloneError');warnSpy.mockRestore();cleanup();diff --git a/packages/server/src/mcp/tools/advisory-warnings.test.ts b/packages/server/src/mcp/tools/advisory-warnings.test.tsindex b31f35ba1..22849101d 100644--- a/packages/server/src/mcp/tools/advisory-warnings.test.ts+++ b/packages/server/src/mcp/tools/advisory-warnings.test.ts@@ -1,9 +1,10 @@-import type {- AdvisoryWarning,- BrokenLink,- LintViolationWarning,- RenderWarning,- WriteWarning,+import {+ type AdvisoryWarning,+ type BrokenLink,+ type LintViolationWarning,+ type RenderWarning,+ WRITE_WARNING_KINDS,+ type WriteWarning,} from '@inkeep/open-knowledge-core';import { describe, expect, test } from 'vitest';import {@@ -336,3 +337,24 @@ describe('unrecognized-kind fallback', () => {expect(lines.some((l) => l.includes('future-advisory-kind'))).toBe(true);});});++describe('the write-warning kind set is the one source both filters read', () => {+ const fabricated = {+ kind: 'byte-ledger-drift',+ hint: 'from a newer server',+ } as unknown as AdvisoryWarning;++ test('a third write-shaped kind lands in the unrecognized channel, never in the integrity one', () => {+ const lines = formatAdvisoryLines([DIVERGENCE, fabricated]);++ expect(lines).toHaveLength(2);+ expect(lines[0]).toContain('Content divergence');+ expect(lines[1]).toContain('byte-ledger-drift');+ expect(lines[1]).toContain('see structuredContent.document.warnings');+ expect(lines.some((l) => l.includes('from a newer server'))).toBe(false);+ });++ test('every kind in WRITE_WARNING_KINDS formats through the integrity channel', () => {+ expect([...WRITE_WARNING_KINDS].sort()).toEqual(['content-divergence', 'disk-edit-reconciled']);+ });+});diff --git a/packages/server/src/mcp/tools/advisory-warnings.ts b/packages/server/src/mcp/tools/advisory-warnings.tsindex d8d12a9a4..3f33351da 100644--- a/packages/server/src/mcp/tools/advisory-warnings.ts+++ b/packages/server/src/mcp/tools/advisory-warnings.ts@@ -1,10 +1,13 @@import {type AdvisoryWarning,AdvisoryWarningSchema,+ assertNeverWriteWarning,type BrokenLink,BrokenLinkSchema,+ isWriteWarningKind,type LintViolationWarning,type RenderWarning,+ WRITE_WARNING_KINDS,type WriteWarning,} from '@inkeep/open-knowledge-core';@@ -50,9 +53,7 @@ function formatBrokenLink(link: BrokenLink): string {}function integrityEntries(warnings: AdvisoryWarning[]): WriteWarning[] {- return warnings.filter(- (w): w is WriteWarning => w.kind === 'content-divergence' || w.kind === 'disk-edit-reconciled',- );+ return warnings.filter((w): w is WriteWarning => isWriteWarningKind(w.kind));}function renderEntries(warnings: AdvisoryWarning[]): RenderWarning[] {@@ -63,9 +64,8 @@ function lintEntries(warnings: AdvisoryWarning[]): LintViolationWarning[] {return warnings.filter((w): w is LintViolationWarning => w.kind === 'lint-violation');}-const RELAYED_KINDS: ReadonlySet<string> = new Set([- 'content-divergence',- 'disk-edit-reconciled',+const RELAYED_KINDS: ReadonlySet<string> = new Set<string>([+ ...WRITE_WARNING_KINDS,'mermaid-parse-error','lint-violation',]);@@ -110,15 +110,25 @@ export function formatAdvisoryBriefs(warnings: AdvisoryWarning[]): string[] {}function formatIntegrityLine(d: WriteWarning): string {- return d.kind === 'content-divergence'- ? `⚠ Content divergence: ${d.actualBytes} actual bytes vs ${d.intendedBytes} intended (byteDelta=${d.byteDelta}). ${d.hint ?? 'currentState carries the converged content (re-read only if it is truncated).'}`- : `⚠ ${d.hint ?? 'An out-of-band edit was reconciled into this document before your edit landed on top — re-read for the combined result.'}`;+ switch (d.kind) {+ case 'content-divergence':+ return `⚠ Content divergence: ${d.actualBytes} actual bytes vs ${d.intendedBytes} intended (byteDelta=${d.byteDelta}). ${d.hint ?? 'currentState carries the converged content (re-read only if it is truncated).'}`;+ case 'disk-edit-reconciled':+ return `⚠ ${d.hint ?? 'An out-of-band edit was reconciled into this document before your edit landed on top — re-read for the combined result.'}`;+ default:+ return assertNeverWriteWarning(d);+ }}function formatIntegrityBrief(d: WriteWarning): string {- return d.kind === 'content-divergence'- ? `⚠ Content divergence: ${d.actualBytes} actual vs ${d.intendedBytes} intended (byteDelta=${d.byteDelta}).`- : '⚠ Out-of-band disk edit reconciled before this write — re-read for the combined result.';+ switch (d.kind) {+ case 'content-divergence':+ return `⚠ Content divergence: ${d.actualBytes} actual vs ${d.intendedBytes} intended (byteDelta=${d.byteDelta}).`;+ case 'disk-edit-reconciled':+ return '⚠ Out-of-band disk edit reconciled before this write — re-read for the combined result.';+ default:+ return assertNeverWriteWarning(d);+ }}export function formatRenderWarningsLine(warnings: RenderWarning[]): string {diff --git a/packages/server/src/mcp/tools/lint.ts b/packages/server/src/mcp/tools/lint.tsindex 80de3ca38..0c3bcacb5 100644--- a/packages/server/src/mcp/tools/lint.ts+++ b/packages/server/src/mcp/tools/lint.ts@@ -1,4 +1,12 @@-import { validationCoverageLines } from '@inkeep/open-knowledge-core';+import {+ isReLintFailedWarning,+ isReLintFailureReason,+ type LintFixResult,+ RE_LINT_FAILED_WARNING_PREFIX,+ type ReLintFailure,+ ReLintFailureSchema,+ validationCoverageLines,+} from '@inkeep/open-knowledge-core';import { z } from 'zod';import type { AgentIdentity } from '../agent-identity.ts';import type { ConfigOrResolver, ServerInstance, ServerUrlOrResolver } from './shared.ts';@@ -36,7 +44,10 @@ export const DESCRIPTION = [].join('\n');export const LINT_WARNINGS_DESCRIPTION =- 'Anything that made this run less than a full answer: unreadable files/dirs (audit), lint-config problems such as a broken frontmatter schema file, and selected lint plugins that threw. A source family named here is still listed in `ran` — it was selected, it just could not finish.';+ 'Anything that made this run less than a full answer: unreadable files/dirs (audit), lint-config problems such as a broken frontmatter schema file, and selected lint plugins that threw. A source family named here is still listed in `ran`: it was selected, it just could not finish. In fix mode this array carries the plugin failures from BOTH lint passes, so a post-write re-lint failure can appear here as the failing plugin, but never as the `Re-lint after fix failed: ` entry an older server sends, which is filtered out. The prose explanation is in `reLintFailure.message`, its machine-readable discriminant in `reLintFailure.reason`, and `diagnosticsArePreFix` is the flag to branch on.';++const DIAGNOSTICS_ARE_PRE_FIX_DESCRIPTION =+ 'Fix mode only. Present and true when the server flags pre-fix diagnostics, supplies `reLintFailure`, or reports a legacy re-lint-failure warning; absent when none of those signals is present. The reported `files[].diagnostics` and their `errorCount`/`warningCount` describe the pre-fix set and may overstate what remains. Treat the fix as applied and re-run `lint` to confirm. A non-empty explanation, when available, is in `reLintFailure.message`, and `reLintFailure.reason` says which of the two failure shapes it was.';function singleDocFixHint(fixableCount: number, total: number): string {if (fixableCount === 0) {@@ -77,14 +88,9 @@ interface LintDocPayload {ran?: string[];}-interface LintFixPayload {- file?: string;- fixedCount?: number;+type LintFixPayload = Omit<Partial<LintFixResult>, 'diagnostics'> & {diagnostics?: LintDiagnosticPayload[];- warning?: string;- warnings?: string[];- ran?: string[];-}+};interface LintAuditPayload {files?: LintDocPayload[];@@ -136,11 +142,25 @@ export function register(server: ServerInstance, deps: LintDeps): void {outputSchema: outputSchemaWithText({files: looseObjectArray.optional()- .describe('Per-file diagnostics. For a single-doc lint, the one file (even if clean).'),+ .describe(+ 'Per-file diagnostics. For a single-doc lint, the one file (even if clean). Pre-fix, and so possibly an overstatement, when `diagnosticsArePreFix` is true.',+ ),fileCount: z.number().optional().describe('Audit only: total in-scope documents scanned.'),- errorCount: z.number().describe('Total error-severity violations.'),- warningCount: z.number().describe('Total warning-severity violations.'),+ errorCount: z+ .number()+ .describe(+ 'Total error-severity violations. Pre-fix, and so possibly an overstatement, when `diagnosticsArePreFix` is true.',+ ),+ warningCount: z+ .number()+ .describe(+ 'Total warning-severity violations. Pre-fix, and so possibly an overstatement, when `diagnosticsArePreFix` is true.',+ ),warnings: z.array(z.string()).optional().describe(LINT_WARNINGS_DESCRIPTION),+ diagnosticsArePreFix: z.boolean().optional().describe(DIAGNOSTICS_ARE_PRE_FIX_DESCRIPTION),+ reLintFailure: ReLintFailureSchema.optional().describe(+ 'Fix mode only: why the post-write re-lint could not report. `reason` is the machine-readable discriminant — `re-lint-threw` when the re-lint pass itself threw, `source-went-blind` when a lint source that read the pre-fix text failed on the post-fix text — and `message` is the trimmed, non-empty prose, normalized from the server’s typed failure or a legacy prefixed warning. When present, `diagnosticsArePreFix` is true; that flag can also be present without a failure.',+ ),ran: z.array(z.string()).optional()@@ -158,7 +178,9 @@ export function register(server: ServerInstance, deps: LintDeps): void {fixedCount: z.number().optional()- .describe('Fix mode only: problems resolved by the auto-fix.'),+ .describe(+ 'Fix mode only: the server-reported number of problems resolved by auto-fix, or 0 if omitted. When `diagnosticsArePreFix` is true, the post-fix result is unavailable; do not treat 0 as evidence that nothing was fixed.',+ ),cwd: z.string().describe('Absolute directory the lint ran against.'),}),annotations: {@@ -215,32 +237,60 @@ async function fixLintDoc(const fixedCount = data.fixedCount ?? 0;const errorCount = diagnostics.filter((d) => d.severity === 'error').length;const warningCount = diagnostics.length - errorCount;- const responseWarnings = data.warnings ?? [];+ const legacyReLintWarning =+ typeof (rest as { warning?: unknown }).warning === 'string' &&+ isReLintFailedWarning((rest as { warning: string }).warning)+ ? (rest as { warning: string }).warning+ : undefined;+ const responseWarnings = [+ ...(data.warnings ?? []),+ ...(legacyReLintWarning === undefined ? [] : [legacyReLintWarning]),+ ];+ const legacyPrefixedWarning = responseWarnings.find(isReLintFailedWarning);+ const warnings = responseWarnings.filter((warning) => !isReLintFailedWarning(warning));+ const diagnosticsArePreFix =+ data.diagnosticsArePreFix === true ||+ data.reLintFailure !== undefined ||+ legacyPrefixedWarning !== undefined;+ const typedMessage =+ typeof data.reLintFailure?.message === 'string' ? data.reLintFailure.message.trim() : '';+ const typedFailure: ReLintFailure | undefined = typedMessage+ ? {+ reason: isReLintFailureReason(data.reLintFailure?.reason)+ ? data.reLintFailure.reason+ : 're-lint-threw',+ message: typedMessage,+ }+ : undefined;+ const legacyMessage = legacyPrefixedWarning?.slice(RE_LINT_FAILED_WARNING_PREFIX.length).trim();+ const reLintFailure: ReLintFailure | undefined =+ typedFailure ??+ (legacyMessage ? { reason: 're-lint-threw' as const, message: legacyMessage } : undefined);+ const reLintCause = reLintFailure ? ` (${reLintFailure.message})` : '';const coverageLines = validationCoverageLines(data.ran);const structured = {files: [{ file, diagnostics }],fixedCount,errorCount,warningCount,- ...(responseWarnings.length > 0 ? { warnings: responseWarnings } : {}),+ ...(warnings.length > 0 ? { warnings } : {}),+ ...(diagnosticsArePreFix ? { diagnosticsArePreFix: true } : {}),+ ...(reLintFailure ? { reLintFailure } : {}),...(data.ran === undefined ? {} : { ran: data.ran }),cwd,};- const header = data.warning- ? `Applied auto-fixes to ${file}, but re-lint failed (${data.warning}); the fix landed — problems below are the pre-fix set, re-run \`lint\` to confirm.`+ const header = diagnosticsArePreFix+ ? `Applied auto-fixes to ${file}, but re-lint failed${reLintCause}; the fix landed — problems below are the pre-fix set, re-run \`lint\` to confirm.`: fixedCount > 0? `Fixed ${fixedCount} problem${fixedCount === 1 ? '' : 's'} in ${file}.`- : responseWarnings.length > 0+ : warnings.length > 0? `No auto-fixable problems in ${file}, but the lint could not fully complete.`: `No auto-fixable problems in ${file}.`;const lines = diagnostics.map(formatDiagnosticLine);- const warningBlock = degradationBlock(- 'Lint',- responseWarnings.filter((warning) => warning !== data.warning),- );+ const warningBlock = degradationBlock('Lint', warnings);const footer =- diagnostics.length > 0 && !data.warning+ diagnostics.length > 0 && !diagnosticsArePreFix? [`${diagnostics.length} problem${diagnostics.length === 1 ? '' : 's'} remain (${countSummary(errorCount, warningCount)}) — need content edits via \`edit\`/\`write\`.`,]diff --git a/packages/server/src/mcp/tools/output-schema-strictness.test.ts b/packages/server/src/mcp/tools/output-schema-strictness.test.tsindex 27f1f7eb1..3fa818fc4 100644--- a/packages/server/src/mcp/tools/output-schema-strictness.test.ts+++ b/packages/server/src/mcp/tools/output-schema-strictness.test.ts@@ -1,6 +1,7 @@import { mkdirSync, mkdtempSync } from 'node:fs';import { tmpdir } from 'node:os';import { join } from 'node:path';+import { RE_LINT_FAILED_WARNING_PREFIX } from '@inkeep/open-knowledge-core';import { normalizeObjectSchema } from '@modelcontextprotocol/sdk/server/zod-compat.js';import { toJsonSchemaCompat } from '@modelcontextprotocol/sdk/server/zod-json-schema-compat.js';import { AjvJsonSchemaValidator } from '@modelcontextprotocol/sdk/validation/ajv';@@ -16,6 +17,8 @@ import { AUDIT_WARNING_CAP, type ServerInstance } from './shared.ts';const BASE_CONFIG: Config = ConfigSchema.parse({});+const legacyReLint = (message: string) => `${RE_LINT_FAILED_WARNING_PREFIX}${message}`;+interface ToolResult {content: Array<{ type: 'text'; text: string }>;structuredContent?: Record<string, unknown>;@@ -422,44 +425,348 @@ describe('audit and lint emitted coverage validates against the client schema',);});- test('the deprecated fix `warning` rides `warnings` too, and renders once', async () => {+ test('diagnosticsArePreFix drives the fix header, renders the bare reason once, and drops the remaining-problems footer', async () => {+ const captured = captureRegistration(registerLint, {+ config: BASE_CONFIG,+ resolveCwd: async () => newProject(),+ serverUrl: 'http://127.0.0.1:31337',+ });+ const reLint = legacyReLint('boom');+ const fixPayload = (+ warnings: string[],+ diagnosticsArePreFix?: boolean,+ ): Record<string, unknown> => ({+ file: 'notes.md',+ fixedCount: diagnosticsArePreFix ? 0 : 1,+ diagnostics: [warningDiagnostic('markdownlint')],+ errorCount: 0,+ warningCount: 1,+ ran: ['markdownlint'],+ warnings,+ ...(diagnosticsArePreFix === undefined ? {} : { diagnosticsArePreFix }),+ });+ const call = async (warnings: string[], diagnosticsArePreFix?: boolean) => {+ vi.stubGlobal(+ 'fetch',+ vi.fn(async () => Response.json(fixPayload(warnings, diagnosticsArePreFix))),+ );+ return captured.handler({ document: 'notes', fix: true });+ };++ const result = await call([reLint], true);++ expect(result.structuredContent).not.toHaveProperty('warnings');+ expect(result.structuredContent).toMatchObject({+ diagnosticsArePreFix: true,+ reLintFailure: { reason: 're-lint-threw', message: 'boom' },+ });+ const text = result.content[0]?.text ?? '';+ expect(text.split('\n')[0]).toBe(+ 'Applied auto-fixes to notes.md, but re-lint failed (boom); the fix landed — problems below are the pre-fix set, re-run `lint` to confirm.',+ );+ expect(text).not.toContain(RE_LINT_FAILED_WARNING_PREFIX);+ expect(text).not.toContain('problem remain');++ const legacyOnly = await (async () => {+ vi.stubGlobal(+ 'fetch',+ vi.fn(async () =>+ Response.json({+ file: 'notes.md',+ fixedCount: 0,+ diagnostics: [warningDiagnostic('markdownlint')],+ errorCount: 0,+ warningCount: 1,+ ran: ['markdownlint'],+ warning: reLint,+ }),+ ),+ );+ return captured.handler({ document: 'notes', fix: true });+ })();+ const legacyText = legacyOnly.content[0]?.text ?? '';+ expect(legacyText.split('\n')[0]).toBe(+ 'Applied auto-fixes to notes.md, but re-lint failed (boom); the fix landed — problems below are the pre-fix set, re-run `lint` to confirm.',+ );+ expect(legacyText).not.toContain('problem remain');+ expect(legacyOnly.structuredContent).not.toHaveProperty('warnings');+ expect(legacyOnly.structuredContent).toMatchObject({+ diagnosticsArePreFix: true,+ reLintFailure: { reason: 're-lint-threw', message: 'boom' },+ });++ const ordinary = await call(['source "markdownlint" lint failed on "notes.md": boom']);+ const ordinaryStructured = ordinary.structuredContent as { diagnosticsArePreFix?: boolean };+ expect(ordinaryStructured.diagnosticsArePreFix).toBeUndefined();+ const ordinaryText = ordinary.content[0]?.text ?? '';+ expect(ordinaryText.split('\n')[0]).toBe('Fixed 1 problem in notes.md.');+ expect(ordinaryText).toContain('1 problem remain');++ const validator = new AjvJsonSchemaValidator();+ const validate = validator.getValidator(+ compileOutputSchemaForClient(captured.cfg.outputSchema),+ );+ const validation = validate(result.structuredContent) as {+ valid: boolean;+ errorMessage?: string;+ };+ expect(validation.valid, validation.errorMessage).toBe(true);+ });++ test('the pre-fix signal survives a server that sends only the prefix or only the boolean', async () => {+ const captured = captureRegistration(registerLint, {+ config: BASE_CONFIG,+ resolveCwd: async () => newProject(),+ serverUrl: 'http://127.0.0.1:31337',+ });+ const call = async (extra: Record<string, unknown>) => {+ vi.stubGlobal(+ 'fetch',+ vi.fn(async () =>+ Response.json({+ file: 'notes.md',+ fixedCount: 0,+ diagnostics: [warningDiagnostic('markdownlint')],+ errorCount: 0,+ warningCount: 1,+ ran: ['markdownlint'],+ ...extra,+ }),+ ),+ );+ return captured.handler({ document: 'notes', fix: true });+ };++ const prefixOnly = await call({ warnings: [legacyReLint('boom')] });+ expect(+ (prefixOnly.structuredContent as { diagnosticsArePreFix?: boolean }).diagnosticsArePreFix,+ ).toBe(true);+ expect(prefixOnly.structuredContent).not.toHaveProperty('warnings');+ expect(prefixOnly.structuredContent).toHaveProperty('reLintFailure', {+ reason: 're-lint-threw',+ message: 'boom',+ });+ const prefixText = prefixOnly.content[0]?.text ?? '';+ expect(prefixText.split('\n')[0]).toBe(+ 'Applied auto-fixes to notes.md, but re-lint failed (boom); the fix landed — problems below are the pre-fix set, re-run `lint` to confirm.',+ );+ expect(prefixText).not.toContain(RE_LINT_FAILED_WARNING_PREFIX);+ expect(prefixText).not.toContain('problem remain');++ const booleanOnly = await call({ diagnosticsArePreFix: true });+ expect(booleanOnly.structuredContent).toHaveProperty('diagnosticsArePreFix', true);+ expect(booleanOnly.structuredContent).not.toHaveProperty('reLintFailure');+ expect((booleanOnly.content[0]?.text ?? '').split('\n')[0]).toBe(+ 'Applied auto-fixes to notes.md, but re-lint failed; the fix landed — problems below are the pre-fix set, re-run `lint` to confirm.',+ );+ });++ test.each(['boom', ' \tboom\n '])(+ 'reLintFailure alone marks diagnostics as pre-fix and carries its message in both outputs (%j)',+ async (message) => {+ const captured = captureRegistration(registerLint, {+ config: BASE_CONFIG,+ resolveCwd: async () => newProject(),+ serverUrl: 'http://127.0.0.1:31337',+ });+ const diagnostics = [warningDiagnostic('markdownlint')];+ vi.stubGlobal(+ 'fetch',+ vi.fn(async () =>+ Response.json({+ file: 'notes.md',+ fixedCount: 0,+ diagnostics,+ ran: ['markdownlint'],+ reLintFailure: { reason: 'source-went-blind', message },+ }),+ ),+ );++ const result = await captured.handler({ document: 'notes', fix: true });+ const text = result.content[0]?.text ?? '';+ expect(text.split('\n')[0]).toBe(+ 'Applied auto-fixes to notes.md, but re-lint failed (boom); the fix landed — problems below are the pre-fix set, re-run `lint` to confirm.',+ );+ expect(text.match(/boom/g)).toHaveLength(1);+ expect(text).not.toContain('problem remain');+ expect(result.structuredContent).toMatchObject({+ files: [{ file: 'notes.md', diagnostics }],+ fixedCount: 0,+ errorCount: 0,+ warningCount: 1,+ diagnosticsArePreFix: true,+ reLintFailure: { reason: 'source-went-blind', message: 'boom' },+ });+ expect(result.structuredContent).not.toHaveProperty('warnings');+ expect(result.structuredContent).not.toHaveProperty('warning');+ const validate = new AjvJsonSchemaValidator().getValidator(+ compileOutputSchemaForClient(captured.cfg.outputSchema),+ );+ const validation = validate(result.structuredContent);+ expect(validation.valid, validation.errorMessage).toBe(true);+ },+ );++ test.each([{}, { reason: 're-lint-threw', message: ' ' }])(+ 'a malformed typed reLintFailure (%j) falls through to the legacy prefixed warning without throwing',+ async (reLintFailure) => {+ const captured = captureRegistration(registerLint, {+ config: BASE_CONFIG,+ resolveCwd: async () => newProject(),+ serverUrl: 'http://127.0.0.1:31337',+ });+ vi.stubGlobal(+ 'fetch',+ vi.fn(async () =>+ Response.json({+ file: 'notes.md',+ fixedCount: 0,+ diagnostics: [warningDiagnostic('markdownlint')],+ ran: ['markdownlint'],+ warnings: [legacyReLint('legacy reason')],+ reLintFailure,+ }),+ ),+ );++ const result = await captured.handler({ document: 'notes', fix: true });+ expect(result.isError).toBeUndefined();+ expect(result.structuredContent).toMatchObject({+ diagnosticsArePreFix: true,+ reLintFailure: { reason: 're-lint-threw', message: 'legacy reason' },+ });+ expect(result.structuredContent).not.toHaveProperty('warnings');+ const text = result.content[0]?.text ?? '';+ expect(text.split('\n')[0]).toContain('re-lint failed (legacy reason);');+ expect(text).not.toContain(RE_LINT_FAILED_WARNING_PREFIX);+ const validate = new AjvJsonSchemaValidator().getValidator(+ compileOutputSchemaForClient(captured.cfg.outputSchema),+ );+ const validation = validate(result.structuredContent);+ expect(validation.valid, validation.errorMessage).toBe(true);+ },+ );++ test.each([+ { reLintFailure: undefined, reason: 're-lint-threw', message: 'plural reason' },+ {+ reLintFailure: { reason: 'source-went-blind', message: ' typed reason ' },+ reason: 'source-went-blind',+ message: 'typed reason',+ },+ ])(+ 'fix output keeps ordinary warnings and normalizes legacy failures to $message',+ async ({ reLintFailure, reason, message }) => {+ const captured = captureRegistration(registerLint, {+ config: BASE_CONFIG,+ resolveCwd: async () => newProject(),+ serverUrl: 'http://127.0.0.1:31337',+ });+ const warnings = [+ 'source "markdownlint" fix failed on "notes.md": unavailable',+ 'frontmatter schema unavailable',+ ];+ vi.stubGlobal(+ 'fetch',+ vi.fn(async () =>+ Response.json({+ file: 'notes.md',+ fixedCount: 0,+ diagnostics: [warningDiagnostic('markdownlint')],+ warnings: [+ warnings[0],+ legacyReLint('plural reason'),+ warnings[1],+ legacyReLint('another legacy reason'),+ ],+ warning: legacyReLint('singular reason'),+ reLintFailure,+ }),+ ),+ );++ const result = await captured.handler({ document: 'notes', fix: true });+ expect(result.structuredContent).toMatchObject({+ warnings,+ diagnosticsArePreFix: true,+ reLintFailure: { reason, message },+ });+ const text = result.content[0]?.text ?? '';+ expect(text.split('\n')[0]).toContain(`re-lint failed (${message});`);+ expect(text).toContain('Lint incomplete — 2 warnings (findings may be partial):');+ for (const warning of warnings) expect(text).toContain(warning);+ expect(text).not.toContain(RE_LINT_FAILED_WARNING_PREFIX);+ expect(text).not.toContain('another legacy reason');+ expect(text).not.toContain('singular reason');+ expect(text).not.toContain('problem remain');+ },+ );++ test('an older server that sends the same prefixed string in warning and warnings renders it once', async () => {const captured = captureRegistration(registerLint, {config: BASE_CONFIG,resolveCwd: async () => newProject(),serverUrl: 'http://127.0.0.1:31337',});- const reLint = 'Re-lint after fix failed: boom';vi.stubGlobal('fetch',vi.fn(async () =>Response.json({file: 'notes.md',- fixedCount: 1,- diagnostics: [],- errorCount: 0,- warningCount: 0,+ fixedCount: 0,+ diagnostics: [warningDiagnostic('markdownlint')],ran: ['markdownlint'],- warning: reLint,- warnings: [reLint],+ warning: legacyReLint('same'),+ warnings: [legacyReLint('same')],}),),);const result = await captured.handler({ document: 'notes', fix: true });- const structured = result.structuredContent as { warnings?: string[] };- expect(structured.warnings).toEqual([reLint]);+ expect(result.structuredContent).not.toHaveProperty('warnings');+ expect(result.structuredContent).toMatchObject({+ diagnosticsArePreFix: true,+ reLintFailure: { reason: 're-lint-threw', message: 'same' },+ });const text = result.content[0]?.text ?? '';- expect(text.split(reLint)).toHaveLength(2);+ expect(text.split('\n')[0]).toBe(+ 'Applied auto-fixes to notes.md, but re-lint failed (same); the fix landed — problems below are the pre-fix set, re-run `lint` to confirm.',+ );+ expect(text.match(/same/g)).toHaveLength(1);+ expect(text).not.toContain(RE_LINT_FAILED_WARNING_PREFIX);+ });- const validator = new AjvJsonSchemaValidator();- const validate = validator.getValidator(+ test('a reason an older or newer server does not share normalizes to the closed discriminant', async () => {+ const captured = captureRegistration(registerLint, {+ config: BASE_CONFIG,+ resolveCwd: async () => newProject(),+ serverUrl: 'http://127.0.0.1:31337',+ });+ vi.stubGlobal(+ 'fetch',+ vi.fn(async () =>+ Response.json({+ file: 'notes.md',+ fixedCount: 0,+ diagnostics: [warningDiagnostic('markdownlint')],+ ran: ['markdownlint'],+ reLintFailure: { reason: 'a-reason-from-the-future', message: 'still readable' },+ }),+ ),+ );++ const result = await captured.handler({ document: 'notes', fix: true });++ expect(result.structuredContent).toMatchObject({+ diagnosticsArePreFix: true,+ reLintFailure: { reason: 're-lint-threw', message: 'still readable' },+ });+ const validate = new AjvJsonSchemaValidator().getValidator(compileOutputSchemaForClient(captured.cfg.outputSchema),);- const validation = validate(result.structuredContent) as {- valid: boolean;- errorMessage?: string;- };+ const validation = validate(result.structuredContent);expect(validation.valid, validation.errorMessage).toBe(true);});diff --git a/packages/server/src/mcp/tools/path-safety.test.ts b/packages/server/src/mcp/tools/path-safety.test.tsindex 547eff6c2..1635f8b5f 100644--- a/packages/server/src/mcp/tools/path-safety.test.ts+++ b/packages/server/src/mcp/tools/path-safety.test.ts@@ -120,14 +120,13 @@ describe('escapesRoot — win32 separators (PRD-8341)', () => {expect(escapesRoot(win32.relative(root, win32.resolve(root, candidate)))).toBe(true);});- test.each([- ['C:\\Windows\\win.ini'],- ['\\\\server\\share\\secrets.md'],- ['D:\\other.md'],- ])('refuses win32 absolute %s', (candidate) => {- const rel = win32.relative(root, win32.resolve(root, candidate));- expect(escapesRoot(rel) || win32.isAbsolute(rel)).toBe(true);- });+ test.each([['C:\\Windows\\win.ini'], ['\\\\server\\share\\secrets.md'], ['D:\\other.md']])(+ 'refuses win32 absolute %s',+ (candidate) => {+ const rel = win32.relative(root, win32.resolve(root, candidate));+ expect(escapesRoot(rel) || win32.isAbsolute(rel)).toBe(true);+ },+ );test.each([['articles\\auth.md'],diff --git a/packages/server/src/parse-pool.test.ts b/packages/server/src/parse-pool.test.tsindex 843c208d6..3140f37eb 100644--- a/packages/server/src/parse-pool.test.ts+++ b/packages/server/src/parse-pool.test.ts@@ -305,9 +305,38 @@ describe('worker entry ships in every bundle shape', () => {exports: Record<string, Record<string, string>>;};expect(pkg.exports['./parse-worker']).toEqual({+ '@inkeep/source': './src/parse-worker.ts',development: './src/parse-worker.ts',- types: './src/parse-worker.ts',+ types: './dist/parse-worker.d.mts',default: './dist/parse-worker.mjs',});});++ test.each([+ ['@inkeep/open-knowledge-server', '../package.json'],+ ['@inkeep/open-knowledge-core', '../../core/package.json'],+ ])(+ '%s keeps every export subpath on the same four conditions in the same order',+ (_name, rel) => {+ const pkg = JSON.parse(readFileSync(resolve(__dirname, rel), 'utf8')) as {+ exports: Record<string, Record<string, string>>;+ };+ const subpaths = Object.entries(pkg.exports);+ expect(subpaths.length).toBeGreaterThan(0);+ for (const [subpath, entry] of subpaths) {+ expect(Object.keys(entry), `${rel} ${subpath} condition order`).toEqual([+ '@inkeep/source',+ 'development',+ 'types',+ 'default',+ ]);+ expect(entry['@inkeep/source'], `${rel} ${subpath} source vs development`).toBe(+ entry.development,+ );+ expect(entry.types, `${rel} ${subpath} types must resolve to a declaration`).toMatch(+ /\.d\.mts$/,+ );+ }+ },+ );});diff --git a/packages/server/src/seed/okf-conformance.test.ts b/packages/server/src/seed/okf-conformance.test.tsindex ce6a918ec..41b6d4123 100644--- a/packages/server/src/seed/okf-conformance.test.ts+++ b/packages/server/src/seed/okf-conformance.test.ts@@ -319,44 +319,47 @@ describe('knowledge-base + okf pack compatibility', () => {test.each([['knowledge-base', 'okf'],['okf', 'knowledge-base'],- ] satisfies PackId[][])('both seed orders produce one clean OKF bundle: %s then %s', async (first, second) => {- const order: PackId[] = [first, second];- const { projectDir, cleanup } = await seedPackSequence(order);- try {- const files = collectMarkdown(projectDir);- expect(files).toContain('index.md');- expect(files).toContain('log.md');- expect(files).toContain('external-sources/.ok/templates/clip.md');- expect(files).toContain('research/.ok/templates/research-log.md');- expect(files).toContain('articles/.ok/templates/article.md');-- const installedSkillNames = files- .filter((relPath) => relPath.endsWith('/SKILL.md'))- .map((relPath) => {+ ] satisfies PackId[][])(+ 'both seed orders produce one clean OKF bundle: %s then %s',+ async (first, second) => {+ const order: PackId[] = [first, second];+ const { projectDir, cleanup } = await seedPackSequence(order);+ try {+ const files = collectMarkdown(projectDir);+ expect(files).toContain('index.md');+ expect(files).toContain('log.md');+ expect(files).toContain('external-sources/.ok/templates/clip.md');+ expect(files).toContain('research/.ok/templates/research-log.md');+ expect(files).toContain('articles/.ok/templates/article.md');++ const installedSkillNames = files+ .filter((relPath) => relPath.endsWith('/SKILL.md'))+ .map((relPath) => {+ const source = readFileSync(join(projectDir, relPath), 'utf-8');+ const { frontmatter } = stripFrontmatter(source);+ return parseFrontmatterYaml(unwrapFrontmatterFences(frontmatter)).map?.name;+ })+ .sort();+ expect(installedSkillNames).toEqual([+ 'consolidate-notes',+ 'knowledge-base',+ 'okf-knowledge-base',+ 'research-with-sources',+ ]);++ for (const relPath of files) {const source = readFileSync(join(projectDir, relPath), 'utf-8');- const { frontmatter } = stripFrontmatter(source);- return parseFrontmatterYaml(unwrapFrontmatterFences(frontmatter)).map?.name;- })- .sort();- expect(installedSkillNames).toEqual([- 'consolidate-notes',- 'knowledge-base',- 'okf-knowledge-base',- 'research-with-sources',- ]);-- for (const relPath of files) {- const source = readFileSync(join(projectDir, relPath), 'utf-8');- const findings = await lintDocument(source, OKF_LINT_CONFIG, relPath);- expect(- findings,- `${order.join(' → ')}: ${relPath} produced ${findings.map((f) => f.code).join(', ')}`,- ).toEqual([]);+ const findings = await lintDocument(source, OKF_LINT_CONFIG, relPath);+ expect(+ findings,+ `${order.join(' → ')}: ${relPath} produced ${findings.map((f) => f.code).join(', ')}`,+ ).toEqual([]);+ }+ } finally {+ await cleanup();}- } finally {- await cleanup();- }- });+ },+ );});describe('all starter packs — OKF §11 rule 2 (every template instantiates a typed doc)', () => {diff --git a/packages/server/src/server-factory.test.ts b/packages/server/src/server-factory.test.tsindex 27e60324a..a1d11aebf 100644--- a/packages/server/src/server-factory.test.ts+++ b/packages/server/src/server-factory.test.ts@@ -1059,7 +1059,9 @@ describe('createServer() — config file watcher (US-007)', () => {expect(ytext.toString()).toBe(validContent);const warning = logs.getCalls('warn', 'project config invalid').at(-1);expect(warning?.payload.err).toBeInstanceOf(Error);- expect((warning?.payload.err as Error).cause).toMatchObject({ code: 'YAML_PARSE' });+ expect((warning?.payload.err as Error | undefined)?.cause).toMatchObject({+ code: 'YAML_PARSE',+ });await srv.destroy();});@@ -1278,15 +1280,16 @@ describe('createServer() — a removed key in project-local config does not disaexpect(reportedRemovedKey).toBe(true);});- test.each(- REMOVED_KEYS.map((entry) => ({ entry, dotted: entry.path.join('.') })),- )('registry key $dotted beside autoSync.mode: full still resolves full', async ({ entry }) => {- writeProjectLocal(- stringifyYaml({ autoSync: { mode: 'full' }, ...nestRemovedKey(entry.path, false) }),- );- const srv = await boot();- expect(srv.syncEngine?.getStatus().syncMode).toBe('full');- });+ test.each(REMOVED_KEYS.map((entry) => ({ entry, dotted: entry.path.join('.') })))(+ 'registry key $dotted beside autoSync.mode: full still resolves full',+ async ({ entry }) => {+ writeProjectLocal(+ stringifyYaml({ autoSync: { mode: 'full' }, ...nestRemovedKey(entry.path, false) }),+ );+ const srv = await boot();+ expect(srv.syncEngine?.getStatus().syncMode).toBe('full');+ },+ );test('a removed key beside linkPreviews.enabled: true resolves link previews enabled', async () => {const srv = await boot();diff --git a/packages/server/src/services/file-ops.ts b/packages/server/src/services/file-ops.tsindex 220ca6b84..fef91bcbf 100644--- a/packages/server/src/services/file-ops.ts+++ b/packages/server/src/services/file-ops.ts@@ -17,8 +17,10 @@ import { errnoCode } from '../http/handler-utils.ts';import { getLogger } from '../logger.ts';export class DuplicateNameExhaustedError extends Error {- constructor(readonly sourcePath: string) {+ readonly sourcePath: string;+ constructor(sourcePath: string) {super(`Could not find an available duplicate name for ${sourcePath}`);+ this.sourcePath = sourcePath;this.name = 'DuplicateNameExhaustedError';}}diff --git a/packages/server/src/single-file-open.ts b/packages/server/src/single-file-open.tsindex 25d2dab66..667d06d61 100644--- a/packages/server/src/single-file-open.ts+++ b/packages/server/src/single-file-open.ts@@ -7,32 +7,37 @@ import { isSupportedDocFile, stripDocExtension } from './doc-extensions.ts';import { findEnclosingProjectRoot, isProjectRoot } from './fs/find-project-root.ts';export class SingleFileNotFoundError extends Error {- constructor(readonly filePath: string) {+ readonly filePath: string;+ constructor(filePath: string) {super(`File not found: ${filePath}`);+ this.filePath = filePath;this.name = 'SingleFileNotFoundError';}}export class SingleFileNotAFileError extends Error {- constructor(readonly filePath: string) {+ readonly filePath: string;+ constructor(filePath: string) {super(`Not a file: ${filePath}. \`ok <file>\` opens a single markdown file.`);+ this.filePath = filePath;this.name = 'SingleFileNotAFileError';}}export class SingleFileProjectOverrideError extends Error {- constructor(- readonly projectRoot: string,- reason: string,- ) {+ readonly projectRoot: string;+ constructor(projectRoot: string, reason: string) {super(`Cannot open with --project ${projectRoot}: ${reason}`);+ this.projectRoot = projectRoot;this.name = 'SingleFileProjectOverrideError';}}export class SingleFileNotMarkdownError extends Error {- constructor(readonly filePath: string) {+ readonly filePath: string;+ constructor(filePath: string) {super(`OpenKnowledge edits markdown files (.md / .mdx): ${filePath}`);+ this.filePath = filePath;this.name = 'SingleFileNotMarkdownError';}}diff --git a/packages/server/src/skill-cross-refs.test.ts b/packages/server/src/skill-cross-refs.test.tsindex da2484f2d..67f4f7d8e 100644--- a/packages/server/src/skill-cross-refs.test.ts+++ b/packages/server/src/skill-cross-refs.test.ts@@ -50,11 +50,12 @@ describe('shipped skills — cross-skill reference graph', () => {expect(edges.length).toBeGreaterThan(0);});- test.each(- packSkills.map((f) => [f.slice(SKILLS_ROOT.length + 1), f] as const),- )('pack skill %s routes to the platform skill with /open-knowledge', (_label, file) => {- expect(extractSkillRefs(body(file))).toContain(PLATFORM_SKILL);- });+ test.each(packSkills.map((f) => [f.slice(SKILLS_ROOT.length + 1), f] as const))(+ 'pack skill %s routes to the platform skill with /open-knowledge',+ (_label, file) => {+ expect(extractSkillRefs(body(file))).toContain(PLATFORM_SKILL);+ },+ );test('a pack orientation skill routes to each of its member skills', () => {const missing: string[] = [];diff --git a/packages/server/src/skill-install.test.ts b/packages/server/src/skill-install.test.tsindex 2ccbb78c8..849b788f4 100644--- a/packages/server/src/skill-install.test.ts+++ b/packages/server/src/skill-install.test.ts@@ -760,18 +760,17 @@ describe('buildAndOpenSkill — install-state gate', () => {});describe('installUserSkill — home guard', () => {- test.each([- '',- '.',- 'relative/home',- ])('a non-absolute home (%j) fails without writing anything', async (bogus) => {- const { logger, records } = makeRecordingLogger();- expect(await installUserSkill({ home: bogus, logger })).toBe('failed');- expect(findWarn(records, 'skill-install.failed')?.data).toMatchObject({- reason: 'home-not-absolute',- });- expect(existsSync(join(process.cwd(), bogus, '.ok'))).toBe(false);- });+ test.each(['', '.', 'relative/home'])(+ 'a non-absolute home (%j) fails without writing anything',+ async (bogus) => {+ const { logger, records } = makeRecordingLogger();+ expect(await installUserSkill({ home: bogus, logger })).toBe('failed');+ expect(findWarn(records, 'skill-install.failed')?.data).toMatchObject({+ reason: 'home-not-absolute',+ });+ expect(existsSync(join(process.cwd(), bogus, '.ok'))).toBe(false);+ },+ );test('a relative home cannot touch a matching tree in the cwd', async () => {const box = freshHome();diff --git a/packages/server/src/sync-engine.test.ts b/packages/server/src/sync-engine.test.tsindex 815e9fde8..084a0cb49 100644--- a/packages/server/src/sync-engine.test.ts+++ b/packages/server/src/sync-engine.test.ts@@ -1143,40 +1143,40 @@ describe('SyncEngine push gating — scheduled vs explicit', () => {return { git, localHead, originBefore };}- test.each([- 'off',- 'follow',- ] as const)("%s never pushes on the engine's own initiative", async (mode) => {- const { git, originBefore } = await projectWithUnpushedCommit();- const engine = makeEngine({ mode });- await engine.refreshRemote();- try {- await (engine as unknown as { runPushCycle: () => Promise<void> }).runPushCycle();+ test.each(['off', 'follow'] as const)(+ "%s never pushes on the engine's own initiative",+ async (mode) => {+ const { git, originBefore } = await projectWithUnpushedCommit();+ const engine = makeEngine({ mode });+ await engine.refreshRemote();+ try {+ await (engine as unknown as { runPushCycle: () => Promise<void> }).runPushCycle();- expect((await git.revparse(['origin/main'])).trim()).toBe(originBefore);- expect(engine.getStatus().lastPushedSha).toBeNull();- } finally {- await engine.destroy();- }- });+ expect((await git.revparse(['origin/main'])).trim()).toBe(originBefore);+ expect(engine.getStatus().lastPushedSha).toBeNull();+ } finally {+ await engine.destroy();+ }+ },+ );- test.each([- 'off',- 'follow',- ] as const)('%s pushes when the user explicitly asks, without arming a loop', async (mode) => {- const { git, localHead } = await projectWithUnpushedCommit();- const engine = makeEngine({ mode });- await engine.refreshRemote();- try {- await engine.pushOnce();+ test.each(['off', 'follow'] as const)(+ '%s pushes when the user explicitly asks, without arming a loop',+ async (mode) => {+ const { git, localHead } = await projectWithUnpushedCommit();+ const engine = makeEngine({ mode });+ await engine.refreshRemote();+ try {+ await engine.pushOnce();- expect((await git.revparse(['origin/main'])).trim()).toBe(localHead);- expect(engine.getStatus().lastPushedSha).toBe(localHead);- expect(engine.getStatus().syncMode).toBe(mode);- } finally {- await engine.destroy();- }- });+ expect((await git.revparse(['origin/main'])).trim()).toBe(localHead);+ expect(engine.getStatus().lastPushedSha).toBe(localHead);+ expect(engine.getStatus().syncMode).toBe(mode);+ } finally {+ await engine.destroy();+ }+ },+ );test('refuses when there is no remote to push to', async () => {const engine = makeEngine({ mode: 'off' });@@ -1370,66 +1370,64 @@ describe('SyncEngine unified pull — B1 in every mode', () => {}});- test.each([- 'off',- 'follow',- 'full',- ] as const)('diverged committed history: Pull refuses, Pull-and-Push merges — mode %s (FR-5)', async (mode) => {- const { git, sister, sisterDir } = await projectWithSister();- writeFileSync(join(sisterDir, 'theirs.md'), 'theirs\n');- await sister.add('.');- await sister.commit('teammate commit');- await sister.push();+ test.each(['off', 'follow', 'full'] as const)(+ 'diverged committed history: Pull refuses, Pull-and-Push merges — mode %s (FR-5)',+ async (mode) => {+ const { git, sister, sisterDir } = await projectWithSister();+ writeFileSync(join(sisterDir, 'theirs.md'), 'theirs\n');+ await sister.add('.');+ await sister.commit('teammate commit');+ await sister.push();- writeFileSync(join(projectDir, 'mine.md'), 'mine\n');- await git.add('.');- await git.commit('local commit');+ writeFileSync(join(projectDir, 'mine.md'), 'mine\n');+ await git.add('.');+ await git.commit('local commit');- const engine = makeRootContentEngine(mode);- await engine.refreshRemote();- try {- expect(await engine.pullOnce()).toBe('refused');- expect(engine.getStatus().pausedReason).toBe('diverged-local-commits');+ const engine = makeRootContentEngine(mode);+ await engine.refreshRemote();+ try {+ expect(await engine.pullOnce()).toBe('refused');+ expect(engine.getStatus().pausedReason).toBe('diverged-local-commits');- await engine.pullOnce('sync');+ await engine.pullOnce('sync');- expect(engine.getStatus().pausedReason).toBeUndefined();- expect(existsSync(join(projectDir, 'theirs.md'))).toBe(true);- expect(existsSync(join(projectDir, 'mine.md'))).toBe(true);- } finally {- await engine.destroy();- }- });+ expect(engine.getStatus().pausedReason).toBeUndefined();+ expect(existsSync(join(projectDir, 'theirs.md'))).toBe(true);+ expect(existsSync(join(projectDir, 'mine.md'))).toBe(true);+ } finally {+ await engine.destroy();+ }+ },+ );- test.each([- 'off',- 'follow',- 'full',- ] as const)('the Sync verb keeps the classic commit+merge machinery — mode %s', async (mode) => {- const { git, sister, sisterDir } = await projectWithSister();- const seeded = readFileSync(join(sisterDir, 'doc.md'), 'utf-8');- writeFileSync(join(sisterDir, 'doc.md'), seeded.replace('TOP', 'TOP-THEIRS'));- await sister.add('.');- await sister.commit('teammate edits top');- await sister.push();+ test.each(['off', 'follow', 'full'] as const)(+ 'the Sync verb keeps the classic commit+merge machinery — mode %s',+ async (mode) => {+ const { git, sister, sisterDir } = await projectWithSister();+ const seeded = readFileSync(join(sisterDir, 'doc.md'), 'utf-8');+ writeFileSync(join(sisterDir, 'doc.md'), seeded.replace('TOP', 'TOP-THEIRS'));+ await sister.add('.');+ await sister.commit('teammate edits top');+ await sister.push();- const local = readFileSync(join(projectDir, 'doc.md'), 'utf-8');- writeFileSync(join(projectDir, 'doc.md'), local.replace('BOTTOM', 'BOTTOM-MINE'));+ const local = readFileSync(join(projectDir, 'doc.md'), 'utf-8');+ writeFileSync(join(projectDir, 'doc.md'), local.replace('BOTTOM', 'BOTTOM-MINE'));- const engine = makeRootContentEngine(mode);- await engine.refreshRemote();- try {- expect(await engine.pullOnce('sync')).toBe('succeeded');+ const engine = makeRootContentEngine(mode);+ await engine.refreshRemote();+ try {+ expect(await engine.pullOnce('sync')).toBe('succeeded');- const merged = readFileSync(join(projectDir, 'doc.md'), 'utf-8');- expect(merged).toContain('TOP-THEIRS');- expect(merged).toContain('BOTTOM-MINE');- const log = await git.log();- expect(log.all.some((c) => c.message === 'Auto-save: interim before merge')).toBe(true);- } finally {- await engine.destroy();- }- });+ const merged = readFileSync(join(projectDir, 'doc.md'), 'utf-8');+ expect(merged).toContain('TOP-THEIRS');+ expect(merged).toContain('BOTTOM-MINE');+ const log = await git.log();+ expect(log.all.some((c) => c.message === 'Auto-save: interim before merge')).toBe(true);+ } finally {+ await engine.destroy();+ }+ },+ );test('follow mode keeps a local artifact edit that origin also changed (the phantom-offline fix)', async () => {const { sister, sisterDir } = await projectWithSister();@@ -4898,7 +4896,7 @@ describe('SyncEngine declared-account resolution', () => {(e) => e.level === 'warn' && e.msg.includes('declared GitHub account'),);expect(miss?.data).toMatchObject({ declaredLogin: 'alice' });- expect((miss?.data as { resolvedLogin?: string }).resolvedLogin).toBeUndefined();+ expect((miss?.data as { resolvedLogin?: string } | undefined)?.resolvedLogin).toBeUndefined();const failed = logs.entries.find((e) => e.level === 'warn' && e.msg.includes('detectGhAccounts failed'),);diff --git a/packages/server/tsconfig.build.json b/packages/server/tsconfig.build.jsonnew file mode 100644index 000000000..6fe93e8fb--- /dev/null+++ b/packages/server/tsconfig.build.json@@ -0,0 +1,7 @@+{+ "extends": "./tsconfig.json",+ "compilerOptions": {+ "customConditions": []+ },+ "include": ["src"]+}diff --git a/packages/server/tsconfig.json b/packages/server/tsconfig.jsonindex 0ab290dda..d2d39ddb4 100644--- a/packages/server/tsconfig.json+++ b/packages/server/tsconfig.json@@ -2,7 +2,8 @@"extends": "../../tsconfig.json","compilerOptions": {"noEmit": true,- "allowImportingTsExtensions": true+ "allowImportingTsExtensions": true,+ "types": ["node"]},"include": ["src", "*.ts"],"exclude": ["node_modules", "dist", "**/*.test.ts"]diff --git a/packages/server/tsdown.config.ts b/packages/server/tsdown.config.tsindex 602bf5d69..3eb40ed2a 100644--- a/packages/server/tsdown.config.ts+++ b/packages/server/tsdown.config.ts@@ -1,5 +1,18 @@+import type { UserConfig } from 'tsdown';import { defineConfig } from 'tsdown';+const externalizePinoInDts: NonNullable<UserConfig['plugins']> = [+ {+ name: 'externalize-pino-in-dts',+ resolveId(id, importer) {+ if ((id === 'pino' || id.startsWith('pino/')) && importer && /\.d\.[cm]?ts$/.test(importer)) {+ return { id, external: true };+ }+ return null;+ },+ },+];+export default defineConfig({// `parse-worker` must stay its own entry: parse-pool.ts spawns it as a// worker_threads file next to the importing bundle (`./parse-worker.mjs`@@ -8,8 +21,9 @@ export default defineConfig({entry: { index: 'src/index.ts', 'parse-worker': 'src/parse-worker.ts' },unbundle: false,format: 'esm',- dts: false,+ dts: { tsconfig: 'tsconfig.build.json' },clean: true,+ plugins: externalizePinoInDts,deps: {neverBundle: ['@parcel/watcher', 'simple-git'],// The packaged Electron app installs the server into node_modules anddiff --git a/pnpm-lock.yaml b/pnpm-lock.yamlindex ea7b5c257..e9dd35ea2 100644--- a/pnpm-lock.yaml+++ b/pnpm-lock.yaml@@ -24,7 +24,7 @@ overrides:nanoid@3: ~3.3.18nanoid@4: ~5.1.16nanoid@5: ~5.1.16- next@16: ~16.2.11+ next@16: ~16.3.3postcss@8: ~8.5.23[email protected]: ~0.35.0tar@7: ~7.5.21@@ -186,14 +186,14 @@ importers:.:devDependencies:'@biomejs/biome':- specifier: 2.4.15- version: 2.4.15+ specifier: 2.5.11+ version: 2.5.11'@changesets/cli':specifier: ^2.29.7version: 2.31.0(@types/[email protected])- bun-types:- specifier: ^1.3.13- version: 1.3.14+ '@typescript/native':+ specifier: npm:typescript@~7.0.2+ version: [email protected]husky:specifier: ^9.1.7version: 9.1.7@@ -204,14 +204,14 @@ importers:specifier: ^16.4.0version: 16.4.0oxlint:- specifier: 1.66.0- version: 1.66.0([email protected])+ specifier: 1.80.0+ version: 1.80.0([email protected])oxlint-plugin-eslint:- specifier: ^1.66.0- version: 1.73.0+ specifier: ^1.80.0+ version: 1.80.0oxlint-tsgolint:- specifier: ^0.23.0- version: 0.23.0+ specifier: ^7.0.2001+ version: 7.0.2001smol-toml:specifier: ^1.6.1version: 1.7.0@@ -224,6 +224,9 @@ importers:turbo:specifier: ^2.7.0version: 2.10.4+ typescript:+ specifier: ~6.0.3+ version: 6.0.3vitest:specifier: ^4.1.0version: 4.1.10(@opentelemetry/[email protected])(@types/[email protected])([email protected])([email protected](@noble/[email protected]))([email protected](@types/[email protected])([email protected])([email protected])([email protected])([email protected]))@@ -247,19 +250,19 @@ importers:version: 2.0.14'@vercel/microfrontends':specifier: ^2.3.6- version: 2.4.0([email protected](@opentelemetry/[email protected])(@playwright/[email protected])(@types/[email protected])([email protected]([email protected]))([email protected])([email protected]))([email protected]([email protected]))([email protected])([email protected](@types/[email protected])([email protected])([email protected])([email protected])([email protected]))+ version: 2.4.0([email protected](@opentelemetry/[email protected])(@playwright/[email protected])(@types/[email protected])([email protected]([email protected]))([email protected])([email protected]))([email protected]([email protected]))([email protected])([email protected](@types/[email protected])([email protected])([email protected])([email protected])([email protected]))clsx:specifier: ^2.1.1version: 2.1.1fumadocs-core:specifier: ~16.1.0- version: 16.1.0(@types/[email protected])([email protected]([email protected]))([email protected](@opentelemetry/[email protected])(@playwright/[email protected])(@types/[email protected])([email protected]([email protected]))([email protected])([email protected]))([email protected]([email protected]))([email protected])+ version: 16.1.0(@types/[email protected])([email protected]([email protected]))([email protected](@opentelemetry/[email protected])(@playwright/[email protected])(@types/[email protected])([email protected]([email protected]))([email protected])([email protected]))([email protected]([email protected]))([email protected])fumadocs-mdx:specifier: ~14.0.3- version: 14.0.4([email protected](@types/[email protected])([email protected]([email protected]))([email protected](@opentelemetry/[email protected])(@playwright/[email protected])(@types/[email protected])([email protected]([email protected]))([email protected])([email protected]))([email protected]([email protected]))([email protected]))([email protected](@opentelemetry/[email protected])(@playwright/[email protected])(@types/[email protected])([email protected]([email protected]))([email protected])([email protected]))([email protected])([email protected](@types/[email protected])([email protected])([email protected])([email protected])([email protected]))+ version: 14.0.4([email protected](@types/[email protected])([email protected]([email protected]))([email protected](@opentelemetry/[email protected])(@playwright/[email protected])(@types/[email protected])([email protected]([email protected]))([email protected])([email protected]))([email protected]([email protected]))([email protected]))([email protected](@opentelemetry/[email protected])(@playwright/[email protected])(@types/[email protected])([email protected]([email protected]))([email protected])([email protected]))([email protected])([email protected](@types/[email protected])([email protected])([email protected])([email protected])([email protected]))fumadocs-ui:specifier: ~16.1.0- version: 16.1.0(@types/[email protected](@types/[email protected]))(@types/[email protected])([email protected]([email protected]))([email protected](@opentelemetry/[email protected])(@playwright/[email protected])(@types/[email protected])([email protected]([email protected]))([email protected])([email protected]))([email protected]([email protected]))([email protected])([email protected])+ version: 16.1.0(@types/[email protected](@types/[email protected]))(@types/[email protected])([email protected]([email protected]))([email protected](@opentelemetry/[email protected])(@playwright/[email protected])(@types/[email protected])([email protected]([email protected]))([email protected])([email protected]))([email protected]([email protected]))([email protected])([email protected])katex:specifier: ^0.16.22version: 0.16.47@@ -276,8 +279,8 @@ importers:specifier: ~11.16.1version: 11.16.1next:- specifier: ~16.2.11- version: 16.2.11(@opentelemetry/[email protected])(@playwright/[email protected])(@types/[email protected])([email protected]([email protected]))([email protected])([email protected])+ specifier: ~16.3.3+ version: 16.3.3(@opentelemetry/[email protected])(@playwright/[email protected])(@types/[email protected])([email protected]([email protected]))([email protected])([email protected])next-themes:specifier: ^0.4.6@@ -344,7 +347,7 @@ importers:version: 0.4.8fumadocs-typescript:specifier: ~4.0.13- version: 4.0.14(@types/[email protected])([email protected](@types/[email protected])([email protected]([email protected]))([email protected](@opentelemetry/[email protected])(@playwright/[email protected])(@types/[email protected])([email protected]([email protected]))([email protected])([email protected]))([email protected]([email protected]))([email protected]))([email protected](@types/[email protected](@types/[email protected]))(@types/[email protected])([email protected]([email protected]))([email protected](@opentelemetry/[email protected])(@playwright/[email protected])(@types/[email protected])([email protected]([email protected]))([email protected])([email protected]))([email protected]([email protected]))([email protected])([email protected]))([email protected])+ version: 4.0.14(@types/[email protected])([email protected](@types/[email protected])([email protected]([email protected]))([email protected](@opentelemetry/[email protected])(@playwright/[email protected])(@types/[email protected])([email protected]([email protected]))([email protected])([email protected]))([email protected]([email protected]))([email protected]))([email protected](@types/[email protected](@types/[email protected]))(@types/[email protected])([email protected]([email protected]))([email protected](@opentelemetry/[email protected])(@playwright/[email protected])(@types/[email protected])([email protected]([email protected]))([email protected])([email protected]))([email protected]([email protected]))([email protected])([email protected]))([email protected])jsdom:specifier: ^29.1.1version: 29.1.1(@noble/[email protected])@@ -356,7 +359,7 @@ importers:version: 0.3.3schema-dts:specifier: ^2.0.0- version: 2.0.0([email protected])+ version: 2.0.0([email protected])sharp:specifier: ^0.35.3version: 0.35.3(@types/[email protected])@@ -367,8 +370,8 @@ importers:specifier: ^4version: 4.3.2typescript:- specifier: ^5.7- version: 5.9.3+ specifier: ~7.0.2+ version: 7.0.2packages/app:dependencies:@@ -587,7 +590,7 @@ importers:version: 4.4.0frimousse:specifier: ^0.3.0- version: 0.3.0([email protected])([email protected])+ version: 0.3.0([email protected])([email protected])fuzzysort:specifier: ^3.1.0version: 3.1.0@@ -653,7 +656,7 @@ importers:version: 1.3.0shadcn:specifier: ^4.2.0- version: 4.13.0([email protected])+ version: 4.13.0([email protected])shiki:specifier: ^3.23.0version: 3.23.0@@ -705,7 +708,7 @@ importers:version: 6.5.0'@lingui/cli':specifier: ^6.0.1- version: 6.5.0([email protected])([email protected])+ version: 6.5.0([email protected])([email protected])'@lingui/format-po':specifier: ^6.0.1version: 6.5.0@@ -723,7 +726,7 @@ importers:version: 1.59.1'@rolldown/plugin-babel':specifier: ^0.2.2- version: 0.2.2(@babel/[email protected])(@babel/[email protected])([email protected])([email protected](@types/[email protected])([email protected])([email protected])([email protected])([email protected]))+ version: 0.2.2(@babel/[email protected])(@babel/[email protected])([email protected])([email protected](@types/[email protected])([email protected])([email protected])([email protected])([email protected]))'@size-limit/preset-app':specifier: ^12.1.0version: 12.1.0([email protected]([email protected]))@@ -756,7 +759,7 @@ importers:version: 8.18.1'@vitejs/plugin-react':specifier: ^6.0.1- version: 6.0.1(@rolldown/[email protected](@babel/[email protected])(@babel/[email protected])([email protected])([email protected](@types/[email protected])([email protected])([email protected])([email protected])([email protected])))([email protected])([email protected](@types/[email protected])([email protected])([email protected])([email protected])([email protected]))+ version: 6.0.1(@rolldown/[email protected](@babel/[email protected])(@babel/[email protected])([email protected])([email protected](@types/[email protected])([email protected])([email protected])([email protected])([email protected])))([email protected])([email protected](@types/[email protected])([email protected])([email protected])([email protected])([email protected]))axe-core:specifier: ~4.12.1version: 4.12.1@@ -786,7 +789,7 @@ importers:version: 0.2.117memlab:specifier: 2.0.2- version: 2.0.2([email protected])+ version: 2.0.2([email protected])remark-mdx:specifier: ^3.1.1version: 3.1.1@@ -803,8 +806,8 @@ importers:specifier: ^28.0.0version: 28.0.0typescript:- specifier: ^5.9.3- version: 5.9.3+ specifier: ~7.0.2+ version: 7.0.2unified:specifier: ^11.0.5version: 11.0.5@@ -903,11 +906,11 @@ importers:specifier: ^3.0.1version: 3.0.1([email protected])tsdown:- specifier: ^0.21.7- version: 0.21.10([email protected])([email protected])+ specifier: ^0.22.14typescript:- specifier: ^5.9.3- version: 5.9.3+ specifier: ~7.0.2+ version: 7.0.2optionalDependencies:'@parcel/watcher':specifier: ^2.5.6@@ -1145,11 +1148,11 @@ importers:specifier: ^2.0.1version: 2.0.1tsdown:- specifier: ^0.21.7- version: 0.21.10([email protected])([email protected])+ specifier: ^0.22.14typescript:- specifier: ^5.9.3- version: 5.9.3+ specifier: ~7.0.2+ version: 7.0.2y-prosemirror:specifier: 1.3.7version: 1.3.7(patch_hash=b77fc38bdf246f08f73b6bc5d12ec24d29408b663f0a4224758d3f776ef124e7)([email protected])([email protected])([email protected])([email protected]([email protected]))([email protected])@@ -1204,7 +1207,7 @@ importers:version: 1.59.1'@rolldown/plugin-babel':specifier: ^0.2.2- version: 0.2.2(@babel/[email protected])(@babel/[email protected])([email protected])([email protected](@types/[email protected])([email protected])([email protected])([email protected])([email protected]))+ version: 0.2.2(@babel/[email protected])(@babel/[email protected])([email protected])([email protected](@types/[email protected])([email protected])([email protected])([email protected])([email protected]))'@types/node':specifier: ^24.7.0version: 24.13.3@@ -1213,7 +1216,7 @@ importers:version: 7.7.1'@vitejs/plugin-react':specifier: ^6.0.1- version: 6.0.1(@rolldown/[email protected](@babel/[email protected])(@babel/[email protected])([email protected])([email protected](@types/[email protected])([email protected])([email protected])([email protected])([email protected])))([email protected])([email protected](@types/[email protected])([email protected])([email protected])([email protected])([email protected]))+ version: 6.0.1(@rolldown/[email protected](@babel/[email protected])(@babel/[email protected])([email protected])([email protected](@types/[email protected])([email protected])([email protected])([email protected])([email protected])))([email protected])([email protected](@types/[email protected])([email protected])([email protected])([email protected])([email protected]))babel-plugin-react-compiler:specifier: 0.0.0-experimental-a8e64ef-20260402version: 0.0.0-experimental-a8e64ef-20260402@@ -1233,8 +1236,8 @@ importers:specifier: ^28.0.0version: 28.0.0typescript:- specifier: ^5.7.2- version: 5.9.3+ specifier: ~7.0.2+ version: 7.0.2vite:specifier: ^8.0.0version: 8.0.8(@types/[email protected])([email protected])([email protected])([email protected])([email protected])@@ -1386,6 +1389,9 @@ importers:'@types/mdast':specifier: ^4.0.4version: 4.0.4+ '@types/node':+ specifier: ^24.7.0+ version: 24.13.3'@types/shell-quote':specifier: ^1.7.5version: 1.7.5@@ -1405,11 +1411,11 @@ importers:specifier: ^28.0.0version: 28.0.0tsdown:- specifier: ^0.21.7- version: 0.21.10([email protected])([email protected])+ specifier: ^0.22.14typescript:- specifier: ^5.9.3- version: 5.9.3+ specifier: ~7.0.2+ version: 7.0.2optionalDependencies:'@parcel/watcher':specifier: ^2.5.6@@ -1468,10 +1474,6 @@ packages:resolution: {integrity: sha512-DkXD5OJQaAQIdZ1bt3UZdEnHAn9Imd3IVBdX03UFe+ony9Ojw5pzr9YVKGDY1jt+Gcn/FnGkNf8r+Vj5NOJWtQ==}engines: {node: '>=6.9.0'}- '@babel/[email protected]':- resolution: {integrity: sha512-em37/13/nR320G4jab/nIIHZgc2Wz2y/D39lxnTyxB4/D/omPQncl/lSdlnJY1OhQcRGugTSIF2l/69o31C9dA==}- engines: {node: ^20.19.0 || >=22.12.0}-'@babel/[email protected]':resolution: {integrity: sha512-OoK6239jHPuSQOoS0kfTVKn0b/rVTk0seKq4Gd2UMLtmOVLjDC0ki3e+c90Trqv2gMfvJFqkiljrr568+qddiw==}engines: {node: '>=6.9.0'}@@ -1526,22 +1528,10 @@ packages:resolution: {integrity: sha512-Pb5ijPrZ89GDH8223L4UP8i6QApWxs04RbPQJTeWDV0/keR2E36MeKnyr6LYmUUvqRRI+Iv87SuF1W6ErINzYw==}engines: {node: '>=6.9.0'}- '@babel/[email protected]':- resolution: {integrity: sha512-6mJgmFFFIIO82vvoLt9XtRC7/TkzXfts1t/SpRX4IHSzMgqoPYCWesVu1udUPUWioAE/2fcG6WuI8zrkE1gwrg==}- engines: {node: ^22.18.0 || >=24.11.0}-'@babel/[email protected]':resolution: {integrity: sha512-qehxGkRj55h/ff8EMaJ+cYhyaKlHIxqYDn682wQD7RNp9UujOQsHog2uS0r2vzr4pW+sXf90NeeayjcNaX3fFg==}engines: {node: '>=6.9.0'}- '@babel/[email protected]':- resolution: {integrity: sha512-8AWCJ2VJJyDFlGBep5GpaaQ9AAaE/FjAcrqI7jyssYhtL7WGV0DOKpJsQqM037xDbpRLHXsY8TwU7zDma7coOw==}- engines: {node: ^20.19.0 || >=22.12.0}-- '@babel/[email protected]':- resolution: {integrity: sha512-4wFaiLd0bVo4cIoTXI3zKI038NIWE/cr3jvBjejOVYVxV/m8Ltav1USiGzG1fmS5J2RhgEOgXNNK46cRPnRsrg==}- engines: {node: ^22.18.0 || >=24.11.0}-'@babel/[email protected]':resolution: {integrity: sha512-N9ZErrD+yW5geCDtBqnOoxmR8+tNKiGuxKlDpuJxfsqpa2dFcexaziGAE/qoHLiDDreVNMupxGmSoNlyvsA3gw==}engines: {node: '>=6.9.0'}@@ -1555,16 +1545,6 @@ packages:engines: {node: '>=6.0.0'}hasBin: true- '@babel/[email protected]':- resolution: {integrity: sha512-B20dvP3MfNc/XS5KKCHy/oyWl5IA6Cn9YjXRdDlCjNmUFrjvLXMNUfQq/QUy9fnG2gYkKKcrto2YaF9B32ToOQ==}- engines: {node: ^20.19.0 || >=22.12.0}- hasBin: true-- '@babel/[email protected]':- resolution: {integrity: sha512-srpptsAkEbbNIC/q8nT7o+m6CQe8CJUTV/t7MYc9NnWlgYVtHOb7JH6SorxMhN0kuRJjVqXbKClG6xSbPtzz+g==}- engines: {node: ^22.18.0 || >=24.11.0}- hasBin: true-'@babel/[email protected]':resolution: {integrity: sha512-TSu8+mHCoEaaCDEZ0I3+6mvTBYR4PCxQwf2z9/r5Tbztv6NaLR3B9thGTTxX2WGuGHJqRiAbKPeGTJ5XWXVg6A==}engines: {node: '>=6.9.0'}@@ -1617,67 +1597,59 @@ packages:resolution: {integrity: sha512-4zBIxpPzowiZpusoFkyGVwakdRJUyuH5PxQ/PrqghfdFWWasvnCdPfQXHrenDai+gyLARulZjZowCOj6fjT4pA==}engines: {node: '>=6.9.0'}- '@babel/[email protected]':- resolution: {integrity: sha512-mOm5ZrYmphGfqVWoH5YYMTITb3cDXsFgmvFlvkvWDMsR9X8RFnt7a0Wb6yNIdoFsiMO9WjYLq+U/FMtqIYAF8Q==}- engines: {node: ^20.19.0 || >=22.12.0}-- '@babel/[email protected]':- resolution: {integrity: sha512-eY+Yn3dCqTGmyiq2QRU66lA5FL8lqqqvecHt0fF3uHONIa7ToYsaCiWV8lOKqAs0Rb2SjixiKFROngnulPtt2g==}- engines: {node: ^22.18.0 || >=24.11.0}-- '@biomejs/[email protected]':- resolution: {integrity: sha512-j5VH3a/h/HXTKBM50MDMxRCzkeLv9S2XJcW2WgnZT1+xyisi+0bISrXR82gCX+8S9lvK0skEvHJRN+3Ktr2hlw==}+ '@biomejs/[email protected]':+ resolution: {integrity: sha512-Tj0dnkLPdW0ASjHfj2D/ZkkvPU2wrFmnE1jWTD2xzV1ycapV1DutbYXk4NDnR3rYTi1ZCbNFD4G2gRMEY65WaA==}engines: {node: '>=14.21.3'}hasBin: true- '@biomejs/[email protected]':- resolution: {integrity: sha512-rF3PPqLq1yoST79zaQbDjVJwsuIeci/O+9bgNmC5QpgOqz6aqYuzA4abyAGx+mgyiDXn4A049xAN8gijbuR1Qg==}+ '@biomejs/[email protected]':+ resolution: {integrity: sha512-6SGZxoKbXvUjMn1t6A98HqWISPnGNbYs0R/Rt2JarmXBSev+lva4QxUMWEBX9lX1Wo1XTJ78uk5xVDtG58SRZg==}engines: {node: '>=14.21.3'}cpu: [arm64]os: [darwin]- '@biomejs/[email protected]':- resolution: {integrity: sha512-/5KHXYMfSJs1fNXiX30xFtI8JcCFV6zaVVLxOa0M2sfqBKHkpQhRTv94yxQWxeTY2lzo2OuTlNvPC+hDQt2wcQ==}+ '@biomejs/[email protected]':+ resolution: {integrity: sha512-nYkXY7tLBEgnGbYapDKAyKzgt44ZEyG+AKalvTXtCWKYgepI9dw327q+cVgedxm+Udi1ZzHKUyZrIusHi/KQbw==}engines: {node: '>=14.21.3'}cpu: [x64]os: [darwin]- '@biomejs/[email protected]':- resolution: {integrity: sha512-ZPcxznxm0pogHBLZhYntyR3sR+MrZjqJIKEr7ZqVen0Rl+P/4upVmfYXjftizi9RoqZntg33fv/1fbdhbYXpEQ==}+ '@biomejs/[email protected]':+ resolution: {integrity: sha512-qhyZUMyCbWYFV2bAwRNVvfMVZ+hv7WYl6mossGrxC+uiQQXhvsuWWU8zz6jYX0mChZd9MgQZbm4vozTmG/5iGw==}engines: {node: '>=14.21.3'}cpu: [arm64]os: [linux]libc: [musl]- '@biomejs/[email protected]':- resolution: {integrity: sha512-owaAMZD/T4LrD0ELNCk0Km3qrRHuM0X6EAyVE1FSqGY0rbLoiDLrO4Us2tllm6cAeB2Ioa9C2C08NZPdr8+0Ug==}+ '@biomejs/[email protected]':+ resolution: {integrity: sha512-3PVLSTD9RR73rvVPt5G3T1gc+ycggWEGfTD7RvzzbtcDPD27NxgxBbAFfpm7DXJKW6VLHWE1lLMGvFt2Qxjcow==}engines: {node: '>=14.21.3'}cpu: [arm64]os: [linux]libc: [glibc]- '@biomejs/[email protected]':- resolution: {integrity: sha512-CNq/9W38SYSH023lfcQ4KKU8K0YX8T//FZUhcgtMMRABDojx5XsMV7jlweAvGSl389wJQB29Qo6Zb/a+jdvt+w==}+ '@biomejs/[email protected]':+ resolution: {integrity: sha512-oRRlrchG5EfrEL/EmtT1qUjSNHk3/5LGeZhQqADBBAJF1b1ET6964xEKe7aGlGARzDfza8H/seEsFJl7S6Ql9w==}engines: {node: '>=14.21.3'}cpu: [x64]os: [linux]libc: [musl]- '@biomejs/[email protected]':- resolution: {integrity: sha512-0jj7THz12GbUOLmMibktK6DZjqz2zV64KFxyBtcFTKPiiOIY0a7vns1elpO1dERvxpsZ5ik0oFfz0oGwFde1+g==}+ '@biomejs/[email protected]':+ resolution: {integrity: sha512-JOytptlsgM33B2MMFUg8iBrb4IKpbD5JnJrSeYiaFEeAj4vuXx0iQSQZ4qK7sqyMtfjZxxPdNdMZZVL4y/mFyA==}engines: {node: '>=14.21.3'}cpu: [x64]os: [linux]libc: [glibc]- '@biomejs/[email protected]':- resolution: {integrity: sha512-ouhkYdlhp/1GghEJPdWwD/Vi3gQ1nFxuSpMolWsbq3Lsq3QUR4jl6UdhhscdCugKU5vOEuMiJhvKj66O0OCq+w==}+ '@biomejs/[email protected]':+ resolution: {integrity: sha512-e49E6K9hzH/ohJNx8Y26mY8HaV4I4ZViIeoqhKsmoXLKHhQnMeBAVqCgsGf2Wa3lXlS7RkporDXMHHWkzvZzFw==}engines: {node: '>=14.21.3'}cpu: [arm64]os: [win32]- '@biomejs/[email protected]':- resolution: {integrity: sha512-zBrGq5mx5wwpnow4+2BxUvleDM+GNd4sLbPaMapsSLQLD0NGRCquqPBTgN+7XkUteHvj7M+BstuI8tmnV7+HgQ==}+ '@biomejs/[email protected]':+ resolution: {integrity: sha512-QSQr/KjOgXA7OzXJUWS+oguKyAZ3Q0l/lnlDGbu397eKo83atuWUjBPJrsqbKNF6CARGw8XXJLGzpHC8Ryhd4Q==}engines: {node: '>=14.21.3'}cpu: [x64]os: [win32]@@ -3443,57 +3415,57 @@ packages:'@next/[email protected]':resolution: {integrity: sha512-8tuaQkyDVgeONQ1MeT9Mkk8pQmZapMKFh5B+OrFUlG3rVmYTXcXlBetBgTurKXGaIZvkoqRT9JL5K3phXcgang==}- '@next/[email protected]':- resolution: {integrity: sha512-0do5A3BJ2gxWr0ZCMcD6BhW+e595jyxdTl3rXTS6lOtD8ektMiW6CO+EPwt1Eca1DBnm90r/7GdiKWBKxH++DA==}+ '@next/[email protected]':+ resolution: {integrity: sha512-U2eYQRwXj+dsqxV79zFqExDdatnNY/ZWc2nsJU1p/OgT7fd3dXwlF6OjYaFQCfMoeTA19PWq+wVmYgimVA+V+g==}- '@next/[email protected]':- resolution: {integrity: sha512-wryL4pjKmDwGv2ox6+GZDFxvmtSRLqApBR8kL1j4+vhB7Z5vJC/zAnXpiR9Xkfzl0AS8WLMnsuGV/UKI67/rrw==}+ '@next/[email protected]':+ resolution: {integrity: sha512-8Hiv32QJPwdV6KYJ8meR9SBA061tQqnIKTJDocvOXlEQqib0xMFpzArosuffFUUc0sslbh7QQ8a3Yey1QV8EIw==}engines: {node: '>= 10'}cpu: [arm64]os: [darwin]- '@next/[email protected]':- resolution: {integrity: sha512-aZl2j4f/fLyjQvOhv0Oe9UaMAQHolYpKhctsoYzplSumKJKPUmgjcf6545aBtysLTcu994TREd0+pSgNE4ohmg==}+ '@next/[email protected]':+ resolution: {integrity: sha512-A1lgKgwVchRYmSe467zdwhxT9040dd8lH+o65sL5Jet8fjB4kegw/rDyPIpYVRb6jAqwXFOJpjIXJLxQKLiE3A==}engines: {node: '>= 10'}cpu: [x64]os: [darwin]- '@next/[email protected]':- resolution: {integrity: sha512-5jEriyEnH/LWFy27L2ZG0XaLlyEJIjhsImEsiS9P563PKEVp2BVups/xfOucIrsvVntp11oNcZwjHvaDPYVB5g==}+ '@next/[email protected]':+ resolution: {integrity: sha512-bf0FIssMFueU2dm7vQEWWxk0c8UjKTdW0yzuh0sQsD8pf1+KCLDdaqhYZNMYGmXwEOiHAUzgBKudovIlcvvBjg==}engines: {node: '>= 10'}cpu: [arm64]os: [linux]libc: [glibc]- '@next/[email protected]':- resolution: {integrity: sha512-eIjcpx2fnnFSSkZDbTxy74KnokUXDjfoLClpWelfgHLf621aTqswhwXQ7GkD5K5rplrS6LZ/Bj+mVuvzluBOEg==}+ '@next/[email protected]':+ resolution: {integrity: sha512-W7viwCk9JY/cAkdz/A273rd5bb3RgT/IHwR7Upv90tunjBWNtAAhGhoecHh+teRNRSinuAFmE+l7fwZ4YKkrXg==}engines: {node: '>= 10'}cpu: [arm64]os: [linux]libc: [musl]- '@next/[email protected]':- resolution: {integrity: sha512-8WgzpaWMs46qJT9kiV47cje86L0x/Mu9t8/Gwj+pnbgW3rETVfCnaScPjlYUwNScpOozdcIMHWmAvuZJUonR2w==}+ '@next/[email protected]':+ resolution: {integrity: sha512-0W46zw1N3ODpI6n0GeivHvvob1pooozgZVqy65k0mh4/7vr+FbY9+WpHzNVXjHipJf/A3FDheBG19H1s5A25rA==}engines: {node: '>= 10'}cpu: [x64]os: [linux]libc: [glibc]- '@next/[email protected]':- resolution: {integrity: sha512-I3UgPds7G4ZYnTb/H+5GBGuUT2DhAk6j0mL6A4s63RjFs74wB2hOWP0vaxsK+3NJraExt3eYEPQ/UtT0x/64Nw==}+ '@next/[email protected]':+ resolution: {integrity: sha512-H4mBso8ZTMBPtdT0PN0pBx2ayTvQuTuvS6qT13d77yVFJXAPCxkyIhLTmdMaGTJs0krQYI/qpzdHijCeihXhbg==}engines: {node: '>= 10'}cpu: [x64]os: [linux]libc: [musl]- '@next/[email protected]':- resolution: {integrity: sha512-n89CjtcThnjrwgJMAiI5xbqwLY51zvwC9tSlArmVndAJLYVl9T9UAdlkXTmZvE++idoXe8KdglQlhNRdUp1c6g==}+ '@next/[email protected]':+ resolution: {integrity: sha512-cTMUJpcEGmeywofCUfhR+rSsoE33+rVPnPEYNTNdLNlsOeEg/vktOsKUSTb28vUGqD2jkm4Zaskcwn7OCI6FQg==}engines: {node: '>= 10'}cpu: [arm64]os: [win32]- '@next/[email protected]':- resolution: {integrity: sha512-md8CLNggS1Dx9pUgApzps5uAf+N8GN9xywzmNx9vHAWo94HtBwCCqkSnhIrdfQe83Dhz8Lfo/20Nb1Zxal092w==}+ '@next/[email protected]':+ resolution: {integrity: sha512-2VR4cTBzHXaBjnGsuH6GyJjENzQOmHeAh11uY1iUhjm3j5dEUrVJuUj+VL78jaGi/Dik8xS76zEj18BsFhlVZQ==}engines: {node: '>= 10'}cpu: [x64]os: [win32]@@ -3858,8 +3830,8 @@ packages:'@oxc-project/[email protected]':resolution: {integrity: sha512-WT+Gb24i8hmvo85AIv2oEYouEXkRlKAlT9WaCa3TfLgNCN+GhrJOGZuIlMouAh38Qe4QOx26eUOVsq70qXrywA==}- '@oxc-project/[email protected]':- resolution: {integrity: sha512-r9gHphtCs+1M7J0pw6Sn/hh/Wpa/iQrOOkrNAlVLF/gHq+/CJmHIWKKUUhdWjcD6CIa8idarspCsASiXCXvFUw==}+ '@oxc-project/[email protected]':+ resolution: {integrity: sha512-IJ3s6ltHLp45S0bh7phkX+gJO7A1Wuz2EaqpAhb8WjqDwbzMiWKHhyyT42tskaWjEYXtHtVCPpnBJVT9+dcRLg==}'@oxc-resolver/[email protected]':resolution: {integrity: sha512-eNU11A2WNizh04v3uyaJCootrHIaS0B9aHYXvAvVnPNk4xYSjMUjHnhQ6dewPN2MRYDskV85d1N0Aw0WNWhcyg==}@@ -3964,154 +3936,154 @@ packages:cpu: [x64]os: [win32]- '@oxlint-tsgolint/[email protected]':- resolution: {integrity: sha512-gOs9PVr2wEg4ox9z0aJo+RKhhImW86YL5N6yav8BK/rgPsIrwN/igSZ+pbRr723NFvUNKde9fgMhRA6JrXAOZw==}+ '@oxlint-tsgolint/[email protected]':+ resolution: {integrity: sha512-CUJEdbSZ54+Xy9OXqOhWLTKZKV0BBiV7C2i/ygyVmXtkUNXx5YCzN8DpSSshTAKktoL7S+tnQ/ftFG/i7X896w==}cpu: [arm64]os: [darwin]- '@oxlint-tsgolint/[email protected]':- resolution: {integrity: sha512-kjJ8B+7n4tB9VJdxS5A9GdJt6/bYpzbu4lXp2uO1S3sRmCB5gDEABlGoiePNApRWaW+xqL4b4xgiE727jSLhuA==}+ '@oxlint-tsgolint/[email protected]':+ resolution: {integrity: sha512-pXfBb5BqONCcgrXQNUZWXgiYmRSWJzd97S8i41VVOh6ut0tyo+cJ5FKFpczDHxiVNfj/3e7c9B4MtztNdpIVCw==}cpu: [x64]os: [darwin]- '@oxlint-tsgolint/[email protected]':- resolution: {integrity: sha512-6dCZuKNu135seMXilkRk9SpCx6i1XgmiipYGalLij5WVRX6ZYS8c4xI7preN/zv9fCXhsQclTIMDu2Y/cytTjw==}+ '@oxlint-tsgolint/[email protected]':+ resolution: {integrity: sha512-roP7zujb/QDPzDwEKsFFpzNHHy91/Y7oX9vQXk78ekyZtcQj1QXDIMH33gjDdHBfRl4K9pZ36xhRgrP4Zr+R8A==}cpu: [arm64]os: [linux]- '@oxlint-tsgolint/[email protected]':- resolution: {integrity: sha512-3bdilnyA7kmSTjK27rvjIjSxL5SIg3wt7vwNiRkouWB83ytssyKnuGvxSYJxgMEmFpSutzaBzcCUM2jDtPGcgA==}+ '@oxlint-tsgolint/[email protected]':+ resolution: {integrity: sha512-UDezNqdECVmngu2TPnjaS1YoAmcTaBoI5lV9vk3VahBxoi+I5r9k3iJTT7qZoYWOXTD/7T7bNcwRgrocR6BscQ==}cpu: [x64]os: [linux]- '@oxlint-tsgolint/[email protected]':- resolution: {integrity: sha512-j+OEp44SVYiQ+ZD+uttsX7u6L9SvmbbQ77SO1pSFCcJlsVMeCk8qZsjhKfGKuT/jIA+ipOJMVs/+pqUfObBWNw==}+ '@oxlint-tsgolint/[email protected]':+ resolution: {integrity: sha512-uJZhqB6pdXLuN+AD1F5082byyQti/NPmJA77GtcFlmT2HzRelqbNls3SaIqxpjdFgvSBF9g0yOKGBkGFg7kX8Q==}cpu: [arm64]os: [win32]- '@oxlint-tsgolint/[email protected]':- resolution: {integrity: sha512-5MyjFuqf+g8OUPJBSGWHJtmoWnzFJYyOg4To9WMQshZYEWig/vtu7JtJ03VWnzHv9LJkAUeApY0gVCOywFR/iQ==}+ '@oxlint-tsgolint/[email protected]':+ resolution: {integrity: sha512-FkDRm8hx9OwzGQqyWG1tO5QrTLRApff9DzSgpz9QZau37BR8d1VYKOxMLGf6shPZntJFoTwIIJYT68VndYDCog==}cpu: [x64]os: [win32]- '@oxlint/[email protected]':- resolution: {integrity: sha512-f7kq8N51T4phpzqfBpA2qaVTI/KrkCmNwaj3t/97I/WLTDI+UhlP5GL9eER+zVxBhtlx5rKXWByJU1/zDAvyaw==}+ '@oxlint/[email protected]':+ resolution: {integrity: sha512-RM3Plj+biQpxa5d1GOOX6ciDlcUROmm4OZ/pLTpitkQt2mJv4jhtY4cbgaetOm5UKWZe05/TGQ6o1Vl8EOHkrA==}engines: {node: ^20.19.0 || >=22.12.0}cpu: [arm]os: [android]- '@oxlint/[email protected]':- resolution: {integrity: sha512-xu6QO71tdDS9mjmLZ3AqhtaVHBvdmsOKkYnReNNDgh+XiwnsipeQOIxbiYOOO0iAXycJ+GK0wdMSZP/2j/AmSg==}+ '@oxlint/[email protected]':+ resolution: {integrity: sha512-YlO5JEf0Yr2bUUlu8O8daVcUxtcGGbcSmyV7E7nSbJbfAdxTE0PFPwgnIlw7wXJaTYjb+qs5hI5q3jxUkI7cAw==}engines: {node: ^20.19.0 || >=22.12.0}cpu: [arm64]os: [android]- '@oxlint/[email protected]':- resolution: {integrity: sha512-HZ24VimSOC7mxuEA99e0H2FS0C1yO3+iW13jPRAk+e2njsUs3QeAXsafCDyaIrV/MirdOVez+etQNQsJE43zNQ==}+ '@oxlint/[email protected]':+ resolution: {integrity: sha512-BULDOyO3AhsmdWfQeIUCykDt3dd7XZBGLhp1eIh56skRv01O+cNjNPwXMIbeW1x4+pxcln5if72wcRgViVo7PA==}engines: {node: ^20.19.0 || >=22.12.0}cpu: [arm64]os: [darwin]- '@oxlint/[email protected]':- resolution: {integrity: sha512-awhj8ZvJrrRSnXj7V++rpZvTmnl99L6mi0B7gg7Cp7BN6cKpzuI481bHNLvXGA9GB1/oEgA3ponuyoAc6Md12A==}+ '@oxlint/[email protected]':+ resolution: {integrity: sha512-YJ4JzLw7N5TDSQFlA0hAQGHvnDZgyypm1yunObVWcWiF9KM7eGCJKYKLgTC2Fi/57OdnBhbj4OkzPGdFQJ6HyA==}engines: {node: ^20.19.0 || >=22.12.0}cpu: [x64]os: [darwin]- '@oxlint/[email protected]':- resolution: {integrity: sha512-KQF0oVV21/FjIqkRuL8Q1vh8ECsE5+ocdH5tcqTQ4ZnYuDVoYibQUNfqBjQaUsP6UIIda5Y75Wpm5p4RgQWiWw==}+ '@oxlint/[email protected]':+ resolution: {integrity: sha512-AYUIk5QnL0s8oWAYsREZwkRYy1SupJTXALo93J1TgzHywxQtdM99FecRMQ87MXEdPQ0j1TmEpeeq3fGNkpvMqg==}engines: {node: ^20.19.0 || >=22.12.0}cpu: [x64]os: [freebsd]- '@oxlint/[email protected]':- resolution: {integrity: sha512-9u1rgwZSEXWb30vbFZzQ78HVXBo0WCKNwJ3a2InRUTNMRng+PUDIoSFmA+m4HdUfBaIqftShq8J8qHc+eE/Vig==}+ '@oxlint/[email protected]':+ resolution: {integrity: sha512-9hBZVANupQ89W9dXyE0n8doCyaW5pDyGn3y6XlIMPZ+rIKuyqkr3SNUXmVJIhuvUq0NBU3RBiSXXE69l4XI6KA==}engines: {node: ^20.19.0 || >=22.12.0}cpu: [arm]os: [linux]- '@oxlint/[email protected]':- resolution: {integrity: sha512-Ynot2HR1bHxUaNWoC280MVTDfZuaWuP3XfSMRDhyuZrVjhzoaBCVFlw8h8qeZjWKVUBhPWFIxB7AQTlK8Z2WWg==}+ '@oxlint/[email protected]':+ resolution: {integrity: sha512-SvS2uKqzY+pbfuvAHzH4338R6Zwo805GAwrIMVvK1KxoOWCIjZUdfzTCvilD7z6JK91v011+zYMryabhDo2AsQ==}engines: {node: ^20.19.0 || >=22.12.0}cpu: [arm]os: [linux]- '@oxlint/[email protected]':- resolution: {integrity: sha512-xCbgzciGgo+A4aQZEknsNrNiIwY7sU5SfRuMmRjPIvZAgdF34cIHiKvwOsS5XRLjlTVSFwitmq6YclTtHTfU+g==}+ '@oxlint/[email protected]':+ resolution: {integrity: sha512-tCLadyqRVL3pQTRPNg7cjXKvcvS4fbyXeQHhKk5BTJ1oftQln5/yIIWbu/Xom/DX41zv2P9QGt6+D/TtQVtY3A==}engines: {node: ^20.19.0 || >=22.12.0}cpu: [arm64]os: [linux]libc: [glibc]- '@oxlint/[email protected]':- resolution: {integrity: sha512-hmo+ZB/lHkR1HdDmnziNpzSLmulnUSu10VEqX2Yex7OwvoBAbjJQLvy4gIBRV3AAwWnCvAxKp5Nv1GE6LU1QMg==}+ '@oxlint/[email protected]':+ resolution: {integrity: sha512-XfpCNRlOPcLlJl4Bn/FUhjqlR6BVavEykERBf/MV7YA9VZDa5g5znVqYhyviMafcxS9Pe/i/kPvHNO0U6svEHQ==}engines: {node: ^20.19.0 || >=22.12.0}cpu: [arm64]os: [linux]libc: [musl]- '@oxlint/[email protected]':- resolution: {integrity: sha512-2Invd4Uyy81mVooQC5FBtfxSNrvcX1OxbMlVQ6M2erRrNI2awFYF26YNW2yFxdVFZ4ffNOWKghtMjhnUPsXsVA==}+ '@oxlint/[email protected]':+ resolution: {integrity: sha512-3I4yMwcFG9NeO8ioY6JBBuKsIm5GL/x7MATt1S4tVWaxPu5HcJ+XnLUbcVBTxG8q2Wu56HSj+NmXQiVYb1lp6A==}engines: {node: ^20.19.0 || >=22.12.0}cpu: [ppc64]os: [linux]libc: [glibc]- '@oxlint/[email protected]':- resolution: {integrity: sha512-s0iXPDQVdgayE3RGa/N2DZF7tjgg0TwEtD1sGoDxqPDGrIXgo45H0yHknT0f9A0yteASsweYZtDyTuVlM4aSag==}+ '@oxlint/[email protected]':+ resolution: {integrity: sha512-E1wAKymkpe1/E8helzBKdm81OBOF+ezxRyXRMEuik3ZpWDER5CPOKZwF66RsdwW98uwZv8UTFremUQtC1CzdJA==}engines: {node: ^20.19.0 || >=22.12.0}cpu: [riscv64]os: [linux]libc: [glibc]- '@oxlint/[email protected]':- resolution: {integrity: sha512-OekL4XFiu7RPK0JIZi8VeHgtIXPREf42t8Cy/rKEsC+P3gcqDgNAAGiyuUOpdbG4wwbfue1q4CHcCO7spSve6w==}+ '@oxlint/[email protected]':+ resolution: {integrity: sha512-+gLRGD4sIo3+VA++iham5UxD9tKSoJ/VOrROCEXIcknrYtQg6iIQgvjN0cpiRF7N6UYC7pJbvHJlDnMge5LRpQ==}engines: {node: ^20.19.0 || >=22.12.0}cpu: [riscv64]os: [linux]libc: [musl]- '@oxlint/[email protected]':- resolution: {integrity: sha512-Ga1D0kj1SFslm34ThA/BdkUlyAYEnTsXyRC4pF0C5agZSwtGdHYWMTQWemUfBGp4RCG4QWXgdO+HmmmKqOtlBg==}+ '@oxlint/[email protected]':+ resolution: {integrity: sha512-aR0PrzHj9leW3NmzBAAP4EzdoBNoJcs9sjnIQPIwyRnBGYrRbXUIpEB5Q39AqK3PLY5JK5uEhDQDiUa1QSAstw==}engines: {node: ^20.19.0 || >=22.12.0}cpu: [s390x]os: [linux]libc: [glibc]- '@oxlint/[email protected]':- resolution: {integrity: sha512-p5jfP1wUZe/IC3qpQO84n9DRnf9g3lKRtLBlQq23ykyrDglHcVx7sWmVTlPuU6SBw8mNnPzyOn022G3XZHnlww==}+ '@oxlint/[email protected]':+ resolution: {integrity: sha512-vSVh5cSo3Xxs6ghBCcFJlpbkbENzDog1qXtoXLa/HC3aCrR4XO76GZbXmQoCPHnu99nQpdCeC3H9tdNICfDh7A==}engines: {node: ^20.19.0 || >=22.12.0}cpu: [x64]os: [linux]libc: [glibc]- '@oxlint/[email protected]':- resolution: {integrity: sha512-vUB/sYlYZorDL1ZD+o9mRv7zbsykrrFRtmgS6R8musZqLtrPRQn1gc1eGpuX+sfdccz42STl/AqldY6XRb2upQ==}+ '@oxlint/[email protected]':+ resolution: {integrity: sha512-FfzBXpNQ8u7/ZI/p8bl73MeZ508Ax3hxWp3SiJpEFiC+BB9XcXy5FAZHTLKDPSzrUpxQZSZJAVdDmuJp/+HDBQ==}engines: {node: ^20.19.0 || >=22.12.0}cpu: [x64]os: [linux]libc: [musl]- '@oxlint/[email protected]':- resolution: {integrity: sha512-yde+6p/F59xRkGR9H1HfngWRif1QRJjynZK349l+UI0H6w9hL3G8/AVaTHFyTtLVQ56qtNbX2/5Dc77n1ovnOg==}+ '@oxlint/[email protected]':+ resolution: {integrity: sha512-zMzbkumtmprCgRwoYNzcB3iC39fXdJIMLMU33KdCjEGLlJGOEt1+LwQ4LF8ndLzAEKVz4BR0y3V6Xrkk3Nm3yA==}engines: {node: ^20.19.0 || >=22.12.0}cpu: [arm64]os: [openharmony]- '@oxlint/[email protected]':- resolution: {integrity: sha512-O9GLucgoTdmOrbBX+EjzNe7o/Ze5TFOvXcib6bzUOtBOmj6cV+zw18NgB+cGKAkDw1Pdqs8vGkfHbbsLuDtXWg==}+ '@oxlint/[email protected]':+ resolution: {integrity: sha512-ib6iRcrXsk4t1fm3iKcwksyWh1ZkZXC/2mEzakl0ai2+6HZunf1WWMZ/xP9EJAvw9g9K4UVTC3NF/+G2qLrbTQ==}engines: {node: ^20.19.0 || >=22.12.0}cpu: [arm64]os: [win32]- '@oxlint/[email protected]':- resolution: {integrity: sha512-m3Pjwc2MfTcom4E4gOv7DyuGyt7OfGNCbmqDHd+N7EzXmP+ppHuudm2NjcA3AjV5TSeGxaguVF4SbTKHe1USYA==}+ '@oxlint/[email protected]':+ resolution: {integrity: sha512-xhRWBMpLxZvgKAH6+DJZmpP+W8Y8UdQOSU1JfxSWNXsaBaRGW77j+1hCuNHlzj7OH4SPN8fYd1q0o2qrDtoVyw==}engines: {node: ^20.19.0 || >=22.12.0}cpu: [ia32]os: [win32]- '@oxlint/[email protected]':- resolution: {integrity: sha512-/DbBvw8UFBhja6PqudUjV4UtfsJr0Oa7jUjWVKB0g86lj/VwnPrkngn0sFql3c9RDA0O16dh7ozsXb6GjNAzBQ==}+ '@oxlint/[email protected]':+ resolution: {integrity: sha512-yAnO7lwBYQnz2pcfBPIGQQZWIX5zd5R/1aAKIF3oE+TVj7IhoHcROjOkz3sRDngzqhfPKfFaXqug5j5rE5dn6Q==}engines: {node: ^20.19.0 || >=22.12.0}cpu: [x64]os: [win32]@@ -5009,6 +4981,12 @@ packages:'@radix-ui/[email protected]':resolution: {integrity: sha512-xnXE7wG13PI+cxieVssYXlQJuYVRhH9NBoxt3KNwzghDIA69GMm7d4wXRouHIYjE+KvS6U/MsMO73NdS2MH9ZA==}+ '@rolldown/[email protected]':+ resolution: {integrity: sha512-b+jTcARdTiFLI6jB4a5XjTm0RWd6KcRfQj/I2356fxUZemiho9zQLxo0RtCuMDAyKcLo6cEltkgbQp6d1+sjjQ==}+ engines: {node: ^20.19.0 || >=22.12.0}+ cpu: [arm]+ os: [android]+'@rolldown/[email protected]':resolution: {integrity: sha512-YYe6aWruPZDtHNpwu7+qAHEMbQ/yRl6atqb/AhznLTnD3UY99Q1jE7ihLSahNWkF4EqRPVC4SiR4O0UkLK02tA==}engines: {node: ^20.19.0 || >=22.12.0}@@ -5021,8 +4999,8 @@ packages:cpu: [arm64]os: [android]- '@rolldown/[email protected]':- resolution: {integrity: sha512-lZg8fqIv2v7FF237bwMgzGZEJvGL79/s5knJ/i6FmsGF4XXlzccZ4jb+TrFIxtSSxFtIpdsgrPZeMk1I9AFcyQ==}+ '@rolldown/[email protected]':+ resolution: {integrity: sha512-lkWU8ZJaRk9q3CIEY1Tc7vIFALp3Xw5NfGJo2hQg5oIqNgxWi1zI+IiDEK3r70BF5Dzol1tcXsnzsRc8NLhG+Q==}engines: {node: ^20.19.0 || >=22.12.0}cpu: [arm64]os: [android]@@ -5039,8 +5017,8 @@ packages:cpu: [arm64]os: [darwin]- '@rolldown/[email protected]':- resolution: {integrity: sha512-51Bnx9pNiMRKSUNtBfySkNJ9vMU9Hh3I1ozDd6gyPPYzaXCfnptUcEZxXGYFn+ul2dtcMUiqGR1Yai2K10uoTw==}+ '@rolldown/[email protected]':+ resolution: {integrity: sha512-dgR56NYnvAszm7Ob1B2/Vn0e8bUQYZH2UjVaMMtMVOCKFSfjhfLmuA/9+O+F+ajUdG6B/bSssrKW6JJYASa8jA==}engines: {node: ^20.19.0 || >=22.12.0}cpu: [arm64]os: [darwin]@@ -5057,8 +5035,8 @@ packages:cpu: [x64]os: [darwin]- '@rolldown/[email protected]':- resolution: {integrity: sha512-Tm+gbfC0aHu1tBA/JvKQh32S0K6YgCHkiAF4/W6xX0K0RmNuc94VeK419dJoE65R5aRxmo+noZQSWrAMF6yb6g==}+ '@rolldown/[email protected]':+ resolution: {integrity: sha512-vpVxFvUCFioJqug7OTvqptkc4yb8UX0AwfDmJpaR/0sWz+BUmqSVAf7c8JkUgnN8YLspb4a/N6NhTyMAmdyQ7Q==}engines: {node: ^20.19.0 || >=22.12.0}cpu: [x64]os: [darwin]@@ -5075,8 +5053,8 @@ packages:cpu: [x64]os: [freebsd]- '@rolldown/[email protected]':- resolution: {integrity: sha512-JMzDKCCXq93YccG5gz3hvOs1oXRKAf0XYpfOS88e+wZrC8Iugj6j68867vrYZkvpDDpKn/KoKORThmchMpF6TA==}+ '@rolldown/[email protected]':+ resolution: {integrity: sha512-h1wG6Y6K3JlRswxsI64qQJqBAy4vrLuHgRbc8CZMGSWTOFRY6ghMApM1NKzB2I0n5xV1fjkE18SuVl2QpLeNpA==}engines: {node: ^20.19.0 || >=22.12.0}cpu: [x64]os: [freebsd]@@ -5093,8 +5071,8 @@ packages:cpu: [arm]os: [linux]- '@rolldown/[email protected]':- resolution: {integrity: sha512-uML21j2K5TfPGutKxub+M+nLjZIrWjXQ5Grx4lCe/nimTj9B4L63zHpjXLl4y0L3mcm2htEQIb06oCG/szerNw==}+ '@rolldown/[email protected]':+ resolution: {integrity: sha512-tbCiqub0q2MVWJKgF5PoAlNWCtQydiOYSLIkd8sByqK/6MMYLJRcSXSYodqYtd0O+Fw7QaVmKKlS4oL94YRZ0w==}engines: {node: ^20.19.0 || >=22.12.0}cpu: [arm]os: [linux]@@ -5113,8 +5091,8 @@ packages:os: [linux]libc: [glibc]- '@rolldown/[email protected]':- resolution: {integrity: sha512-navSiuTMogvnQoZoM/v+l3ZWo50/NTwSHSzheABx/RCnmUPaKwq9qSo4Br2OYRs21+Fz8uFqITZM3H4opOB0/Q==}+ '@rolldown/[email protected]':+ resolution: {integrity: sha512-oxK9+baEBPhZG5HB4URY+uU04zJWeZlH6Tb9rB5DK4DF9XR1uXNLXt5Q5ZsugTKayNCNLhkcwz/ye74hRI98dg==}engines: {node: ^20.19.0 || >=22.12.0}cpu: [arm64]os: [linux]@@ -5134,8 +5112,8 @@ packages:os: [linux]libc: [musl]- '@rolldown/[email protected]':- resolution: {integrity: sha512-lAryqH7IteztmCXQXk0etKj4wBQ7Gx5S6LjKhsgp9zb8I5bsuvU/2llH1hDQcjsFeqIsovMVN339/8pUDDBXxA==}+ '@rolldown/[email protected]':+ resolution: {integrity: sha512-muWCk27FVBEZtv0MsK8gnfSmgczA8KQ0uRVJbTABKhkRfQc38aUrcb7fhi3BNiyseFmgcRsoMfQsSNJ+DbZdSw==}engines: {node: ^20.19.0 || >=22.12.0}cpu: [arm64]os: [linux]@@ -5155,8 +5133,8 @@ packages:os: [linux]libc: [glibc]- '@rolldown/[email protected]':- resolution: {integrity: sha512-fsK/sNBnxzBlL4O1JNrZakVQxPspqpED5dLtNsZS9oOKmtSpdNIzxH2kkol5HYTWJN47sE20ztMJPxfZ89qGOg==}+ '@rolldown/[email protected]':+ resolution: {integrity: sha512-eWDoSfU7Co2qj3vgB3Dt4lj1mG6CoWbcJQkRMP3XJplyCMtuaq3LHvPFjS9QIPvMGWVadJC04Xiy0IdcVPtnwQ==}engines: {node: ^20.19.0 || >=22.12.0}cpu: [ppc64]os: [linux]@@ -5176,8 +5154,8 @@ packages:os: [linux]libc: [glibc]- '@rolldown/[email protected]':- resolution: {integrity: sha512-gLYb4BIadlfTOYT5gO503n8zQjXflgzpD0FcyKh0Mzx3rqCZKnHoJWV9xe1KXUJ5lx2JfcSHr/mhzS0PC/McAA==}+ '@rolldown/[email protected]':+ resolution: {integrity: sha512-2bWNjRSIayvupRKxXUY2tWG9fYdoUlTqWywHRvE8Eq3GvuQ+f2HeIkve697fIt+IQs/PV8yFsdWuhp1aJ1PdnA==}engines: {node: ^20.19.0 || >=22.12.0}cpu: [s390x]os: [linux]@@ -5197,8 +5175,8 @@ packages:os: [linux]libc: [glibc]- '@rolldown/[email protected]':- resolution: {integrity: sha512-FjcpEKUyJygHgs1o50VYNvkt5+7Le/VEdYt0AkRpkL33MnyQfwr8l5mXwMmfmTbyMPr5vJLC+8/Gd9gXnwU1QQ==}+ '@rolldown/[email protected]':+ resolution: {integrity: sha512-KekI0gS0wLxe1UBSQSjenBVwou/JkcQPDzBPICGZjxUv9k3RteHDPBQaiOicZUFKRIH2wKEimGwVpnJsbPzu7w==}engines: {node: ^20.19.0 || >=22.12.0}cpu: [x64]os: [linux]@@ -5218,8 +5196,8 @@ packages:os: [linux]libc: [musl]- '@rolldown/[email protected]':- resolution: {integrity: sha512-Me+PfPI2TMeOQk0gYWfLQZtTktrmzbr8cDboqX83XKc7UrgAi55gF+2dUkWdxd19n55Essp2yeca+O9N5rBxHg==}+ '@rolldown/[email protected]':+ resolution: {integrity: sha512-TvtPnfVr+HtyGiDmPK4VWmlNm7QhNNAcK5Q9A7aOXsI8545yCyaoMaicXrFZ72JzeYjaUVk7yT243zT0jzjFKQ==}engines: {node: ^20.19.0 || >=22.12.0}cpu: [x64]os: [linux]@@ -5237,8 +5215,8 @@ packages:cpu: [arm64]os: [openharmony]- '@rolldown/[email protected]':- resolution: {integrity: sha512-yc5WrLzXks6zCQfn9Oxr8pORKyl/pF+QjHmW/Qx3qu0oyrrNC+y2JLTU1E2rcWYAmzlnqngWXHQjy51VzW70Vw==}+ '@rolldown/[email protected]':+ resolution: {integrity: sha512-iOo0VEay2XFhaCcH0sps5XIimkSuOnNaZrf6+ZkoSOQBJPKNU48RkmJv0/lSpipexu5P+ouFgafe5IGr/DiQfg==}engines: {node: ^20.19.0 || >=22.12.0}cpu: [arm64]os: [openharmony]@@ -5253,11 +5231,6 @@ packages:engines: {node: ^20.19.0 || >=22.12.0}cpu: [wasm32]- '@rolldown/[email protected]':- resolution: {integrity: sha512-VbQGPX2b4r48TAMIM2cjgluIM1HYutm4pcTEJsle7iEP7sB1dFqtPLBVbdLAZCxy1txCcPxf4QFf4v8uvltPqA==}- engines: {node: ^20.19.0 || >=22.12.0}- cpu: [wasm32]-'@rolldown/[email protected]':resolution: {integrity: sha512-KmoUoU7HnN+Si5YWJigfTws1jz1bKBYDQKdbLspz0UaqjjFkddHsqorgiW1mxcAj88lYUE6NC/zJNwT+SloqtA==}engines: {node: ^20.19.0 || >=22.12.0}@@ -5270,8 +5243,8 @@ packages:cpu: [arm64]os: [win32]- '@rolldown/[email protected]':- resolution: {integrity: sha512-gHv82k63z4qpV5+Q1y/12KrK0ltWBukVDI8nZcbT7Tt/ZlOIVwppazneq0F93oDxTo3IgAMEDIoQh3E2n6mVsw==}+ '@rolldown/[email protected]':+ resolution: {integrity: sha512-y5NTmmasMS455JlOCO4ZM9krIchv3Mvm1crL1iUPGOPgEzSkves9n0SdC5Sjz6+qWDFhd8/JpfWMH8NSWNHe+A==}engines: {node: ^20.19.0 || >=22.12.0}cpu: [arm64]os: [win32]@@ -5288,8 +5261,8 @@ packages:cpu: [x64]os: [win32]- '@rolldown/[email protected]':- resolution: {integrity: sha512-tTZuDBPw85tEN5PQi1pnEBzDy0Z49HtScLAbD5t6hyeU92A95pRWaSMw1GZZi/RwgSgUIl0xrSlXIT/9QzvYSA==}+ '@rolldown/[email protected]':+ resolution: {integrity: sha512-np8iZSLfXlAD4kWhiyq/u0Yt8oZDtRQ8lGhQaCXo2rl37KNjeU0GjJuwr4P3oeZ++ROfofsKNBqR5LTO8aXyWQ==}engines: {node: ^20.19.0 || >=22.12.0}cpu: [x64]os: [win32]@@ -5408,8 +5381,8 @@ packages:'@standard-schema/[email protected]':resolution: {integrity: sha512-e7Mew686owMaPJVNNLs55PUvgz371nKgwsc4vxE49zsODpJEnxgxRo2y/OKrqueavXgZNMDVj3DdHFlaSAeU8g==}- '@swc/[email protected]':- resolution: {integrity: sha512-JQ5TuMi45Owi4/BIMAJBoSQoOJu12oOk/gADqlcUL9JEdHB8vyjUSsxqeNXnmXHjYKMi2WcYtezGEEhqUI/E2g==}+ '@swc/[email protected]':+ resolution: {integrity: sha512-5lSsMOTXURePglDfvuAQUqkGek9Hg2kksOYay2m0+XR++b2NWYL/4sWyuvVBIs8oKnJaxkdi9whaL/sqN13afw==}'@szmarczak/[email protected]':resolution: {integrity: sha512-4BAffykYOgO+5nzBWYwE3W90sBgLJoUPRWWcL8wlyiM8IB8ipJz3UMJ9KXQd1RKQXpKp8Tutn80HZtWsu2u76w==}@@ -5981,9 +5954,6 @@ packages:'@types/[email protected]':resolution: {integrity: sha512-/HQ2uFoetFTXuye8vzIcHw2z6Fwi7Hi/qcgC+RoS9NCyewiqxhVGqlG+ViGB6lkax481R6dmhf1I7lIGlzJStQ==}- '@types/[email protected]':- resolution: {integrity: sha512-9VN+6yxLOPLOav+7PwjZbxiID2bVaeq0ED4qSQmdQTdjnXJSaCVKTR58t15oqH1H5t8Ng2ZX1SabJVoN9Q34bw==}-'@types/[email protected]':resolution: {integrity: sha512-trgaNyfU+Xh2Tc+ABIb44a5AYUpicB3uwirOioeOkNPPbmgRNtcWyDeeFRzjPZENO9Vq8gvVqfhaaXWLlevVwg==}@@ -6076,6 +6046,126 @@ packages:'@types/[email protected]':resolution: {integrity: sha512-DIWfCKpsTp6hE5BDBHV3+fIL/bLUF9Bv13iDrWnMlmhQpH67buNvI291ZauQ1xcccxK3FqQ9honnXpq4R8NMuQ==}+ '@typescript/[email protected]':+ resolution: {integrity: sha512-MTKKkWB7p/0E9xi1d1tHtZ5PiLkGEMIq88pK2CubZjOsLtYTLqhgIgi6zepFa+9GHZ6h05NMCkQxGKiPXMxXtQ==}+ engines: {node: '>=16.20.0'}+ cpu: [ppc64]+ os: [aix]++ '@typescript/[email protected]':+ resolution: {integrity: sha512-gowzar9MwS/aRWp6f3a4KUqzRjAZjOsmGNCM6LcTgXum+dBfgsBVMN+AgvOCCbguXyick6LJhpBszxMebJ8syA==}+ engines: {node: '>=16.20.0'}+ cpu: [arm64]+ os: [darwin]++ '@typescript/[email protected]':+ resolution: {integrity: sha512-SZ9xZInqApNlNGc9s0W1VSsktYSOe9cFqNOIqmN1Gs8SmkjKZYFt017G4VwPxASInODuAdbTW7sXiFUf893RgA==}+ engines: {node: '>=16.20.0'}+ cpu: [x64]+ os: [darwin]++ '@typescript/[email protected]':+ resolution: {integrity: sha512-W5NH4y/J0plIIS5b2xvTEkU7JFxyqdMAOgf+Ilhl0vHQXKO5dZoxd+C/jEtq56c4F3wk71RB4BMRQ2XdI+bwYQ==}+ engines: {node: '>=16.20.0'}+ cpu: [arm64]+ os: [freebsd]++ '@typescript/[email protected]':+ resolution: {integrity: sha512-UMGDx5sTpzNw3WiPebH7l90IWfJggEd+egHt/q6p7/Cm3zqoV7VxkGXt+3DxPIw8CcmvAB0j3sVVfbhX+M4Tpw==}+ engines: {node: '>=16.20.0'}+ cpu: [x64]+ os: [freebsd]++ '@typescript/[email protected]':+ resolution: {integrity: sha512-Qh4eU4/y3yDjnfjjyPYihMj5/ODIlmt+Bzu17OI+fiSRDW57QmU5SiN63exPRNJPKUzcc1INa1NXdrJ+MqHjUQ==}+ engines: {node: '>=16.20.0'}+ cpu: [arm64]+ os: [linux]++ '@typescript/[email protected]':+ resolution: {integrity: sha512-gffT3xPz9sR7j/YJExkyPntrI0P2EP9XbOyWzth2/Gs0RstK+90RBcO0ncXoXy/beYll1SXw846Nf2zdnEz0QQ==}+ engines: {node: '>=16.20.0'}+ cpu: [arm]+ os: [linux]++ '@typescript/[email protected]':+ resolution: {integrity: sha512-uEHck9i8hoAzXPiYRib1O7miOnz23SxIeVl6F4LXox+qov1K35jHcEW6VHKvZI+pyvl7fZEP4MCU5LYvIq1GuQ==}+ engines: {node: '>=16.20.0'}+ cpu: [loong64]+ os: [linux]++ '@typescript/[email protected]':+ resolution: {integrity: sha512-R4KvAMnE43W5Qeqb0Ly56O3mWMWIAgsMyz36DCaycd5nbg/9kzm0liw3JocfRqyJY0KPmzFjbswozXyW0DnIYA==}+ engines: {node: '>=16.20.0'}+ cpu: [mips64el]+ os: [linux]++ '@typescript/[email protected]':+ resolution: {integrity: sha512-DORx5b3sd/4S7eayxm4FQv+A7CrkUIGRaHiwI8oiHTAI1fAPWhF4J0vAlkC8biAlHSVVwxMQ3tjZ2/DVbnQiiA==}+ engines: {node: '>=16.20.0'}+ cpu: [ppc64]+ os: [linux]++ '@typescript/[email protected]':+ resolution: {integrity: sha512-wf0jqEDOjrPRnKwYRyyJDRo11KMbvMFrU+q4zqKyChODBzvlkbhNQfKvLxQCcwTpdDaXSHZTVuh0JoCrKCUMHQ==}+ engines: {node: '>=16.20.0'}+ cpu: [riscv64]+ os: [linux]++ '@typescript/[email protected]':+ resolution: {integrity: sha512-IkwJc3L7yhytWd/ewjyxNDfOmswCm9GWMJT/ue/dU4aZNbwZeYAetq42VyLmsmSjvoX7z74X6ZaYCtzAr0EuGw==}+ engines: {node: '>=16.20.0'}+ cpu: [s390x]+ os: [linux]++ '@typescript/[email protected]':+ resolution: {integrity: sha512-EYdf2cNg7rgCWJnxCdJ+F3V39O8ihb37eHAu1LK8oAFizgTQbPOK7zHHXbPt8rX24COqODXeI3sIf0fCXG7H/A==}+ engines: {node: '>=16.20.0'}+ cpu: [x64]+ os: [linux]++ '@typescript/[email protected]':+ resolution: {integrity: sha512-+polYF4MF04aPpO5FTkHran9yUQDSXqy5GiSDKpsll5jy3l3+g9QLhpf39T+ePtefhXLOGrLl0QIjkQP6VnelA==}+ engines: {node: '>=16.20.0'}+ cpu: [arm64]+ os: [netbsd]++ '@typescript/[email protected]':+ resolution: {integrity: sha512-8YIT0EHM/3dq10ZOVF/A7pc/YSMtbcecct4rWtexrnSCHOPcpC2KTLXfTCR6vDpnSiY12heNb1GiN/wu+T/FyA==}+ engines: {node: '>=16.20.0'}+ cpu: [x64]+ os: [netbsd]++ '@typescript/[email protected]':+ resolution: {integrity: sha512-APT8+ClYnuYm1u9+kgGXoMj2VzWzcymwh2gNSQVySHfkRDGOTVkoWLjCmOQSaO+PoqQ57B0flRp9SA+7GnnkzQ==}+ engines: {node: '>=16.20.0'}+ cpu: [arm64]+ os: [openbsd]++ '@typescript/[email protected]':+ resolution: {integrity: sha512-yX7s+Q0Dln0Dt9tEzZsAjXXR/+ytBM7AlglaqyeMPxQszJ1JhlJdZ6jLA+IzldHtflX81em7lDao1xXu+aRRkg==}+ engines: {node: '>=16.20.0'}+ cpu: [x64]+ os: [openbsd]++ '@typescript/[email protected]':+ resolution: {integrity: sha512-dLJDGaLZ1D4HPQn62u1n8mBDkJREwMsAkCdkwd4Ieqw+x3TUyTsqY0YiBCtE6H6OzzgGk3iuZ3vFWRS+E8/d1g==}+ engines: {node: '>=16.20.0'}+ cpu: [x64]+ os: [sunos]++ '@typescript/[email protected]':+ resolution: {integrity: sha512-Gyl1Vy6OsWesLzmq+EP0Fb7b4Nid5232AvcA2SFcdYreldpNtYFFofPjnt62y9hQy7VTaZp65ICJjuAQRaVcIQ==}+ engines: {node: '>=16.20.0'}+ cpu: [arm64]+ os: [win32]++ '@typescript/[email protected]':+ resolution: {integrity: sha512-0BQ3HkAHHlKLSp1qRvf3SUhGpGsDuhB/jgFw75guyqbxJqEaS0Cw/VFO8i2nHglJUzQCRtMMR/IBAKE3ETMC4g==}+ engines: {node: '>=16.20.0'}+ cpu: [x64]+ os: [win32]+'@u-wave/[email protected]':resolution: {integrity: sha512-isdhKTNXzXlLtsGmkKzz5Z2tr/M0qlOymSR8Lor2KWQVoNAm6GePZPmyCzXHDHZ/lzzSyUU2yraVOTBOtbAmkQ==}peerDependencies:@@ -6094,7 +6184,7 @@ packages:'@sveltejs/kit': '>=1''@vercel/analytics': '>=1.5.0''@vercel/speed-insights': '>=1.2.0'- next: ~16.2.11+ next: ~16.3.3react: 19.2.5react-dom: 19.2.5vite: '>=5'@@ -6184,6 +6274,141 @@ packages:'@xterm/[email protected]':resolution: {integrity: sha512-TQwDdQGtwwDt+2cgKDLn0IRaSxYu1tSUjgKarSDkUM0ZNiSRXFpjxEsvc/Zgc5kq5omJ+V0a8/kIM2WD3sMOYg==}+ '@yuku-codegen/[email protected]':+ resolution: {integrity: sha512-C/0zV5IhgVdYhGJTwrY0v8dknxlhiKwtVJkMUaexu9/QvRmzlV4vfU3hZlUSgqc2BxQHntL1mCVbDq8j0FRFDw==}+ cpu: [arm64]+ os: [android]++ '@yuku-codegen/[email protected]':+ resolution: {integrity: sha512-/u+REDMI4a0/lsJXTM4c53/w31OGZLOReZIyg62uhgLs0kc8NHsj/nOcxTdlQjq5gi0zhdkccD9LaLTXcdzPvw==}+ cpu: [arm64]+ os: [darwin]++ '@yuku-codegen/[email protected]':+ resolution: {integrity: sha512-sMMzFOwCo4WXR+/6zIBThOocSC50iIIZZdfiIDbaLvj0Ax/rWt/iavyfEAqajyvzydLyCqR/ZItdLWSRlu1umw==}+ cpu: [x64]+ os: [darwin]++ '@yuku-codegen/[email protected]':+ resolution: {integrity: sha512-MpdpKXix9P+Y1rKgjvcNeNtGjXeL1CmttNhYINrWls8kRpm4xM/oBGTmn6w7to8lAlwj5jm8q03dQPl5mRv4Qw==}+ cpu: [x64]+ os: [freebsd]++ '@yuku-codegen/[email protected]':+ resolution: {integrity: sha512-rr1srFLlPAmC1vtxfc9C1YLDe3iH09YjfSeeIidBqKhzx1MATjOAq4mjlRUOnhr/L27MotWIYOFKwVsd5JZFOg==}+ cpu: [arm]+ os: [linux]+ libc: [glibc]++ '@yuku-codegen/[email protected]':+ resolution: {integrity: sha512-eAufXh8qBRpiSO6ueaMDL+yyoXIGLhpUce72YbcACtZU2qhExwBIJyEtQf5kH2Ki0X2aqkSjSfog4OPtKXan3Q==}+ cpu: [arm]+ os: [linux]+ libc: [musl]++ '@yuku-codegen/[email protected]':+ resolution: {integrity: sha512-gw4w6wPoHObBrdIC4duVWLmJOvpdE25j5D7yrM5mACNlK4klRz/lv8hK+ssQk9EJHBgZjSaqZIJVFgqNYbfv7A==}+ cpu: [arm64]+ os: [linux]+ libc: [glibc]++ '@yuku-codegen/[email protected]':+ resolution: {integrity: sha512-L68N6Y4XkqcIaKo3Ra88JEvBEH4AHff44A4INcrxeVWZ8CZtu2tCpfVxe3hR8qQQMcvBSQlDn24KpkCKEhVvfA==}+ cpu: [arm64]+ os: [linux]+ libc: [musl]++ '@yuku-codegen/[email protected]':+ resolution: {integrity: sha512-dzyAbltJmf3Cqlb8HcFuYIf5Yn0fl1vTr3XJ9HiVNNvOlhqPSArOqtw9vI1p6/VTXTjrMLXlU+s+/kNHiIy/Cw==}+ cpu: [x64]+ os: [linux]+ libc: [glibc]++ '@yuku-codegen/[email protected]':+ resolution: {integrity: sha512-Otw4MH3404q0Bbvl+YTdW9aoUV5vXmUw8260bWvt1XlaoIX/ceSgI4ygheRDMfBPoHt6FDayQaO9OLVUZAgkFA==}+ cpu: [x64]+ os: [linux]+ libc: [musl]++ '@yuku-codegen/[email protected]':+ resolution: {integrity: sha512-qo/jyrzryiBuKEsFiuWaBCBe3tRMynQ0qFWFgOEjcCMQeZfBm+wKiVEUEFXXLc7bh8YezguAWp0Mtnhq4ARNyA==}+ cpu: [arm64]+ os: [win32]++ '@yuku-codegen/[email protected]':+ resolution: {integrity: sha512-D5lDsVDx6m00E6bWySlWdH72Ca4TPSaphDqB6QjU6MpuNLIJqoGoatYyq2rOmBE8Zv/kunot/o58KGL03P3eiA==}+ cpu: [x64]+ os: [win32]++ '@yuku-parser/[email protected]':+ resolution: {integrity: sha512-eGKYiUDX7Y0V7tDTmg+JTVnXnjMqfXXsorZ+EDf5kxwchQ3Or1HS14MzI2fw+jFhHR85fCWt+mtX33Yao73hIQ==}+ cpu: [arm64]+ os: [android]++ '@yuku-parser/[email protected]':+ resolution: {integrity: sha512-Re0RHelKLnjEURulY2/KxW+Ngb8zuNA4BRZuMwgGQNzVumT6u4U2N2hc01oeYVNVof0i7GrXE4UCNBgbpRRnjQ==}+ cpu: [arm64]+ os: [darwin]++ '@yuku-parser/[email protected]':+ resolution: {integrity: sha512-Hn8DROtQkjlA1ACbPgj4a7eP9IuVOI504oiTwpkWPbpaDWD9KdmnVYCqW+1LfenNK/g7O9NhWGpXEdaCNX7lIA==}+ cpu: [x64]+ os: [darwin]++ '@yuku-parser/[email protected]':+ resolution: {integrity: sha512-bAP2OV8wRuzplX/jYxv9+vvqQT8JxyNphI8fLfXGL054Xs+4/J5u33cIm3y4rxY8rdoLmmdiJs2Tq7r7lrDRfA==}+ cpu: [x64]+ os: [freebsd]++ '@yuku-parser/[email protected]':+ resolution: {integrity: sha512-kTYwJQQgmZeAWdDIWabiReIZMpmfLueIj1tCmjStUtFGhR1Z0qwxonKVfUC4N7h/VhGGzLZ//7O1kgt1QKqgCg==}+ cpu: [arm]+ os: [linux]+ libc: [glibc]++ '@yuku-parser/[email protected]':+ resolution: {integrity: sha512-uL4jE8HPT2BLlxAXyD10LqgPuXa9eDa0BKpCdSANmzIJghq/2eZo3/gQNtaxPZMupWoxjYzSad9IXrwu7aYPXQ==}+ cpu: [arm]+ os: [linux]+ libc: [musl]++ '@yuku-parser/[email protected]':+ resolution: {integrity: sha512-3gVN4pWSKZmXiNX7cU164dR9MPvesCHnlH6nPfpK+yQsCuYphjKKplcb4SnZBrhiqmXbgb2HR0c2TS0IZUPhgA==}+ cpu: [arm64]+ os: [linux]+ libc: [glibc]++ '@yuku-parser/[email protected]':+ resolution: {integrity: sha512-S0mwfEjoLpxzXeZw802Wa4RaELsQiPtWqG6INcy8j4GtvNFtl4LCX3eGO1XLn9pyLAISLzTRyU3zUCBUPin8lg==}+ cpu: [arm64]+ os: [linux]+ libc: [musl]++ '@yuku-parser/[email protected]':+ resolution: {integrity: sha512-lnbWdPmerE5D1uH1G4IEZKnPzCrWCStRGrtgpSIe1RibAo5bZIjDbbbPYXmMHCEh4F+x/JaJpElh26a3r+BPbg==}+ cpu: [x64]+ os: [linux]+ libc: [glibc]++ '@yuku-parser/[email protected]':+ resolution: {integrity: sha512-769uwndMvMzUvATWbAcEvyLHKA+DzhHSCl/obBUrRdYfRo26yxui6S8y3z7uJ+Naup7UKrDxrpK7OnQkxkl9KQ==}+ cpu: [x64]+ os: [linux]+ libc: [musl]++ '@yuku-parser/[email protected]':+ resolution: {integrity: sha512-mEB/9PlaAkisJ6KWGz0zvywXoU6+80dTlR2LwS7s/jcXXoU6fm2+sitBZXtqu3+Q4DcDgPxM45uWMCzPs0TSRw==}+ cpu: [arm64]+ os: [win32]++ '@yuku-parser/[email protected]':+ resolution: {integrity: sha512-8vNB2DP0ou61nGb8tc/qfi41gfyDXz1MHr2zqL3nR+cJ6CEbiuWV/l/a/vv151gCgiZLLAyGkQGENpozdg716w==}+ cpu: [x64]+ os: [win32]++ '@yuku-toolchain/[email protected]':+ resolution: {integrity: sha512-2Z53dNxAJL6UvFoIrDZvYf3zlO8s4VJK4O2hhaB4mXVwwpX/7ajtss3cmfqKvamlNLWyt9FSWs4eoYdlbxpnHA==}+'@zag-js/[email protected]':resolution: {integrity: sha512-F6kRAPxgBZRZmuV5SLywcrGNSclKcAcPAAgSrEdr2Z2dzFgQngbvS4dmdQyGau/vtQ42OlCI48Ri4t0hZxXkMw==}@@ -6386,10 +6611,6 @@ packages:resolution: {integrity: sha512-Izi8RQcffqCeNVgFigKli1ssklIbpHnCYc6AknXGYoB6grJqyeby7jv12JUQgmTAnIDnbck1uxksT4dzN3PWBA==}engines: {node: '>=12'}- resolution: {integrity: sha512-8OG92q3R35qjC/4i6BLBMg8IB+fClWu/1PEwg2Z9Rn+BuNaiEgJzpzn+pxWOdHJWDCAwu2JP0wCDTozAM4QirQ==}- engines: {node: ^22.18.0 || >=24.11.0}-resolution: {integrity: sha512-x1FCFnFifvYDDzTaLII71vG5uvDwgtmDTEVWAxrgeiR8VjMONcCXJx7E+USjDtHlwFmt9MysbqgF9b9Vjr6w+w==}engines: {node: '>=4'}@@ -6535,9 +6756,6 @@ packages:resolution: {integrity: sha512-Ceh+7ox5qe7LJuLHoY0feh3pHuUDHAcRUeyL2VYghZwfpkNIy/+8Ocg0a3UuSoYzavmylwuLWQOf3hl0jjMMIw==}engines: {node: '>=8'}- resolution: {integrity: sha512-LShSxJP0KTmd101b6DRyGBj57LZxSDYWKitQNW/mi8GRMvZb078Uf9+pveax1DrVL89vm7mWe+TovdI/UDOuPw==}-resolution: {integrity: sha512-1W07cM9gS6DcLperZfFSj+bWLtaPGSOHWhPiGzXmvVJbRLdG82sH/Kn8EtW1VqWVA54AKf2h5k5BbnIbwF3h6w==}@@ -6604,9 +6822,6 @@ packages:resolution: {integrity: sha512-q2hn7Mbo2nFNkVekPiHFx6Nfo3hURmES3tfBn+k5Pqxl2RkmP3QGqZUhH/q9Pch/4G05NRhPjDlVj1O8q4Txvw==}engines: {node: '>=14.0.0'}- resolution: {integrity: sha512-4N0ig0fEomHt5R0KCFWjovxow98rIoRwKolrYdCcknNwMekCXRnWEUvgu5soYV8QXtVsrUD8B95MBOZGPvr6KQ==}-resolution: {integrity: sha512-tjwM5exMg6BGRI+kNmTntNsvdZS1X8BFYS6tnJ2hdH0kVxM6/eVZ2xy+FqStSWvYmtfFMDLIxurorHwDKfDz5Q==}engines: {node: '>=18'}@@ -7371,9 +7586,9 @@ packages:resolution: {integrity: sha512-nI4U3TottKAcAD9LLud4Cb7b2QztQMUEfHbvhTH09bqXTxnSie8WnjPALV/WMCrJZ6UV/qHJ6L03OqO3LcdYZw==}engines: {node: '>=12'}- resolution: {integrity: sha512-bihc7jPC90VrosXNzK0LTE2cuLP6jr0Ro8jk+kMugHReJVLIpHz/xadeq3MhuwyO4TD4OA3L1Q8pBBFRc08Tsw==}- engines: {node: '>=20.19.0'}+ resolution: {integrity: sha512-1T1f+z+4tl9XD+m+0HBgWoL/nm0bOIffyWaUuUSBlFg/86IWvfx+wjNaO/ybU0AJzG9/Mi5hBUgGV6zCmWEN7Q==}+ engines: {node: ^22.18.0 || >=24.0.0}peerDependencies:oxc-resolver: '>=11.0.0'peerDependenciesMeta:@@ -7898,7 +8113,7 @@ packages:'@types/react': '*'algoliasearch: 5.x.xlucide-react: '*'- next: ~16.2.11+ next: ~16.3.3react: 19.2.5react-dom: 19.2.5react-router: 7.x.x@@ -7933,7 +8148,7 @@ packages:peerDependencies:'@fumadocs/mdx-remote': ^1.4.0fumadocs-core: ^15.0.0 || ^16.0.0- next: ~16.2.11+ next: ~16.3.3react: 19.2.5vite: 6.x.x || 7.x.xpeerDependenciesMeta:@@ -7963,7 +8178,7 @@ packages:resolution: {integrity: sha512-Yty9tINshfQQYHE/K+nH7+7VHTNtWL0hgNvwI7lLd6xcJrbFUgzJQUeS0oGxZx+7rgqGYvNqlByKLRQHqPR9dw==}peerDependencies:'@types/react': '*'- next: ~16.2.11+ next: ~16.3.3react: 19.2.5react-dom: 19.2.5tailwindcss: ^4.0.0@@ -8043,6 +8258,10 @@ packages:resolution: {integrity: sha512-yTb+8DXzDREzgvYmh6s9vHsSVCHeC0G3PI5bEXNBHtmshPnO+S5O7qgLEOn0I5QvMy6kpZN8K1NKGyilLb93wA==}+ resolution: {integrity: sha512-/6gFNr0N04nob252sTQxyFLi3eKFRqIg1I87YcqAMT1i6SQrSF6KujUEQrtrjMV0H/eejTCltLdDSTEMzHbnsQ==}+ engines: {node: '>=20.20.0'}+resolution: {integrity: sha512-b1O07XYq8eRuVzBNgJLstU6FYc1tS6wnMtF1I1D9lE8LxZSOGZ7LhxN54yPP6mGw5f2CkXY2BQUL9Fx41qvcIg==}engines: {node: '>= 14'}@@ -8291,9 +8510,9 @@ packages:resolution: {integrity: sha512-Iqv2fzaTQN28s/FwZAoFq0ZSs/7hMAHJVX+w8PZl3cY19Pxk6jFFalxQoIfW2826i/fDLXv8IiEZRIT0lDuWcg==}- resolution: {integrity: sha512-bDxwDdF04gm550DfZHgffvlX+9kUlcz32UD0AeBTmVPFiWkrexF2XVmiuFFbDhiFuP8fQkrkvI2KdSNPYWAXkQ==}- engines: {node: '>=20.19.0'}+ resolution: {integrity: sha512-NkJQA7oZ4YHQhd2+H3BoRFKF3d/XNsiKpHZCQEMH9pDX27hQQLsTyOocyRgaIVtf8gHX3Nt3LPkR4e5EdtPAGQ==}+ engines: {node: ^22.18.0 || >=24.0.0}resolution: {integrity: sha512-EdDDZu4A2OyIK7Lr/2zG+w5jmbuk1DVBnEwREQvBzspBJkCEbRa8GxU1lghYcaGJCnRWibjDXlq779X1/y5xwg==}@@ -9349,8 +9568,8 @@ packages:'@types/unist':optional: true- resolution: {integrity: sha512-B339zaqbyK8cmxhoAvLrcwoabwCP1wz21zSzfqxqXAemTu2BXnH7tQnfcglKv1vnMUIDBc+Hth7XODQriTZiRQ==}+ resolution: {integrity: sha512-tuRTx1nQ/yVw83cwJBo9F+njGUgMn3UHQycreWHB8XsStvvAh1AthbI8/4IpKnFaF58F+iSiHejYOlMQ/eq83g==}engines: {node: '>=20.9.0'}hasBin: truepeerDependencies:@@ -9483,6 +9702,10 @@ packages:resolution: {integrity: sha512-9miFgM2OFba7hB+pRgvtV84pYTBaoTHohvmIgiRt6dRIzbwEOIaNaP+dIlGs2fNFoB0SeISs0Jz5WFVRid6Xyg==}engines: {node: '>=12.20.0'}+ resolution: {integrity: sha512-4a+OsYv9UktOJKE+l1A4OufDgdRF9PifWj+tJnHURo/P+WOxpG4GzUFL9qCalmWauao6ogiG+QvnCovwPoyAWA==}+ engines: {node: '>=12.20.0'}+resolution: {integrity: sha512-0eJJY6hXLGf1udHwfNftBqH+g73EU4B504nZeKpz1sYRKafAghwxEJunB2O7rDZkL4PGfsMVnTXZ2EjibbqcsA==}engines: {node: '>=14.0.0'}@@ -9550,23 +9773,26 @@ packages:resolution: {integrity: sha512-2Mx3fKQz7+xgrBONjsxOgCGtMHOn38/HxMzW1I5efwXB5a4lRN0Vp40gYUJFBWJslcrvwoofTrqoTnLbwTd3pA==}- resolution: {integrity: sha512-ZHGk1YDMwxnz2OSxHPysJwgXE7oVIDGWmhlVFeQuvfBDY5AlMfcUlYvixJkjc0sGYNhegYN8we10ZU5UydFLvQ==}+ resolution: {integrity: sha512-ElAyNkGRwxc+sMiSn/aJG0Qta7DkPqeLqDENz3iRm5UMgVaISO1Golm0vRo3UM8+DYQhHos2548gjS7lrjHc1w==}engines: {node: ^20.19.0 || >=22.12.0}- resolution: {integrity: sha512-3mBv3CoPbh8dFbzfDGIWa2ytZjn2v+3EX4aKRXjIhsoGFzG8GCjfRirz3rwZf1wYbZzsNLTSgpw8VjQuWdp/jA==}+ resolution: {integrity: sha512-KjK/XLcXr1DSyonKhsuFqJRiuKqcyG9j3LJ8nkOsrLzGvodBPqzHOKauy10asLMDI0sUpvb+1sxlzff3udZvfg==}hasBin: true- resolution: {integrity: sha512-N4LLxYLd94KEBqXDMDM5f+2PUpItTjDLreXe2Gn5KhjhCK4Qp2YUXaBi8Yu325ryOgKwt22m45fpD7nPOn69Yw==}+ resolution: {integrity: sha512-5nTiSps4qdbCWLbxzuO00alHkEO2exR9YMN/ig6QXWrLsYSG0KaObOAM+l6oU2LcKPWoSAGYbkZIGEu1ViiWKA==}engines: {node: ^20.19.0 || >=22.12.0}hasBin: truepeerDependencies:- oxlint-tsgolint: '>=0.22.1'+ oxlint-tsgolint: '>=7.0.2001'+ vite-plus: '*'peerDependenciesMeta:oxlint-tsgolint:optional: true+ vite-plus:+ optional: trueresolution: {integrity: sha512-BZOr3nRQHOntUjTrH8+Lh54smKHoHyur8We1V8DSMVrl5A2malOOwuJRnKRDjSnkoeBh4at6BwEnb5I7Jl31wg==}@@ -10375,20 +10601,20 @@ packages:resolution: {integrity: sha512-NS3levdsRIUOmiJ8FZWCP7LG3QpJyrs/TE0Zpf1yvZu8cAJJ6QMW92H1c7kWpdIHo8RvmLxN/o2JXTKHp74lUA==}- resolution: {integrity: sha512-PbSqLawLgZBGcOGT3yqWBGn4cX+wh2nt5FuBGdcMHyOhoukmjbhYAl8NT9sE4U38Cm9tqLOIQeOrvzeayM0DLQ==}- engines: {node: '>=20.19.0'}+ resolution: {integrity: sha512-ZvuDDwoIpRK9RPxDXratCpklFO9QZZWndf/sd0VBFb4LEj0jj07UcHK9OCh7V4XiFz2Z89ziyBC2K6tJiDjrbw==}+ engines: {node: ^22.18.0 || >=24.11.0}peerDependencies:- '@ts-macro/tsc': ^0.3.6- '@typescript/native-preview': '>=7.0.0-dev.20260325.1'- rolldown: ^1.0.0-rc.12- typescript: ^5.0.0 || ^6.0.0- vue-tsc: ~3.2.0+ '@typescript/native-preview': '*'+ '@volar/typescript': ~2.4.0+ rolldown: ^1.0.0+ typescript: ^5.0.0 || ^6.0.0 || ~7.0.0+ vue-tsc: ~3.2.0 || ~3.3.0peerDependenciesMeta:- '@ts-macro/tsc':- optional: true'@typescript/native-preview':optional: true+ '@volar/typescript':+ optional: truetypescript:optional: truevue-tsc:@@ -10404,8 +10630,8 @@ packages:engines: {node: ^20.19.0 || >=22.12.0}hasBin: true- resolution: {integrity: sha512-t9z29cJjXf/vxQ8dyhCSpt6H6aSwHTk8cT5I3iy6SMXuFpk5mB6PL6XfC8PCwrPTx93udwKUm9HRteAlTGBLiA==}+ resolution: {integrity: sha512-vMM4q3aixf46GiF1Kok8jDPFsEpXgFWGjUHXNkNHNm+Y2adXAG2dbX91jkti3i0ZRsOlcmbuzAz1poObSHCmUA==}engines: {node: ^20.19.0 || >=22.12.0}hasBin: true@@ -11044,18 +11270,20 @@ packages:resolution: {integrity: sha512-NoZ4roiN7LnbKn9QqE1amc9DJfzvZXxF4xDavcOWt1BPkdx+m+0gJuPM+S0vCe7zTJMYUP0R8pO2XMr+Y8oLIg==}engines: {node: '>=6'}- resolution: {integrity: sha512-3wk73yBhZe/wX7REqSdivNQ84TDs1mJ+IlnzrrEREP70xlJ/AEIzqaI04l/TzMKVIdkTdC3CPaADn2Lk/0SkdA==}- engines: {node: '>=20.19.0'}+ resolution: {integrity: sha512-ule7Y+fsAN2iZbLDoo7C4KYljFJNJJ+fLshyn+9gozeTspVersWHxwdGB+Dm2hzA38s6muFnUTl0jK3vJm9ifQ==}+ engines: {node: ^22.18.0 || >=24.11.0}hasBin: truepeerDependencies:'@arethetypeswrong/core': ^0.18.1- '@tsdown/css': 0.21.10- '@tsdown/exe': 0.21.10+ '@tsdown/css': 0.22.14+ '@tsdown/exe': 0.22.14'@vitejs/devtools': '*'- publint: ^0.3.0- typescript: ^5.0.0 || ^6.0.0+ publint: ^0.3.8+ tsx: '*'+ typescript: ^5.0.0 || ^6.0.0 || ^7.0.0unplugin-unused: ^0.5.0+ unrun: '*'peerDependenciesMeta:'@arethetypeswrong/core':optional: true@@ -11067,10 +11295,14 @@ packages:optional: truepublint:optional: true+ tsx:+ optional: truetypescript:optional: trueunplugin-unused:optional: true+ unrun:+ optional: trueresolution: {integrity: sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==}@@ -11127,11 +11359,16 @@ packages:resolution: {integrity: sha512-EOPFbyIub4ngnEdqi2yOcNeDLaX/0jcE1JoAXQDDMIthap7FoN795lc/SHfIq2d416VufXpM8z/lD+WRm2gfOQ==}- resolution: {integrity: sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==}+ resolution: {integrity: sha512-y2TvuxSZPDyQakkFRPZHKFm+KKVqIisdg9/CZwm9ftvKXLP8NRWj38/ODjNbr43SsoXqNuAisEf1GdCxqWcdBw==}engines: {node: '>=14.17'}hasBin: true+ resolution: {integrity: sha512-8FYau96o3NKOhbjKi/qNvG/W5jhzxkbdm5sj9AbZ/5T5sWqn3hJgLfGx27sRKZWTvyzCP8dLRBTf5tBTSRVUNA==}+ engines: {node: '>=16.20.0'}+ hasBin: true+resolution: {integrity: sha512-rvKSBiC5zqCCiDZ9kAOszZcDvdAHwwIKJG33Ykj43OKcWsnmcBRL09YTU4nOeHZ8Y2a7l1MgTd08SBe9A8Qj6A==}engines: {node: '>=18'}@@ -11306,6 +11543,10 @@ packages:resolution: {integrity: sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg==}engines: {node: '>= 0.8'}+ resolution: {integrity: sha512-zj/ob3UsvJGN0whEAKFp53REA5X66hvffVqoCtVQAakJKnKlH+/PcOfMoFwIG/o4rElqLv/ycAFlx8ZlXUorCg==}+ engines: {node: '>=18.12.0'}+resolution: {integrity: sha512-5yXvWDEgqeiYiBe1lbxYF7UMAIm/IcopxMHrMQDq3nvKcjPKIhZklUKL+AE7J7uApI4kwe2snsK+eI6UTj9EHg==}@@ -11649,6 +11890,15 @@ packages:resolution: {integrity: sha512-CzhO+pFNo8ajLM2d2IW/R93ipy99LWjtwblvC1RsoSUMZgyLbYFr221TnSNT7GjGdYui6P459mw9JH/g/zW2ug==}engines: {node: '>=18'}+ resolution: {integrity: sha512-h6+4bDfyootiMB9vckk5uKo5r5j0GHrkr17FQTDNfEsFT3DWlN9uu1HJwQwc64pgmLCI945fWM3lbTIqxjT3GQ==}++ resolution: {integrity: sha512-adwDZSh8oVDzhE6Du9PwVWxcOxeV0e2EVhUuMKWfhSY4wkrDq9eqixlxFF3l/XGUV1E7UFzhpz9393MUumkyNw==}++ resolution: {integrity: sha512-vRD9nwt4L3aYpxNqeSC4WqLv58xrXef0Ong1Mc45CTXTIpvLafx7JO05sczmQZwdLEZvywrLOGdNC5+Rp5N1BQ==}+resolution: {integrity: sha512-O/PgfnpT1xKSDeQYSCfRI5Gy3hPf91mKVDuYLUHZJMiDFptvP41MSnWofm8dnCm0256ZNfZIM7DSzuSMAFnjHA==}peerDependencies:@@ -11757,15 +12007,6 @@ snapshots:'@jridgewell/trace-mapping': 0.3.31jsesc: 3.1.0- '@babel/[email protected]':- dependencies:- '@babel/parser': 8.0.4- '@babel/types': 8.0.4- '@jridgewell/gen-mapping': 0.3.13- '@jridgewell/trace-mapping': 0.3.31- '@types/jsesc': 2.5.1- jsesc: 3.1.0-'@babel/[email protected]':dependencies:'@babel/types': 7.29.7@@ -11840,14 +12081,8 @@ snapshots:'@babel/[email protected]': {}- '@babel/[email protected]': {}-'@babel/[email protected]': {}- '@babel/[email protected]': {}-- '@babel/[email protected]': {}-'@babel/[email protected]': {}'@babel/[email protected]':@@ -11859,14 +12094,6 @@ snapshots:dependencies:'@babel/types': 7.29.7- '@babel/[email protected]':- dependencies:- '@babel/types': 8.0.4-- '@babel/[email protected]':- dependencies:- '@babel/types': 8.0.4-'@babel/[email protected](@babel/[email protected])':dependencies:'@babel/core': 7.29.7@@ -11937,49 +12164,39 @@ snapshots:'@babel/helper-string-parser': 7.29.7'@babel/helper-validator-identifier': 7.29.7- '@babel/[email protected]':- dependencies:- '@babel/helper-string-parser': 8.0.0- '@babel/helper-validator-identifier': 8.0.4-- '@babel/[email protected]':- dependencies:- '@babel/helper-string-parser': 8.0.0- '@babel/helper-validator-identifier': 8.0.4-- '@biomejs/[email protected]':+ '@biomejs/[email protected]':optionalDependencies:- '@biomejs/cli-darwin-arm64': 2.4.15- '@biomejs/cli-darwin-x64': 2.4.15- '@biomejs/cli-linux-arm64': 2.4.15- '@biomejs/cli-linux-arm64-musl': 2.4.15- '@biomejs/cli-linux-x64': 2.4.15- '@biomejs/cli-linux-x64-musl': 2.4.15- '@biomejs/cli-win32-arm64': 2.4.15- '@biomejs/cli-win32-x64': 2.4.15+ '@biomejs/cli-darwin-arm64': 2.5.11+ '@biomejs/cli-darwin-x64': 2.5.11+ '@biomejs/cli-linux-arm64': 2.5.11+ '@biomejs/cli-linux-arm64-musl': 2.5.11+ '@biomejs/cli-linux-x64': 2.5.11+ '@biomejs/cli-linux-x64-musl': 2.5.11+ '@biomejs/cli-win32-arm64': 2.5.11+ '@biomejs/cli-win32-x64': 2.5.11- '@biomejs/[email protected]':+ '@biomejs/[email protected]':optional: true- '@biomejs/[email protected]':+ '@biomejs/[email protected]':optional: true- '@biomejs/[email protected]':+ '@biomejs/[email protected]':optional: true- '@biomejs/[email protected]':+ '@biomejs/[email protected]':optional: true- '@biomejs/[email protected]':+ '@biomejs/[email protected]':optional: true- '@biomejs/[email protected]':+ '@biomejs/[email protected]':optional: true- '@biomejs/[email protected]':+ '@biomejs/[email protected]':optional: true- '@biomejs/[email protected]':+ '@biomejs/[email protected]':optional: true'@borewit/[email protected]': {}@@ -13305,7 +13522,7 @@ snapshots:transitivePeerDependencies:- supports-colordependencies:'@babel/core': 7.29.7'@babel/generator': 7.29.7@@ -13330,7 +13547,7 @@ snapshots:tinypool: 2.1.0optionalDependencies:esbuild: 0.28.1- rolldown: 1.1.5+ rolldown: 1.2.6transitivePeerDependencies:- babel-plugin-macros- supports-color@@ -13430,17 +13647,17 @@ snapshots:transitivePeerDependencies:- supports-color- '@memlab/[email protected]([email protected])':+ '@memlab/[email protected]([email protected])':dependencies:- '@memlab/core': 2.0.4([email protected])- '@memlab/e2e': 2.0.4([email protected])- '@memlab/heap-analysis': 2.0.4([email protected])+ '@memlab/core': 2.0.4([email protected])+ '@memlab/e2e': 2.0.4([email protected])+ '@memlab/heap-analysis': 2.0.4([email protected])ansi: 0.3.1babar: 0.2.3chalk: 4.1.2fs-extra: 4.0.3minimist: 1.2.8- puppeteer: 24.31.0([email protected])+ puppeteer: 24.31.0([email protected])puppeteer-core: 24.31.0string-width: 4.2.3util.promisify: 1.1.3@@ -13454,19 +13671,19 @@ snapshots:- typescript- utf-8-validate- '@memlab/[email protected]([email protected])':+ '@memlab/[email protected]([email protected])':dependencies:- '@memlab/api': 2.0.4([email protected])- '@memlab/core': 2.0.4([email protected])- '@memlab/e2e': 2.0.4([email protected])- '@memlab/heap-analysis': 2.0.4([email protected])+ '@memlab/api': 2.0.4([email protected])+ '@memlab/core': 2.0.4([email protected])+ '@memlab/e2e': 2.0.4([email protected])+ '@memlab/heap-analysis': 2.0.4([email protected])ansi: 0.3.1babar: 0.2.3blessed: 0.1.81chalk: 4.1.2fs-extra: 4.0.3minimist: 1.2.8- puppeteer: 24.31.0([email protected])+ puppeteer: 24.31.0([email protected])puppeteer-core: 24.31.0string-width: 4.2.3util.promisify: 1.1.3@@ -13480,14 +13697,14 @@ snapshots:- typescript- utf-8-validate- '@memlab/[email protected]([email protected])':+ '@memlab/[email protected]([email protected])':dependencies:ansi: 0.3.1babar: 0.2.3chalk: 4.1.2fs-extra: 4.0.3minimist: 1.2.8- puppeteer: 24.31.0([email protected])+ puppeteer: 24.31.0([email protected])puppeteer-core: 24.31.0string-width: 4.2.3util.promisify: 1.1.3@@ -13501,20 +13718,20 @@ snapshots:- typescript- utf-8-validate- '@memlab/[email protected]([email protected])':+ '@memlab/[email protected]([email protected])':dependencies:'@babel/generator': 7.29.7'@babel/parser': 7.29.7'@babel/template': 7.29.7'@babel/traverse': 7.29.7- '@memlab/core': 2.0.4([email protected])+ '@memlab/core': 2.0.4([email protected])'@memlab/lens': 2.0.4ansi: 0.3.1babar: 0.2.3chalk: 4.1.2fs-extra: 4.0.3minimist: 1.2.8- puppeteer: 24.31.0([email protected])+ puppeteer: 24.31.0([email protected])puppeteer-core: 24.31.0string-width: 4.2.3util.promisify: 1.1.3@@ -13528,16 +13745,16 @@ snapshots:- typescript- utf-8-validate- '@memlab/[email protected]([email protected])':+ '@memlab/[email protected]([email protected])':dependencies:- '@memlab/core': 2.0.4([email protected])- '@memlab/e2e': 2.0.4([email protected])+ '@memlab/core': 2.0.4([email protected])+ '@memlab/e2e': 2.0.4([email protected])ansi: 0.3.1babar: 0.2.3chalk: 4.1.2fs-extra: 4.0.3minimist: 1.2.8- puppeteer: 24.31.0([email protected])+ puppeteer: 24.31.0([email protected])puppeteer-core: 24.31.0string-width: 4.2.3util.promisify: 1.1.3@@ -14014,30 +14231,30 @@ snapshots:'@next/[email protected]': {}- '@next/[email protected]': {}+ '@next/[email protected]': {}- '@next/[email protected]':+ '@next/[email protected]':optional: true- '@next/[email protected]':+ '@next/[email protected]':optional: true- '@next/[email protected]':+ '@next/[email protected]':optional: true- '@next/[email protected]':+ '@next/[email protected]':optional: true- '@next/[email protected]':+ '@next/[email protected]':optional: true- '@next/[email protected]':+ '@next/[email protected]':optional: true- '@next/[email protected]':+ '@next/[email protected]':optional: true- '@next/[email protected]':+ '@next/[email protected]':optional: true'@noble/[email protected]': {}@@ -14361,11 +14578,12 @@ snapshots:'@oxc-project/[email protected]': {}- '@oxc-project/[email protected]': {}+ '@oxc-project/[email protected]':+ optional: true'@oxc-project/[email protected]': {}- '@oxc-project/[email protected]': {}+ '@oxc-project/[email protected]': {}'@oxc-resolver/[email protected]':optional: true@@ -14428,79 +14646,79 @@ snapshots:'@oxc-resolver/[email protected]':optional: true- '@oxlint-tsgolint/[email protected]':+ '@oxlint-tsgolint/[email protected]':optional: true- '@oxlint-tsgolint/[email protected]':+ '@oxlint-tsgolint/[email protected]':optional: true- '@oxlint-tsgolint/[email protected]':+ '@oxlint-tsgolint/[email protected]':optional: true- '@oxlint-tsgolint/[email protected]':+ '@oxlint-tsgolint/[email protected]':optional: true- '@oxlint-tsgolint/[email protected]':+ '@oxlint-tsgolint/[email protected]':optional: true- '@oxlint-tsgolint/[email protected]':+ '@oxlint-tsgolint/[email protected]':optional: true- '@oxlint/[email protected]':+ '@oxlint/[email protected]':optional: true- '@oxlint/[email protected]':+ '@oxlint/[email protected]':optional: true- '@oxlint/[email protected]':+ '@oxlint/[email protected]':optional: true- '@oxlint/[email protected]':+ '@oxlint/[email protected]':optional: true- '@oxlint/[email protected]':+ '@oxlint/[email protected]':optional: true- '@oxlint/[email protected]':+ '@oxlint/[email protected]':optional: true- '@oxlint/[email protected]':+ '@oxlint/[email protected]':optional: true- '@oxlint/[email protected]':+ '@oxlint/[email protected]':optional: true- '@oxlint/[email protected]':+ '@oxlint/[email protected]':optional: true- '@oxlint/[email protected]':+ '@oxlint/[email protected]':optional: true- '@oxlint/[email protected]':+ '@oxlint/[email protected]':optional: true- '@oxlint/[email protected]':+ '@oxlint/[email protected]':optional: true- '@oxlint/[email protected]':+ '@oxlint/[email protected]':optional: true- '@oxlint/[email protected]':+ '@oxlint/[email protected]':optional: true- '@oxlint/[email protected]':+ '@oxlint/[email protected]':optional: true- '@oxlint/[email protected]':+ '@oxlint/[email protected]':optional: true- '@oxlint/[email protected]':+ '@oxlint/[email protected]':optional: true- '@oxlint/[email protected]':+ '@oxlint/[email protected]':optional: true- '@oxlint/[email protected]':+ '@oxlint/[email protected]':optional: true'@panzoom/[email protected]': {}@@ -15448,13 +15666,16 @@ snapshots:'@radix-ui/[email protected]': {}+ '@rolldown/[email protected]':+ optional: true+'@rolldown/[email protected]':optional: true'@rolldown/[email protected]':optional: true- '@rolldown/[email protected]':+ '@rolldown/[email protected]':optional: true'@rolldown/[email protected]':@@ -15463,7 +15684,7 @@ snapshots:'@rolldown/[email protected]':optional: true- '@rolldown/[email protected]':+ '@rolldown/[email protected]':optional: true'@rolldown/[email protected]':@@ -15472,7 +15693,7 @@ snapshots:'@rolldown/[email protected]':optional: true- '@rolldown/[email protected]':+ '@rolldown/[email protected]':optional: true'@rolldown/[email protected]':@@ -15481,7 +15702,7 @@ snapshots:'@rolldown/[email protected]':optional: true- '@rolldown/[email protected]':+ '@rolldown/[email protected]':optional: true'@rolldown/[email protected]':@@ -15490,7 +15711,7 @@ snapshots:'@rolldown/[email protected]':optional: true- '@rolldown/[email protected]':+ '@rolldown/[email protected]':optional: true'@rolldown/[email protected]':@@ -15499,7 +15720,7 @@ snapshots:'@rolldown/[email protected]':optional: true- '@rolldown/[email protected]':+ '@rolldown/[email protected]':optional: true'@rolldown/[email protected]':@@ -15508,7 +15729,7 @@ snapshots:'@rolldown/[email protected]':optional: true- '@rolldown/[email protected]':+ '@rolldown/[email protected]':optional: true'@rolldown/[email protected]':@@ -15517,7 +15738,7 @@ snapshots:'@rolldown/[email protected]':optional: true- '@rolldown/[email protected]':+ '@rolldown/[email protected]':optional: true'@rolldown/[email protected]':@@ -15526,7 +15747,7 @@ snapshots:'@rolldown/[email protected]':optional: true- '@rolldown/[email protected]':+ '@rolldown/[email protected]':optional: true'@rolldown/[email protected]':@@ -15535,7 +15756,7 @@ snapshots:'@rolldown/[email protected]':optional: true- '@rolldown/[email protected]':+ '@rolldown/[email protected]':optional: true'@rolldown/[email protected]':@@ -15544,7 +15765,7 @@ snapshots:'@rolldown/[email protected]':optional: true- '@rolldown/[email protected]':+ '@rolldown/[email protected]':optional: true'@rolldown/[email protected]':@@ -15553,7 +15774,7 @@ snapshots:'@rolldown/[email protected]':optional: true- '@rolldown/[email protected]':+ '@rolldown/[email protected]':optional: true'@rolldown/[email protected]':@@ -15570,20 +15791,13 @@ snapshots:'@napi-rs/wasm-runtime': 1.1.6(@emnapi/[email protected])(@emnapi/[email protected])optional: true- '@rolldown/[email protected]':- dependencies:- '@emnapi/core': 1.11.1- '@emnapi/runtime': 1.11.1- '@napi-rs/wasm-runtime': 1.1.6(@emnapi/[email protected])(@emnapi/[email protected])- optional: true-'@rolldown/[email protected]':optional: true'@rolldown/[email protected]':optional: true- '@rolldown/[email protected]':+ '@rolldown/[email protected]':optional: true'@rolldown/[email protected]':@@ -15592,21 +15806,22 @@ snapshots:'@rolldown/[email protected]':optional: true- '@rolldown/[email protected]':+ '@rolldown/[email protected]':optional: true- '@rolldown/[email protected](@babel/[email protected])(@babel/[email protected])([email protected])([email protected](@types/[email protected])([email protected])([email protected])([email protected])([email protected]))':+ '@rolldown/[email protected](@babel/[email protected])(@babel/[email protected])([email protected])([email protected](@types/[email protected])([email protected])([email protected])([email protected])([email protected]))':dependencies:'@babel/core': 7.29.7picomatch: 4.0.5- rolldown: 1.1.5+ rolldown: 1.2.6optionalDependencies:'@babel/runtime': 7.29.7vite: 8.0.8(@types/[email protected])([email protected])([email protected])([email protected])([email protected])'@rolldown/[email protected]': {}- '@rolldown/[email protected]': {}+ '@rolldown/[email protected]':+ optional: true'@rolldown/[email protected]': {}@@ -15717,7 +15932,7 @@ snapshots:'@standard-schema/[email protected]': {}- '@swc/[email protected]':+ '@swc/[email protected]':dependencies:tslib: 2.8.1@@ -16315,8 +16530,6 @@ snapshots:parse5: 8.0.1undici-types: 7.28.0- '@types/[email protected]': {}-'@types/[email protected]': {}'@types/[email protected]':@@ -16403,6 +16616,66 @@ snapshots:dependencies:'@types/node': 24.13.3+ '@typescript/[email protected]':+ optional: true++ '@typescript/[email protected]':+ optional: true++ '@typescript/[email protected]':+ optional: true++ '@typescript/[email protected]':+ optional: true++ '@typescript/[email protected]':+ optional: true++ '@typescript/[email protected]':+ optional: true++ '@typescript/[email protected]':+ optional: true++ '@typescript/[email protected]':+ optional: true++ '@typescript/[email protected]':+ optional: true++ '@typescript/[email protected]':+ optional: true++ '@typescript/[email protected]':+ optional: true++ '@typescript/[email protected]':+ optional: true++ '@typescript/[email protected]':+ optional: true++ '@typescript/[email protected]':+ optional: true++ '@typescript/[email protected]':+ optional: true++ '@typescript/[email protected]':+ optional: true++ '@typescript/[email protected]':+ optional: true++ '@typescript/[email protected]':+ optional: true++ '@typescript/[email protected]':+ optional: true++ '@typescript/[email protected]':+ optional: true+'@u-wave/[email protected]([email protected])':dependencies:'@types/react': 19.2.17@@ -16418,7 +16691,7 @@ snapshots:d3-selection: 3.0.0d3-transition: 3.0.1([email protected])- '@vercel/[email protected]([email protected](@opentelemetry/[email protected])(@playwright/[email protected])(@types/[email protected])([email protected]([email protected]))([email protected])([email protected]))([email protected]([email protected]))([email protected])([email protected](@types/[email protected])([email protected])([email protected])([email protected])([email protected]))':+ '@vercel/[email protected]([email protected](@opentelemetry/[email protected])(@playwright/[email protected])(@types/[email protected])([email protected]([email protected]))([email protected])([email protected]))([email protected]([email protected]))([email protected])([email protected](@types/[email protected])([email protected])([email protected])([email protected])([email protected]))':dependencies:'@next/env': 16.0.10'@types/md5': 2.3.6@@ -16433,7 +16706,7 @@ snapshots:path-to-regexp: 6.3.0semver: 7.8.5optionalDependencies:- next: 16.2.11(@opentelemetry/[email protected])(@playwright/[email protected])(@types/[email protected])([email protected]([email protected]))([email protected])([email protected])+ next: 16.3.3(@opentelemetry/[email protected])(@playwright/[email protected])(@types/[email protected])([email protected]([email protected]))([email protected])([email protected])react: 19.2.5react-dom: 19.2.5([email protected])vite: 8.0.8(@types/[email protected])([email protected])([email protected])([email protected])([email protected])@@ -16451,12 +16724,12 @@ snapshots:dependencies:'@visimer/core': 0.1.0- '@vitejs/[email protected](@rolldown/[email protected](@babel/[email protected])(@babel/[email protected])([email protected])([email protected](@types/[email protected])([email protected])([email protected])([email protected])([email protected])))([email protected])([email protected](@types/[email protected])([email protected])([email protected])([email protected])([email protected]))':+ '@vitejs/[email protected](@rolldown/[email protected](@babel/[email protected])(@babel/[email protected])([email protected])([email protected](@types/[email protected])([email protected])([email protected])([email protected])([email protected])))([email protected])([email protected](@types/[email protected])([email protected])([email protected])([email protected])([email protected]))':dependencies:'@rolldown/pluginutils': 1.0.0-rc.7vite: 8.0.8(@types/[email protected])([email protected])([email protected])([email protected])([email protected])optionalDependencies:- '@rolldown/plugin-babel': 0.2.2(@babel/[email protected])(@babel/[email protected])([email protected])([email protected](@types/[email protected])([email protected])([email protected])([email protected])([email protected]))+ '@rolldown/plugin-babel': 0.2.2(@babel/[email protected])(@babel/[email protected])([email protected])([email protected](@types/[email protected])([email protected])([email protected])([email protected])([email protected]))babel-plugin-react-compiler: 0.0.0-experimental-a8e64ef-20260402'@vitest/[email protected]':@@ -16512,6 +16785,80 @@ snapshots:'@xterm/[email protected](patch_hash=52e724ea4ed73d38923344d68d2e1e8503110de5870507336fe8b096d92d7d90)': {}+ '@yuku-codegen/[email protected]':+ optional: true++ '@yuku-codegen/[email protected]':+ optional: true++ '@yuku-codegen/[email protected]':+ optional: true++ '@yuku-codegen/[email protected]':+ optional: true++ '@yuku-codegen/[email protected]':+ optional: true++ '@yuku-codegen/[email protected]':+ optional: true++ '@yuku-codegen/[email protected]':+ optional: true++ '@yuku-codegen/[email protected]':+ optional: true++ '@yuku-codegen/[email protected]':+ optional: true++ '@yuku-codegen/[email protected]':+ optional: true++ '@yuku-codegen/[email protected]':+ optional: true++ '@yuku-codegen/[email protected]':+ optional: true++ '@yuku-parser/[email protected]':+ optional: true++ '@yuku-parser/[email protected]':+ optional: true++ '@yuku-parser/[email protected]':+ optional: true++ '@yuku-parser/[email protected]':+ optional: true++ '@yuku-parser/[email protected]':+ optional: true++ '@yuku-parser/[email protected]':+ optional: true++ '@yuku-parser/[email protected]':+ optional: true++ '@yuku-parser/[email protected]':+ optional: true++ '@yuku-parser/[email protected]':+ optional: true++ '@yuku-parser/[email protected]':+ optional: true++ '@yuku-parser/[email protected]':+ optional: true++ '@yuku-parser/[email protected]':+ optional: true++ '@yuku-toolchain/[email protected]': {}+'@zag-js/[email protected]': {}'@zag-js/[email protected]':@@ -16767,12 +17114,6 @@ snapshots:- dependencies:- '@babel/parser': 8.0.4- estree-walker: 3.0.3- pathe: 2.0.3-dependencies:tslib: 2.8.1@@ -16876,8 +17217,6 @@ snapshots:- [email protected]: {}-dependencies:buffer: 5.7.1@@ -16975,10 +17314,6 @@ snapshots:transitivePeerDependencies:- supports-color- dependencies:- '@types/node': 24.13.3-dependencies:run-applescript: 7.1.0@@ -17290,14 +17625,14 @@ snapshots:dependencies:layout-base: 2.0.1dependencies:env-paths: 2.2.1import-fresh: 3.3.1js-yaml: 4.3.1parse-json: 5.2.0optionalDependencies:- typescript: 5.9.3+ typescript: 7.0.2@@ -17698,7 +18033,7 @@ snapshots:optionalDependencies:oxc-resolver: 11.21.3@@ -18390,11 +18725,11 @@ snapshots:dependencies:react: 19.2.5optionalDependencies:- typescript: 5.9.3+ typescript: 7.0.2optional: true@@ -18450,7 +18785,7 @@ snapshots:optional: true- [email protected](@types/[email protected])([email protected]([email protected]))([email protected](@opentelemetry/[email protected])(@playwright/[email protected])(@types/[email protected])([email protected]([email protected]))([email protected])([email protected]))([email protected]([email protected]))([email protected]):+ [email protected](@types/[email protected])([email protected]([email protected]))([email protected](@opentelemetry/[email protected])(@playwright/[email protected])(@types/[email protected])([email protected]([email protected]))([email protected])([email protected]))([email protected]([email protected]))([email protected]):dependencies:'@formatjs/intl-localematcher': 0.6.2'@orama/orama': 3.1.18@@ -18473,20 +18808,20 @@ snapshots:optionalDependencies:'@types/react': 19.2.17lucide-react: 0.503.0([email protected])- next: 16.2.11(@opentelemetry/[email protected])(@playwright/[email protected])(@types/[email protected])([email protected]([email protected]))([email protected])([email protected])+ next: 16.3.3(@opentelemetry/[email protected])(@playwright/[email protected])(@types/[email protected])([email protected]([email protected]))([email protected])([email protected])react: 19.2.5react-dom: 19.2.5([email protected])transitivePeerDependencies:- supports-color- [email protected]([email protected](@types/[email protected])([email protected]([email protected]))([email protected](@opentelemetry/[email protected])(@playwright/[email protected])(@types/[email protected])([email protected]([email protected]))([email protected])([email protected]))([email protected]([email protected]))([email protected]))([email protected](@opentelemetry/[email protected])(@playwright/[email protected])(@types/[email protected])([email protected]([email protected]))([email protected])([email protected]))([email protected])([email protected](@types/[email protected])([email protected])([email protected])([email protected])([email protected])):+ [email protected]([email protected](@types/[email protected])([email protected]([email protected]))([email protected](@opentelemetry/[email protected])(@playwright/[email protected])(@types/[email protected])([email protected]([email protected]))([email protected])([email protected]))([email protected]([email protected]))([email protected]))([email protected](@opentelemetry/[email protected])(@playwright/[email protected])(@types/[email protected])([email protected]([email protected]))([email protected])([email protected]))([email protected])([email protected](@types/[email protected])([email protected])([email protected])([email protected])([email protected])):dependencies:'@mdx-js/mdx': 3.1.1'@standard-schema/spec': 1.1.0chokidar: 5.0.0esbuild: 0.28.1estree-util-value-to-estree: 3.5.0- fumadocs-core: 16.1.0(@types/[email protected])([email protected]([email protected]))([email protected](@opentelemetry/[email protected])(@playwright/[email protected])(@types/[email protected])([email protected]([email protected]))([email protected])([email protected]))([email protected]([email protected]))([email protected])+ fumadocs-core: 16.1.0(@types/[email protected])([email protected]([email protected]))([email protected](@opentelemetry/[email protected])(@playwright/[email protected])(@types/[email protected])([email protected]([email protected]))([email protected])([email protected]))([email protected]([email protected]))([email protected])js-yaml: 4.3.1lru-cache: 11.5.2mdast-util-to-markdown: 2.1.2@@ -18501,31 +18836,31 @@ snapshots:vfile: 6.0.3zod: 4.4.3optionalDependencies:- next: 16.2.11(@opentelemetry/[email protected])(@playwright/[email protected])(@types/[email protected])([email protected]([email protected]))([email protected])([email protected])+ next: 16.3.3(@opentelemetry/[email protected])(@playwright/[email protected])(@types/[email protected])([email protected]([email protected]))([email protected])([email protected])react: 19.2.5vite: 8.0.8(@types/[email protected])([email protected])([email protected])([email protected])([email protected])transitivePeerDependencies:- supports-color- [email protected](@types/[email protected])([email protected](@types/[email protected])([email protected]([email protected]))([email protected](@opentelemetry/[email protected])(@playwright/[email protected])(@types/[email protected])([email protected]([email protected]))([email protected])([email protected]))([email protected]([email protected]))([email protected]))([email protected](@types/[email protected](@types/[email protected]))(@types/[email protected])([email protected]([email protected]))([email protected](@opentelemetry/[email protected])(@playwright/[email protected])(@types/[email protected])([email protected]([email protected]))([email protected])([email protected]))([email protected]([email protected]))([email protected])([email protected]))([email protected]):+ [email protected](@types/[email protected])([email protected](@types/[email protected])([email protected]([email protected]))([email protected](@opentelemetry/[email protected])(@playwright/[email protected])(@types/[email protected])([email protected]([email protected]))([email protected])([email protected]))([email protected]([email protected]))([email protected]))([email protected](@types/[email protected](@types/[email protected]))(@types/[email protected])([email protected]([email protected]))([email protected](@opentelemetry/[email protected])(@playwright/[email protected])(@types/[email protected])([email protected]([email protected]))([email protected])([email protected]))([email protected]([email protected]))([email protected])([email protected]))([email protected]):dependencies:estree-util-value-to-estree: 3.5.0- fumadocs-core: 16.1.0(@types/[email protected])([email protected]([email protected]))([email protected](@opentelemetry/[email protected])(@playwright/[email protected])(@types/[email protected])([email protected]([email protected]))([email protected])([email protected]))([email protected]([email protected]))([email protected])+ fumadocs-core: 16.1.0(@types/[email protected])([email protected]([email protected]))([email protected](@opentelemetry/[email protected])(@playwright/[email protected])(@types/[email protected])([email protected]([email protected]))([email protected])([email protected]))([email protected]([email protected]))([email protected])hast-util-to-estree: 3.1.3hast-util-to-jsx-runtime: 2.3.6remark: 15.0.1remark-rehype: 11.1.2tinyglobby: 0.2.17ts-morph: 27.0.2- typescript: 5.9.3+ typescript: 7.0.2unist-util-visit: 5.1.0optionalDependencies:'@types/react': 19.2.17- fumadocs-ui: 16.1.0(@types/[email protected](@types/[email protected]))(@types/[email protected])([email protected]([email protected]))([email protected](@opentelemetry/[email protected])(@playwright/[email protected])(@types/[email protected])([email protected]([email protected]))([email protected])([email protected]))([email protected]([email protected]))([email protected])([email protected])+ fumadocs-ui: 16.1.0(@types/[email protected](@types/[email protected]))(@types/[email protected])([email protected]([email protected]))([email protected](@opentelemetry/[email protected])(@playwright/[email protected])(@types/[email protected])([email protected]([email protected]))([email protected])([email protected]))([email protected]([email protected]))([email protected])([email protected])transitivePeerDependencies:- supports-color- [email protected](@types/[email protected](@types/[email protected]))(@types/[email protected])([email protected]([email protected]))([email protected](@opentelemetry/[email protected])(@playwright/[email protected])(@types/[email protected])([email protected]([email protected]))([email protected])([email protected]))([email protected]([email protected]))([email protected])([email protected]):+ [email protected](@types/[email protected](@types/[email protected]))(@types/[email protected])([email protected]([email protected]))([email protected](@opentelemetry/[email protected])(@playwright/[email protected])(@types/[email protected])([email protected]([email protected]))([email protected])([email protected]))([email protected]([email protected]))([email protected])([email protected]):dependencies:'@radix-ui/react-accordion': 1.2.12(@types/[email protected](@types/[email protected]))(@types/[email protected])([email protected]([email protected]))([email protected])'@radix-ui/react-collapsible': 1.1.12(@types/[email protected](@types/[email protected]))(@types/[email protected])([email protected]([email protected]))([email protected])@@ -18538,7 +18873,7 @@ snapshots:'@radix-ui/react-slot': 1.3.0(@types/[email protected])([email protected])'@radix-ui/react-tabs': 1.1.13(@types/[email protected](@types/[email protected]))(@types/[email protected])([email protected]([email protected]))([email protected])class-variance-authority: 0.7.1- fumadocs-core: 16.1.0(@types/[email protected])([email protected]([email protected]))([email protected](@opentelemetry/[email protected])(@playwright/[email protected])(@types/[email protected])([email protected]([email protected]))([email protected])([email protected]))([email protected]([email protected]))([email protected])+ fumadocs-core: 16.1.0(@types/[email protected])([email protected]([email protected]))([email protected](@opentelemetry/[email protected])(@playwright/[email protected])(@types/[email protected])([email protected]([email protected]))([email protected])([email protected]))([email protected]([email protected]))([email protected])lodash.merge: 4.6.2postcss-selector-parser: 7.1.4@@ -18549,7 +18884,7 @@ snapshots:tailwind-merge: 3.6.0optionalDependencies:'@types/react': 19.2.17- next: 16.2.11(@opentelemetry/[email protected])(@playwright/[email protected])(@types/[email protected])([email protected]([email protected]))([email protected])([email protected])+ next: 16.3.3(@opentelemetry/[email protected])(@playwright/[email protected])(@types/[email protected])([email protected]([email protected]))([email protected])([email protected])tailwindcss: 4.3.2transitivePeerDependencies:- '@mixedbread/sdk'@@ -18633,6 +18968,10 @@ snapshots:dependencies:resolve-pkg-maps: 1.0.0+ dependencies:+ resolve-pkg-maps: 1.0.0+dependencies:basic-ftp: 5.3.1@@ -19031,7 +19370,7 @@ snapshots:- [email protected]: {}+ [email protected]: {}@@ -19843,20 +20182,20 @@ snapshots:dependencies:- '@memlab/api': 2.0.4([email protected])- '@memlab/cli': 2.0.4([email protected])- '@memlab/core': 2.0.4([email protected])- '@memlab/e2e': 2.0.4([email protected])- '@memlab/heap-analysis': 2.0.4([email protected])+ '@memlab/api': 2.0.4([email protected])+ '@memlab/cli': 2.0.4([email protected])+ '@memlab/core': 2.0.4([email protected])+ '@memlab/e2e': 2.0.4([email protected])+ '@memlab/heap-analysis': 2.0.4([email protected])'@memlab/lens': 2.0.4ansi: 0.3.1babar: 0.2.3chalk: 4.1.2fs-extra: 4.0.3minimist: 1.2.8- puppeteer: 24.43.1([email protected])+ puppeteer: 24.43.1([email protected])puppeteer-core: 24.43.1string-width: 4.2.3util.promisify: 1.1.3@@ -20327,10 +20666,10 @@ snapshots:transitivePeerDependencies:- supports-color- [email protected](@opentelemetry/[email protected])(@playwright/[email protected])(@types/[email protected])([email protected]([email protected]))([email protected])([email protected]):+ [email protected](@opentelemetry/[email protected])(@playwright/[email protected])(@types/[email protected])([email protected]([email protected]))([email protected])([email protected]):dependencies:- '@next/env': 16.2.11- '@swc/helpers': 0.5.15+ '@next/env': 16.3.3+ '@swc/helpers': 0.5.23baseline-browser-mapping: 2.10.43caniuse-lite: 1.0.30001805postcss: 8.5.26@@ -20338,14 +20677,14 @@ snapshots:react-dom: 19.2.5([email protected])styled-jsx: 5.1.6([email protected])optionalDependencies:- '@next/swc-darwin-arm64': 16.2.11- '@next/swc-darwin-x64': 16.2.11- '@next/swc-linux-arm64-gnu': 16.2.11- '@next/swc-linux-arm64-musl': 16.2.11- '@next/swc-linux-x64-gnu': 16.2.11- '@next/swc-linux-x64-musl': 16.2.11- '@next/swc-win32-arm64-msvc': 16.2.11- '@next/swc-win32-x64-msvc': 16.2.11+ '@next/swc-darwin-arm64': 16.3.3+ '@next/swc-darwin-x64': 16.3.3+ '@next/swc-linux-arm64-gnu': 16.3.3+ '@next/swc-linux-arm64-musl': 16.3.3+ '@next/swc-linux-x64-gnu': 16.3.3+ '@next/swc-linux-x64-musl': 16.3.3+ '@next/swc-win32-arm64-msvc': 16.3.3+ '@next/swc-win32-x64-msvc': 16.3.3'@opentelemetry/api': 1.9.1'@playwright/test': 1.59.1sass: 1.51.0@@ -20461,6 +20800,8 @@ snapshots:+ [email protected]: {}+@@ -20596,39 +20937,39 @@ snapshots:'@oxc-resolver/binding-win32-arm64-msvc': 11.21.3'@oxc-resolver/binding-win32-x64-msvc': 11.21.3- [email protected]: {}+ [email protected]: {}optionalDependencies:- '@oxlint-tsgolint/darwin-arm64': 0.23.0- '@oxlint-tsgolint/darwin-x64': 0.23.0- '@oxlint-tsgolint/linux-arm64': 0.23.0- '@oxlint-tsgolint/linux-x64': 0.23.0- '@oxlint-tsgolint/win32-arm64': 0.23.0- '@oxlint-tsgolint/win32-x64': 0.23.0-+ '@oxlint-tsgolint/darwin-arm64': 7.0.2001+ '@oxlint-tsgolint/darwin-x64': 7.0.2001+ '@oxlint-tsgolint/linux-arm64': 7.0.2001+ '@oxlint-tsgolint/linux-x64': 7.0.2001+ '@oxlint-tsgolint/win32-arm64': 7.0.2001+ '@oxlint-tsgolint/win32-x64': 7.0.2001+optionalDependencies:- '@oxlint/binding-android-arm-eabi': 1.66.0- '@oxlint/binding-android-arm64': 1.66.0- '@oxlint/binding-darwin-arm64': 1.66.0- '@oxlint/binding-darwin-x64': 1.66.0- '@oxlint/binding-freebsd-x64': 1.66.0- '@oxlint/binding-linux-arm-gnueabihf': 1.66.0- '@oxlint/binding-linux-arm-musleabihf': 1.66.0- '@oxlint/binding-linux-arm64-gnu': 1.66.0- '@oxlint/binding-linux-arm64-musl': 1.66.0- '@oxlint/binding-linux-ppc64-gnu': 1.66.0- '@oxlint/binding-linux-riscv64-gnu': 1.66.0- '@oxlint/binding-linux-riscv64-musl': 1.66.0- '@oxlint/binding-linux-s390x-gnu': 1.66.0- '@oxlint/binding-linux-x64-gnu': 1.66.0- '@oxlint/binding-linux-x64-musl': 1.66.0- '@oxlint/binding-openharmony-arm64': 1.66.0- '@oxlint/binding-win32-arm64-msvc': 1.66.0- '@oxlint/binding-win32-ia32-msvc': 1.66.0- '@oxlint/binding-win32-x64-msvc': 1.66.0- oxlint-tsgolint: 0.23.0+ '@oxlint/binding-android-arm-eabi': 1.80.0+ '@oxlint/binding-android-arm64': 1.80.0+ '@oxlint/binding-darwin-arm64': 1.80.0+ '@oxlint/binding-darwin-x64': 1.80.0+ '@oxlint/binding-freebsd-x64': 1.80.0+ '@oxlint/binding-linux-arm-gnueabihf': 1.80.0+ '@oxlint/binding-linux-arm-musleabihf': 1.80.0+ '@oxlint/binding-linux-arm64-gnu': 1.80.0+ '@oxlint/binding-linux-arm64-musl': 1.80.0+ '@oxlint/binding-linux-ppc64-gnu': 1.80.0+ '@oxlint/binding-linux-riscv64-gnu': 1.80.0+ '@oxlint/binding-linux-riscv64-musl': 1.80.0+ '@oxlint/binding-linux-s390x-gnu': 1.80.0+ '@oxlint/binding-linux-x64-gnu': 1.80.0+ '@oxlint/binding-linux-x64-musl': 1.80.0+ '@oxlint/binding-openharmony-arm64': 1.80.0+ '@oxlint/binding-win32-arm64-msvc': 1.80.0+ '@oxlint/binding-win32-ia32-msvc': 1.80.0+ '@oxlint/binding-win32-x64-msvc': 1.80.0+ oxlint-tsgolint: 7.0.2001@@ -21147,11 +21488,11 @@ snapshots:- supports-color- utf-8-validatedependencies:'@puppeteer/browsers': 2.10.13chromium-bidi: 11.0.0([email protected])- cosmiconfig: 9.0.2([email protected])+ cosmiconfig: 9.0.2([email protected])devtools-protocol: 0.0.1521046puppeteer-core: 24.31.0typed-query-selector: 2.12.2@@ -21164,11 +21505,11 @@ snapshots:- typescript- utf-8-validatedependencies:'@puppeteer/browsers': 2.13.2chromium-bidi: 14.0.0([email protected])- cosmiconfig: 9.0.2([email protected])+ cosmiconfig: 9.0.2([email protected])devtools-protocol: 0.0.1608973puppeteer-core: 24.43.1typed-query-selector: 2.12.2@@ -21739,21 +22080,17 @@ snapshots:dependencies:- '@babel/generator': 8.0.0-rc.3- '@babel/helper-validator-identifier': 8.0.0-rc.3- '@babel/parser': 8.0.0-rc.3- '@babel/types': 8.0.0-rc.3- ast-kit: 3.0.0- birpc: 4.0.0- dts-resolver: 2.1.3([email protected])- get-tsconfig: 4.14.0- obug: 2.1.3- picomatch: 4.0.5- rolldown: 1.0.0-rc.17+ dts-resolver: 3.0.0([email protected])+ get-tsconfig: 5.0.0-beta.5+ obug: 2.1.4+ rolldown: 1.2.6+ yuku-ast: 0.8.7+ yuku-codegen: 0.8.7+ yuku-parser: 0.8.7optionalDependencies:- typescript: 5.9.3+ typescript: 7.0.2transitivePeerDependencies:- oxc-resolver@@ -21798,27 +22135,28 @@ snapshots:'@rolldown/binding-wasm32-wasi': 1.0.0-rc.17'@rolldown/binding-win32-arm64-msvc': 1.0.0-rc.17'@rolldown/binding-win32-x64-msvc': 1.0.0-rc.17+ optional: truedependencies:- '@oxc-project/types': 0.139.0+ '@oxc-project/types': 0.147.0'@rolldown/pluginutils': 1.0.1optionalDependencies:- '@rolldown/binding-android-arm64': 1.1.5- '@rolldown/binding-darwin-arm64': 1.1.5- '@rolldown/binding-darwin-x64': 1.1.5- '@rolldown/binding-freebsd-x64': 1.1.5- '@rolldown/binding-linux-arm-gnueabihf': 1.1.5- '@rolldown/binding-linux-arm64-gnu': 1.1.5- '@rolldown/binding-linux-arm64-musl': 1.1.5- '@rolldown/binding-linux-ppc64-gnu': 1.1.5- '@rolldown/binding-linux-s390x-gnu': 1.1.5- '@rolldown/binding-linux-x64-gnu': 1.1.5- '@rolldown/binding-linux-x64-musl': 1.1.5- '@rolldown/binding-openharmony-arm64': 1.1.5- '@rolldown/binding-wasm32-wasi': 1.1.5- '@rolldown/binding-win32-arm64-msvc': 1.1.5- '@rolldown/binding-win32-x64-msvc': 1.1.5+ '@rolldown/binding-android-arm-eabi': 1.2.6+ '@rolldown/binding-android-arm64': 1.2.6+ '@rolldown/binding-darwin-arm64': 1.2.6+ '@rolldown/binding-darwin-x64': 1.2.6+ '@rolldown/binding-freebsd-x64': 1.2.6+ '@rolldown/binding-linux-arm-gnueabihf': 1.2.6+ '@rolldown/binding-linux-arm64-gnu': 1.2.6+ '@rolldown/binding-linux-arm64-musl': 1.2.6+ '@rolldown/binding-linux-ppc64-gnu': 1.2.6+ '@rolldown/binding-linux-s390x-gnu': 1.2.6+ '@rolldown/binding-linux-x64-gnu': 1.2.6+ '@rolldown/binding-linux-x64-musl': 1.2.6+ '@rolldown/binding-openharmony-arm64': 1.2.6+ '@rolldown/binding-win32-arm64-msvc': 1.2.6+ '@rolldown/binding-win32-x64-msvc': 1.2.6@@ -21902,13 +22240,13 @@ snapshots:dependencies:- typescript: 5.9.3+ typescript: 7.0.2dependencies:- schema-dts-lib: 1.0.0([email protected])+ schema-dts-lib: 1.0.0([email protected])transitivePeerDependencies:- typescript@@ -21987,7 +22325,7 @@ snapshots:dependencies:'@babel/core': 7.29.7'@babel/parser': 7.29.7@@ -21998,7 +22336,7 @@ snapshots:'@types/validate-npm-package-name': 4.0.2browserslist: 4.28.6commander: 14.0.3- cosmiconfig: 9.0.2([email protected])+ cosmiconfig: 9.0.2([email protected])dedent: 1.7.2deepmerge: 4.3.1diff: 8.0.4@@ -22599,31 +22937,31 @@ snapshots:minimist: 1.2.8strip-bom: 3.0.0dependencies:ansis: 4.3.1cac: 7.0.0defu: 6.1.7empathic: 2.0.1hookable: 6.1.1- import-without-cache: 0.3.3- obug: 2.1.3+ import-without-cache: 0.4.0+ obug: 2.1.4picomatch: 4.0.5- rolldown: 1.0.0-rc.17- semver: 7.8.5+ rolldown: 1.2.6tinyexec: 1.2.4tinyglobby: 0.2.17tree-kill: 1.2.2unconfig-core: 7.5.0- unrun: 0.2.39+ verkit: 0.3.2optionalDependencies:- typescript: 5.9.3+ tsx: 4.23.0+ typescript: 7.0.2+ unrun: 0.2.39transitivePeerDependencies:- - '@ts-macro/tsc'- '@typescript/native-preview'+ - '@volar/typescript'- oxc-resolver- - synckit- vue-tsc@@ -22708,7 +23046,30 @@ snapshots:- [email protected]: {}+ [email protected]: {}++ optionalDependencies:+ '@typescript/typescript-aix-ppc64': 7.0.2+ '@typescript/typescript-darwin-arm64': 7.0.2+ '@typescript/typescript-darwin-x64': 7.0.2+ '@typescript/typescript-freebsd-arm64': 7.0.2+ '@typescript/typescript-freebsd-x64': 7.0.2+ '@typescript/typescript-linux-arm': 7.0.2+ '@typescript/typescript-linux-arm64': 7.0.2+ '@typescript/typescript-linux-loong64': 7.0.2+ '@typescript/typescript-linux-mips64el': 7.0.2+ '@typescript/typescript-linux-ppc64': 7.0.2+ '@typescript/typescript-linux-riscv64': 7.0.2+ '@typescript/typescript-linux-s390x': 7.0.2+ '@typescript/typescript-linux-x64': 7.0.2+ '@typescript/typescript-netbsd-arm64': 7.0.2+ '@typescript/typescript-netbsd-x64': 7.0.2+ '@typescript/typescript-openbsd-arm64': 7.0.2+ '@typescript/typescript-openbsd-x64': 7.0.2+ '@typescript/typescript-sunos-x64': 7.0.2+ '@typescript/typescript-win32-arm64': 7.0.2+ '@typescript/typescript-win32-x64': 7.0.2@@ -22801,6 +23162,7 @@ snapshots:dependencies:rolldown: 1.0.0-rc.17+ optional: truedependencies:@@ -22883,6 +23245,8 @@ snapshots:+ [email protected]: {}+dependencies:'@types/unist': 3.0.3@@ -23181,6 +23545,45 @@ snapshots:+ dependencies:+ '@yuku-toolchain/types': 0.8.7++ dependencies:+ '@yuku-toolchain/types': 0.8.7+ optionalDependencies:+ '@yuku-codegen/binding-android-arm64': 0.8.7+ '@yuku-codegen/binding-darwin-arm64': 0.8.7+ '@yuku-codegen/binding-darwin-x64': 0.8.7+ '@yuku-codegen/binding-freebsd-x64': 0.8.7+ '@yuku-codegen/binding-linux-arm-gnu': 0.8.7+ '@yuku-codegen/binding-linux-arm-musl': 0.8.7+ '@yuku-codegen/binding-linux-arm64-gnu': 0.8.7+ '@yuku-codegen/binding-linux-arm64-musl': 0.8.7+ '@yuku-codegen/binding-linux-x64-gnu': 0.8.7+ '@yuku-codegen/binding-linux-x64-musl': 0.8.7+ '@yuku-codegen/binding-win32-arm64': 0.8.7+ '@yuku-codegen/binding-win32-x64': 0.8.7++ dependencies:+ '@yuku-toolchain/types': 0.8.7+ yuku-ast: 0.8.7+ optionalDependencies:+ '@yuku-parser/binding-android-arm64': 0.8.7+ '@yuku-parser/binding-darwin-arm64': 0.8.7+ '@yuku-parser/binding-darwin-x64': 0.8.7+ '@yuku-parser/binding-freebsd-x64': 0.8.7+ '@yuku-parser/binding-linux-arm-gnu': 0.8.7+ '@yuku-parser/binding-linux-arm-musl': 0.8.7+ '@yuku-parser/binding-linux-arm64-gnu': 0.8.7+ '@yuku-parser/binding-linux-arm64-musl': 0.8.7+ '@yuku-parser/binding-linux-x64-gnu': 0.8.7+ '@yuku-parser/binding-linux-x64-musl': 0.8.7+ '@yuku-parser/binding-win32-arm64': 0.8.7+ '@yuku-parser/binding-win32-x64': 0.8.7+dependencies:zod: 3.25.76diff --git a/pnpm-workspace.yaml b/pnpm-workspace.yamlindex 7e62efdda..0ae06fc08 100644--- a/pnpm-workspace.yaml+++ b/pnpm-workspace.yaml@@ -59,8 +59,14 @@ overrides:# effect. pnpm applies an out-of-range override silently; these are the ones# that would not surface on their own.#- # `next` is floored at the advisory patch line rather than its declared `^16`- # caret, to keep this a security-only change (a bare caret takes it to 16.3.x).+ # `next` is floored at ~16.3.x, the first line on which Next type-checks+ # through the project-local `tsc` CLI instead of the JavaScript compiler API+ # that TypeScript 7 no longer ships. A 16.2.x build under TypeScript 7 does not+ # merely fail: it shells out an unsolicited `pnpm add -D typescript` inside the+ # repo (firing the husky prepare + postinstall hooks) before dying with an+ # opaque worker error, and `ignoreBuildErrors` does not suppress it. So this+ # floor moves in lockstep with the compiler, never after it. From here the line+ # is security-only again -- a bare `^16` caret would float to the next minor.## `vite` is deliberately absent. 8.0.16 pulls rolldown 1.0.0-rc.15 -> 1.0.3,# which re-partitions chunks and moves ~253 kB gzipped into the app's main@@ -86,7 +92,7 @@ overrides:'nanoid@3': ~3.3.18'nanoid@4': ~5.1.16'nanoid@5': ~5.1.16- 'next@16': ~16.2.11+ 'next@16': ~16.3.3'postcss@8': ~8.5.23'[email protected]': ~0.35.0'tar@7': ~7.5.21diff --git a/scripts/check-override-floors.test.mjs b/scripts/check-override-floors.test.mjsindex 280831d0c..d6f7bd97f 100644--- a/scripts/check-override-floors.test.mjs+++ b/scripts/check-override-floors.test.mjs@@ -119,7 +119,9 @@ describe('parsePackagePatterns / expandPackagePattern', () => {const root = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..');it('reads the block the real workspace uses', () => {- expect(parsePackagePatterns("packages:\n - 'packages/*'\n - 'docs'\n\noverrides:\n a: 1.0.0\n")).toEqual({+ expect(+ parsePackagePatterns("packages:\n - 'packages/*'\n - 'docs'\n\noverrides:\n a: 1.0.0\n"),+ ).toEqual({patterns: ['packages/*', 'docs'],unparsed: [],});@@ -128,15 +130,24 @@ describe('parsePackagePatterns / expandPackagePattern', () => {it('reads the REAL block, not just a synthetic one', () => {const yamlText = fs.readFileSync(path.join(root, 'pnpm-workspace.yaml'), 'utf8');const { patterns, unparsed } = parsePackagePatterns(yamlText);+ const afterHeader = yamlText.split('\n').slice(yamlText.split('\n').indexOf('packages:') + 1);+ const blockEnd = afterHeader.findIndex((line) => line.trim() !== '' && !/^\s/.test(line));+ const listedEntries = afterHeader+ .slice(0, blockEnd === -1 ? afterHeader.length : blockEnd)+ .filter((line) => line.trim().startsWith('-'));+expect(unparsed).toEqual([]);- expect(patterns).toEqual(['packages/*', 'docs']);+ expect(patterns).toEqual(['packages/*', 'docs', 'packages/md-conformance/md-audit']);+ expect(patterns).toHaveLength(listedEntries.length);expect(expandPackagePattern(root, 'packages/*')?.length).toBe(fs.readdirSync(path.join(root, 'packages')).length,);});it('keeps a pattern that grew a trailing comment', () => {- expect(parsePackagePatterns("packages:\n - 'packages/*' # both roots\n").patterns).toEqual(['packages/*']);+ expect(parsePackagePatterns("packages:\n - 'packages/*' # both roots\n").patterns).toEqual([+ 'packages/*',+ ]);});it('reports a list entry it cannot read instead of dropping it', () => {@@ -171,7 +182,16 @@ describe('rangeFloor', () => {});it('declines rather than guesses on anything else', () => {- for (const range of ['*', 'latest', '>1.0.0 <2.0.0', '1.x', '^1.2', 'workspace:*', '', '^18 || ^19']) {+ for (const range of [+ '*',+ 'latest',+ '>1.0.0 <2.0.0',+ '1.x',+ '^1.2',+ 'workspace:*',+ '',+ '^18 || ^19',+ ]) {expect(rangeFloor(range)).toBeNull();}});@@ -225,7 +245,11 @@ describe('findFloorViolations', () => {});it('reads peerDependencies, the only place React libraries declare a floor', () => {- const lib = { name: 'some-react-lib', version: '1.0.0', peerDependencies: { react: '^19.3.0' } };+ const lib = {+ name: 'some-react-lib',+ version: '1.0.0',+ peerDependencies: { react: '^19.3.0' },+ };const found = findFloorViolations(new Map([['react', '19.2.5']]), [lib]);expect(found).toHaveLength(1);expect(found[0]).toMatchObject({ field: 'peerDependencies', dep: 'react', floor: '19.3.0' });@@ -283,7 +307,9 @@ describe('findFloorViolations', () => {});it('reports each dependant once even when the manifest is seen repeatedly', () => {- expect(findFloorViolations(new Map([['@codemirror/state', '6.6.0']]), [view, view, view])).toHaveLength(1);+ expect(+ findFloorViolations(new Map([['@codemirror/state', '6.6.0']]), [view, view, view]),+ ).toHaveLength(1);});it('names a versionless manifest without an undefined in it', () => {@@ -296,14 +322,20 @@ describe('findFloorViolations', () => {});it('tolerates manifests with no dependency fields', () => {- expect(findFloorViolations(new Map([['a', '1.0.0']]), [{ name: 'x', version: '1' }, null])).toEqual([]);+ expect(+ findFloorViolations(new Map([['a', '1.0.0']]), [{ name: 'x', version: '1' }, null]),+ ).toEqual([]);});});describe('collectViolations', () => {it('gives the workspace bucket the wider field list and the installed bucket the narrower one', () => {const third = { name: 'third-party', version: '1.0.0', devDependencies: { pinned: '^2.0.0' } };- const member = { name: '@inkeep/member', version: '0.1.0', devDependencies: { pinned: '^2.0.0' } };+ const member = {+ name: '@inkeep/member',+ version: '0.1.0',+ devDependencies: { pinned: '^2.0.0' },+ };const found = collectViolations(new Map([['pinned', '1.0.0']]), {installed: [third],workspace: [member],@@ -330,7 +362,9 @@ describe('workspaceManifests', () => {it('reports an empty corpus even though the root always parses', () => {const empty = [];const yielded = [- ...workspaceManifests(root, 'packages: # roots\n - undetected\n', refuse, (p) => empty.push(p)),+ ...workspaceManifests(root, 'packages: # roots\n - undetected\n', refuse, (p) =>+ empty.push(p),+ ),];expect(yielded.map((m) => m.name)).toEqual(['open-knowledge']);expect(empty).toEqual(['the packages: block itself']);@@ -341,7 +375,9 @@ describe('workspaceManifests', () => {try {fs.mkdirSync(path.join(tmp, 'pkgs', 'half-deleted'), { recursive: true });const empty = [];- const yielded = [...workspaceManifests(tmp, "packages:\n - 'pkgs/*'\n", refuse, (p) => empty.push(p))];+ const yielded = [+ ...workspaceManifests(tmp, "packages:\n - 'pkgs/*'\n", refuse, (p) => empty.push(p)),+ ];expect(empty).toEqual(['pkgs/*']);expect(yielded).toEqual([]);} finally {@@ -352,7 +388,9 @@ describe('workspaceManifests', () => {it('names the pattern that went empty, not just the total', () => {const empty = [];const yaml = "packages:\n - 'workspaces/*'\n - 'docs'\n";- const names = [...workspaceManifests(root, yaml, refuse, (p) => empty.push(p))].map((m) => m.name);+ const names = [...workspaceManifests(root, yaml, refuse, (p) => empty.push(p))].map(+ (m) => m.name,+ );expect(empty).toEqual(['workspaces/*']);expect(names).toContain('@inkeep/open-knowledge-docs');});@@ -365,5 +403,4 @@ describe('wiring', () => {const pkg = JSON.parse(fs.readFileSync(path.join(root, 'package.json'), 'utf8'));expect(pkg.scripts['check:drift:guards']).toContain('node scripts/check-override-floors.mjs');});-});diff --git a/scripts/check-typescript-resolution.mjs b/scripts/check-typescript-resolution.mjsnew file mode 100644index 000000000..87f9989e5--- /dev/null+++ b/scripts/check-typescript-resolution.mjs@@ -0,0 +1,844 @@+#!/usr/bin/env node++import { execFileSync } from 'node:child_process';+import fs from 'node:fs';+import path from 'node:path';+import process from 'node:process';+import { pathToFileURL } from 'node:url';+import { expandPackagePattern, parsePackagePatterns } from './check-override-floors.mjs';+import { readJsoncOrError } from './read-jsonc.mjs';++export const GATE_LINE = '7.0';+export const SHIM_LINE = '6.0';++const VERSION_LINE = /^(\d+\.\d+)\./;++export function versionLine(version) {+ const m = VERSION_LINE.exec(String(version ?? ''));+ return m ? m[1] : null;+}++export function checkRoot({ binVersion, shimVersion, tsserverBytes }) {+ const violations = [];+ if (versionLine(binVersion) !== GATE_LINE) {+ violations.push(+ `the root \`tsc\` bin reports ${binVersion ?? 'nothing'}, not ${GATE_LINE}.x. The @typescript/native alias is what puts the Go compiler on the root bin path; without it a root-level \`pnpm exec tsc\` silently checks on the shim.`,+ );+ }+ if (versionLine(shimVersion) !== SHIM_LINE) {+ violations.push(+ `the root \`typescript\` package is ${shimVersion ?? 'absent'}, not ${SHIM_LINE}.x. That dependency exists only to supply lib/tsserver.js to typescript-language-server; TypeScript 7 ships no tsserver, so dropping or bumping it sends every language server to a machine-global fallback.`,+ );+ } else if (!(tsserverBytes > 0)) {+ violations.push(+ 'the root typescript/lib/tsserver.js is missing or empty. The @typescript/typescript6 compat shim has this shape and is why it cannot be used here.',+ );+ }+ return violations;+}++export function checkMember({ name, dir, declaredRange, resolvedVersion, binVersion, scripts }) {+ const violations = [];+ const where = `${name} (${dir})`;+ if (declaredRange) {+ if (versionLine(resolvedVersion) !== GATE_LINE) {+ violations.push(+ `${where} declares typescript ${declaredRange} but resolves ${resolvedVersion ?? 'nothing'}, not ${GATE_LINE}.x.`,+ );+ }+ if (versionLine(binVersion) !== GATE_LINE) {+ violations.push(+ `${where} runs a \`tsc\` reporting ${binVersion ?? 'nothing'}, not ${GATE_LINE}.x.`,+ );+ }+ return violations;+ }+ const tscScripts = Object.entries(scripts ?? {}).filter(([, body]) =>+ /(^|[\s&|;(])(?:[^\s&|;()]*\/)?(tsc|tsgo)(\s|$)/.test(String(body)),+ );+ for (const [script, body] of tscScripts) {+ violations.push(+ `${where} runs \`tsc\` in its \`${script}\` script (${body}) without declaring typescript. The binary then resolves by walking up to the workspace root, so this gate checks on whatever the root's @typescript/native alias happens to be rather than on a version this package declares, and any typescript API it imports resolves to the root's ${SHIM_LINE}.x language-server shim instead.`,+ );+ }+ return violations;+}++export const SOURCE_CONDITION = '@inkeep/source';++export function checkConditions({ baseConditions, declarationBuild }) {+ const violations = [];+ for (const file of declarationBuild.missing) {+ violations.push(+ `${file} does not exist, but its package.json points a types entry at an emitted declaration. Nothing resets the base's source condition for that emit, so this gate cannot see whether the published file resolves for an npm consumer.`,+ );+ }+ if (+ !Array.isArray(baseConditions) ||+ baseConditions.length !== 1 ||+ baseConditions[0] !== SOURCE_CONDITION+ ) {+ violations.push(+ `the base tsconfig declares customConditions ${JSON.stringify(baseConditions ?? null)}, not ["${SOURCE_CONDITION}"]. That condition is what makes a leaf typecheck resolve a sibling to its src rather than to a dist that may not exist yet; dropping it turns every per-package \`tsc --noEmit\` into a build-first command without any of them changing.`,+ );+ }+ for (const [file, conditions] of declarationBuild.configs) {+ if (!Array.isArray(conditions) || conditions.length !== 0) {+ violations.push(+ `${file} declares customConditions ${JSON.stringify(conditions ?? null)}, not []. A config that emits a published declaration must reset the base's source condition, or it bakes ../<sibling>/src/*.ts paths into the emitted .d.mts and the published file stops resolving for an npm consumer.`,+ );+ }+ }+ return violations;+}++export const BASE_TSCONFIG = 'tsconfig.json';+export const RESET_TSCONFIGS = ['tsconfig.build.json', 'tsconfig.check.json'];+export function outputDirRules(gitignoreText) {+ const names = new Set();+ const prefixes = [];+ const anchored = new Set();+ for (const raw of gitignoreText.split('\n')) {+ const line = raw.trim();+ if (line === '' || line.startsWith('#') || line.startsWith('!') || !line.endsWith('/'))+ continue;+ const rooted = line.startsWith('/');+ const pattern = line.replace(/^\//, '').slice(0, -1);+ if (rooted || pattern.includes('/')) {+ if (!pattern.includes('*')) anchored.add(pattern);+ continue;+ }+ if (pattern.endsWith('-*')) prefixes.push(pattern.slice(0, -1));+ else if (!pattern.includes('*')) names.add(pattern);+ }+ return { names, prefixes, anchored };+}++export const NESTED_BUILD_OUTPUTS = ['packages/native-config/target'];++function outputDirRulesForRoot(root) {+ const gitignore = path.join(root, '.gitignore');+ const rules = outputDirRules(fs.existsSync(gitignore) ? fs.readFileSync(gitignore, 'utf8') : '');+ for (const p of NESTED_BUILD_OUTPUTS) rules.anchored.add(p);+ return rules;+}++function skipsDirectory(rules, name, relativePath) {+ return (+ rules.names.has(name) ||+ rules.prefixes.some((prefix) => name.startsWith(prefix)) ||+ rules.anchored.has(relativePath)+ );+}+const CANONICAL_RESET_DIRS = [+ { label: 'packages/<package>', matches: (dir) => /^packages\/[^/]+$/.test(dir) },+ {+ label: 'packages/md-conformance/md-audit',+ matches: (dir) => dir === 'packages/md-conformance/md-audit',+ },+ { label: 'docs', matches: (dir) => dir === 'docs' },+];+const isCanonicalResetDir = (dir) => CANONICAL_RESET_DIRS.some((d) => d.matches(dir));++export function checkTsconfigConditions(sites, asserted = []) {+ const elsewhere = new Set(asserted);+ const violations = [];+ for (const [file, conditions] of sites) {+ if (file === BASE_TSCONFIG || elsewhere.has(file)) continue;+ const name = file.split('/').pop();+ const dir = file.slice(0, -(name.length + 1));+ if (RESET_TSCONFIGS.includes(name) && !isCanonicalResetDir(dir)) {+ violations.push(+ `${file} declares customConditions ${JSON.stringify(conditions ?? null)} but sits outside the canonical locations a reset may live in (${CANONICAL_RESET_DIRS.map((d) => d.label).join(' or ')}); a reset is only recognised there, so move it or drop the key.`,+ );+ continue;+ }+ if (RESET_TSCONFIGS.includes(name)) {+ if (Array.isArray(conditions) && conditions.length === 0) continue;+ violations.push(+ `${file} declares customConditions ${JSON.stringify(conditions ?? null)}, not []. A ${name} exists to reset the base's source condition for a program that has to resolve siblings from their built declarations, so any other value there sends that program back to ../<sibling>/src while still carrying the name of a reset config.`,+ );+ continue;+ }+ violations.push(+ `${file} declares customConditions ${JSON.stringify(conditions ?? null)}. A child tsconfig REPLACES the base array rather than merging with it, so this key moves its whole program off the base's ["${SOURCE_CONDITION}"] resolution and onto dist, and neither the base check nor the declaration build config check can see it from ${BASE_TSCONFIG} and the build configs alone. Only the root ${BASE_TSCONFIG} may declare the source condition, and only a ${RESET_TSCONFIGS.join(' or ')} may reset it to []; delete the key here.`,+ );+ }+ return violations;+}++const DTS_KEY = /\bdts:\s*/g;+const DTS_LITERAL = /^(?:false|true)\b/;+const UNBUNDLE_BINDING = /\bunbundle:\s*(false|true)\b/;+const BUILD_TSCONFIG_BINDING = /tsconfig:\s*['"`](?:\.\/)?tsconfig\.build\.json['"`]/;+const DEFINE_CONFIG_CALL = 'defineConfig(';++export const CONFIG_ABSENT = Symbol('tsdown.config.ts does not exist');++function stringEnd(text, start) {+ const quote = text[start];+ let i = start + 1;+ while (i < text.length) {+ if (text[i] === '\\') {+ i += 2;+ continue;+ }+ if (text[i] === quote) return i + 1;+ if (quote === '`' && text[i] === '$' && text[i + 1] === '{') {+ i += 2;+ let open = 1;+ while (i < text.length && open > 0) {+ const c = text[i];+ if (c === '"' || c === "'" || c === '`') {+ i = stringEnd(text, i);+ continue;+ }+ if (c === '{') open += 1;+ else if (c === '}') open -= 1;+ i += 1;+ }+ continue;+ }+ i += 1;+ }+ return text.length;+}++function blankComments(text) {+ let out = '';+ let i = 0;+ while (i < text.length) {+ const c = text[i];+ const d = text[i + 1];+ if (c === '/' && d === '/') {+ const start = i;+ while (i < text.length && text[i] !== '\n') i += 1;+ out += ' '.repeat(i - start);+ continue;+ }+ if (c === '/' && d === '*') {+ const start = i;+ i += 2;+ while (i < text.length && !(text[i] === '*' && text[i + 1] === '/')) i += 1;+ i = Math.min(i + 2, text.length);+ for (let k = start; k < i; k += 1) out += text[k] === '\n' ? '\n' : ' ';+ continue;+ }+ if (c === '"' || c === "'" || c === '`') {+ const end = stringEnd(text, i);+ out += text.slice(i, end);+ i = end;+ continue;+ }+ out += c;+ i += 1;+ }+ return out;+}++function objectEnd(text, start) {+ let depth = 0;+ for (let i = start; i < text.length; i += 1) {+ const c = text[i];+ if (c === '"' || c === "'" || c === '`') {+ i = stringEnd(text, i) - 1;+ continue;+ }+ if (c === '{') depth += 1;+ else if (c === '}') {+ depth -= 1;+ if (depth === 0) return i + 1;+ }+ }+ return null;+}++export function dtsBindings(text) {+ const bindings = [];+ DTS_KEY.lastIndex = 0;+ let match = DTS_KEY.exec(text);+ while (match !== null) {+ const start = match.index + match[0].length;+ if (text[start] === '{') {+ const end = objectEnd(text, start);+ if (end === null) break;+ bindings.push(text.slice(start, end));+ DTS_KEY.lastIndex = end;+ } else {+ const literal = DTS_LITERAL.exec(text.slice(start));+ if (literal !== null) {+ bindings.push(literal[0]);+ DTS_KEY.lastIndex = start + literal[0].length;+ }+ }+ match = DTS_KEY.exec(text);+ }+ return bindings;+}++function splitConfigEntries(code) {+ const call = code.indexOf(DEFINE_CONFIG_CALL);+ if (call === -1) return null;+ let i = call + DEFINE_CONFIG_CALL.length;+ while (i < code.length && /\s/.test(code[i])) i += 1;+ if (code[i] !== '[') return null;+ const texts = [];+ let depth = 0;+ let start = i + 1;+ for (let j = i; j < code.length; j += 1) {+ const c = code[j];+ if (c === '"' || c === "'" || c === '`') {+ j = stringEnd(code, j) - 1;+ continue;+ }+ if (c === '[' || c === '{' || c === '(') {+ depth += 1;+ continue;+ }+ if (c === ']' || c === '}' || c === ')') {+ depth -= 1;+ if (depth === 0) {+ const tail = code.slice(start, j);+ if (tail.trim() !== '') texts.push(tail);+ return texts;+ }+ continue;+ }+ if (c === ',' && depth === 1) {+ texts.push(code.slice(start, j));+ start = j + 1;+ }+ }+ return null;+}++function configEntries(source) {+ const code = blankComments(source);+ const texts = splitConfigEntries(code);+ const describe = (text, label) => {+ const bindings = dtsBindings(text);+ const unbundle = UNBUNDLE_BINDING.exec(text);+ return { label, text, bindings, unbundle: unbundle ? unbundle[1] : null };+ };+ if (texts === null) return [describe(code, null)];+ return texts.map((text, index) => describe(text, `[${index}]`));+}++export function declarationEmitEntries(emitConfigs) {+ const entries = [];+ for (const [file, source] of emitConfigs ?? []) {+ if (typeof source !== 'string') continue;+ for (const entry of configEntries(source)) {+ entries.push({+ file,+ label: entry.label,+ dts: entry.bindings[0] ?? null,+ unbundle: entry.unbundle,+ });+ }+ }+ return entries;+}++export function unbundleCensus(emitConfigs) {+ const entries = declarationEmitEntries(emitConfigs);+ const counted = (value) => entries.filter((entry) => entry.unbundle === value).length;+ return `${entries.length} build entries across them, unbundle true on ${counted('true')} and false on ${counted('false')} and unbound on ${counted(null)}`;+}++export function checkDeclarationEmit(emitConfigs) {+ const violations = [];+ for (const [file, source] of emitConfigs) {+ if (source === CONFIG_ABSENT) {+ violations.push(+ `${file} does not exist, but its package.json points a types entry at an emitted declaration and it builds with tsdown. Nothing then binds that emit to tsconfig.build.json, so this gate cannot see which tsconfig the published declaration was produced under. Refusing to report a pass on a config that is not there.`,+ );+ continue;+ }+ if (typeof source !== 'string') {+ violations.push(+ `${file} could not be read, so this gate cannot tell which tsconfig its declaration emit runs under. Refusing to report a pass on a config it never inspected.`,+ );+ continue;+ }+ for (const entry of configEntries(source)) {+ const where = entry.label === null ? file : `${file} entry ${entry.label}`;+ if (entry.bindings.length === 0) {+ violations.push(+ `${where} binds no dts option, so its declaration emit inherits the base tsconfig and its source condition. tsdown auto-enables the emit per entry when the package declares types, so an entry that binds nothing is not an entry that emits nothing. Bind dts to { tsconfig: 'tsconfig.build.json' }, or to false where that entry emits no declaration.`,+ );+ continue;+ }+ for (const binding of entry.bindings) {+ if (binding === 'false') continue;+ if (!BUILD_TSCONFIG_BINDING.test(binding)) {+ violations.push(+ `${where} emits declarations with dts: ${binding}, which runs the declaration build under the base tsconfig. That config declares the source condition, so the emitted .d.mts resolves siblings from ../<sibling>/src and stops resolving for an npm consumer. The manifest and tsconfig.build.json checks above both stay green through this, which is why it is asserted here.`,+ );+ }+ }+ }+ }+ return violations;+}++export function declarationEmitConfigs(+ root,+ dirs,+ read = readJson,+ readText = readTextOrNull,+ exists = fs.existsSync,+) {+ const entries = [];+ for (const dir of dirs) {+ const manifest = read(path.join(dir, 'package.json'));+ if (!needsDeclarationBuildConfig(manifest)) continue;+ if (!usesTsdown(manifest)) continue;+ const file = `${path.relative(root, dir).split(path.sep).join('/')}/tsdown.config.ts`;+ const absolute = path.join(root, file);+ if (!exists(absolute)) {+ entries.push([file, CONFIG_ABSENT]);+ continue;+ }+ entries.push([file, readText(absolute)]);+ }+ return entries;+}++function usesTsdown(manifest) {+ return Boolean(manifest?.devDependencies?.tsdown ?? manifest?.dependencies?.tsdown);+}++function readTextOrNull(file) {+ try {+ return fs.readFileSync(file, 'utf8');+ } catch {+ return null;+ }+}++function conditionMap(target) {+ return target && typeof target === 'object' && !Array.isArray(target) ? target : null;+}++function sourceConditionWins(target) {+ const conditions = conditionMap(target);+ return conditions !== null && Object.keys(conditions)[0] === SOURCE_CONDITION;+}++function declaresSourceCondition(node) {+ if (!node || typeof node !== 'object') return false;+ if (!Array.isArray(node) && SOURCE_CONDITION in node) return true;+ return Object.values(node).some(declaresSourceCondition);+}++export function sourceConditionSites(manifest) {+ const exports = manifest?.exports;+ if (!exports || (typeof exports !== 'object' && typeof exports !== 'string')) return null;+ if (typeof exports === 'object' && Object.keys(exports).length === 0) return null;+ const map = conditionMap(exports);+ const subpaths =+ map && Object.keys(map).some((key) => key.startsWith('.'))+ ? Object.entries(map)+ : [['.', exports]];+ const name = manifest.name ?? '(unnamed package)';+ if (typeof manifest.private !== 'boolean') {+ return { name, unclassified: true, total: subpaths.length, missing: [], present: [] };+ }+ return {+ name,+ private: manifest.private,+ total: subpaths.length,+ missing: subpaths.filter(([, target]) => !sourceConditionWins(target)).map(([key]) => key),+ present: subpaths.filter(([, target]) => declaresSourceCondition(target)).map(([key]) => key),+ };+}++export function checkSourceCondition(sites) {+ const violations = [];+ if (sites.length === 0) {+ violations.push(+ `no workspace package declares an \`exports\` field, so the source-condition half of the declaration contract would be asserted against an empty corpus. Refusing to report a pass.`,+ );+ return violations;+ }+ for (const site of sites) {+ if (site.unclassified) {+ violations.push(+ `${site.name} declares an \`exports\` field with ${site.total} subpaths but no explicit \`private\` field, so this gate cannot tell which half of the contract applies to it. A private package must resolve every subpath through the "${SOURCE_CONDITION}" condition first, as a conditions map that leads with it, and a published one must carry it on none, and those are opposite requirements. Declare \`private\` rather than leaving this gate to guess.`,+ );+ continue;+ }+ if (site.private && site.missing.length > 0) {+ violations.push(+ `${site.name} is private and ${site.missing.length} of its ${site.total} \`exports\` subpaths (${site.missing.join(', ')}) do not resolve through the "${SOURCE_CONDITION}" condition: each one either omits it, orders another condition ahead of it, is a bare string with no conditions at all, or is a fallback array, whose members this gate does not rank. Conditional exports match in key order and TypeScript always matches \`types\`, so a leaf typecheck of a consumer resolves those subpaths to a built declaration instead of to src, needs a build first, and can pass against a stale dist.`,+ );+ }+ if (!site.private && site.present.length > 0) {+ violations.push(+ `${site.name} is published and ${site.present.length} of its \`exports\` subpaths (${site.present.join(', ')}) declare the "${SOURCE_CONDITION}" condition. That condition points at src, which is not in the published tarball, so any consumer that enables it resolves to files npm never shipped.`,+ );+ }+ }+ return violations;+}++export function collectViolations(+ root,+ members,+ conditions,+ emitConfigs,+ sourceSites,+ tsconfigSites = [],+) {+ return [+ ...checkRoot(root),+ ...members.flatMap((member) => checkMember(member)),+ ...(conditions ? checkConditions(conditions) : []),+ ...checkTsconfigConditions(+ tsconfigSites,+ (conditions?.declarationBuild?.configs ?? []).map(([file]) => file),+ ),+ ...checkDeclarationEmit(emitConfigs),+ ...checkSourceCondition(sourceSites),+ ];+}++function readJson(file) {+ try {+ return JSON.parse(fs.readFileSync(file, 'utf8'));+ } catch {+ return null;+ }+}++function binVersionOf(dir) {+ const bin = path.join(+ dir,+ 'node_modules',+ '.bin',+ process.platform === 'win32' ? 'tsc.cmd' : 'tsc',+ );+ if (!fs.existsSync(bin)) return null;+ try {+ const out = execFileSync(bin, ['--version'], {+ encoding: 'utf8',+ stdio: ['ignore', 'pipe', 'pipe'],+ shell: process.platform === 'win32',+ });+ const m = /Version\s+(\S+)/.exec(out);+ return m ? m[1] : out.trim();+ } catch {+ return null;+ }+}++const EMITTED_DECLARATION = /\.d\.[cm]?ts$/;+const EMITTED_JS = /^.+\/[^/]+\.[cm]?js$/;+const NESTED_DECLARATION = /^.+\/[^/]+\.d\.[cm]?ts$/;++export const NON_TSC_DECLARATIONS = new Set(['@inkeep/open-knowledge-native-config']);++function stringLeaves(node, out = []) {+ if (typeof node === 'string') out.push(node);+ else if (node && typeof node === 'object')+ for (const value of Object.values(node)) stringLeaves(value, out);+ return out;+}++export function publishesDeclarations(manifest) {+ if (NON_TSC_DECLARATIONS.has(manifest?.name)) return false;+ return declarationTargets(manifest).some((target) => EMITTED_DECLARATION.test(target));+}++export function staleNonTscListing(manifest) {+ if (!NON_TSC_DECLARATIONS.has(manifest?.name)) return null;+ const emitted = declarationTargets(manifest).filter((target) => NESTED_DECLARATION.test(target));+ if (emitted.length === 0) return null;+ return `${manifest.name} is listed in NON_TSC_DECLARATIONS but now points a types entry at an emitted declaration (${emitted.join(', ')}); remove it from NON_TSC_DECLARATIONS so its declaration build config is checked like every other publisher's.`;+}++export function emitsAdjacentDeclaration(manifest) {+ return declarationTargets(manifest).some((target) => EMITTED_JS.test(target));+}++export function needsDeclarationBuildConfig(manifest) {+ return publishesDeclarations(manifest) || emitsAdjacentDeclaration(manifest);+}++export function declarationTargets(manifest) {+ return stringLeaves([+ manifest?.exports,+ manifest?.types,+ manifest?.typings,+ manifest?.publishConfig?.exports,+ manifest?.publishConfig?.types,+ manifest?.publishConfig?.typings,+ ]).map((value) => value.replace(/^\.\//, ''));+}++export function declarationBuildConfigs(+ root,+ dirs,+ read = readJson,+ exists = fs.existsSync,+ readConfig = readJsoncOrError,+) {+ const configs = [];+ const missing = [];+ const blind = [];+ for (const dir of dirs) {+ const manifest = read(path.join(dir, 'package.json'));+ const stale = staleNonTscListing(manifest);+ if (stale !== null) blind.push(stale);+ if (!needsDeclarationBuildConfig(manifest)) continue;+ const file = `${path.relative(root, dir).split(path.sep).join('/')}/tsconfig.build.json`;+ const absolute = path.join(root, file);+ if (!exists(absolute)) {+ missing.push(file);+ continue;+ }+ const parsed = readConfig(absolute);+ if (!parsed.ok) {+ blind.push(parsed.reason);+ continue;+ }+ configs.push([file, parsed.value?.compilerOptions?.customConditions ?? null]);+ }+ return { configs, missing, blind };+}++const TSCONFIG_NAME = /^tsconfig[^/]*\.json$/;++export function tsconfigFiles(root, readdir = fs.readdirSync, rules = outputDirRulesForRoot(root)) {+ const files = [];+ const blind = [];+ const relative = (dir) => path.relative(root, dir).split(path.sep).join('/') || '.';+ const walk = (dir) => {+ let entries;+ try {+ entries = readdir(dir, { withFileTypes: true });+ } catch (error) {+ blind.push(+ `${relative(dir)} could not be listed (${error.message}), so a tsconfig that redirects its program to dist resolution could sit there unseen.`,+ );+ return;+ }+ for (const entry of entries) {+ if (entry.isDirectory()) {+ if (+ entry.name === 'node_modules' ||+ entry.name.startsWith('.') ||+ skipsDirectory(rules, entry.name, relative(path.join(dir, entry.name)))+ )+ continue;+ walk(path.join(dir, entry.name));+ continue;+ }+ if (TSCONFIG_NAME.test(entry.name)) files.push(relative(path.join(dir, entry.name)));+ }+ };+ walk(root);+ return { files: files.sort(), blind };+}++export function tsconfigConditions(root, files, readConfig = readJsoncOrError) {+ const sites = [];+ const blind = [];+ for (const file of files) {+ const parsed = readConfig(path.join(root, ...file.split('/')));+ if (!parsed.ok) {+ blind.push(parsed.reason);+ continue;+ }+ const options = parsed.value?.compilerOptions;+ if (options && typeof options === 'object' && 'customConditions' in options) {+ sites.push([file, options.customConditions]);+ }+ }+ return { sites, blind };+}++export function probeMember(dir, readManifest = readJson) {+ const manifest = readManifest(path.join(dir, 'package.json'));+ if (!manifest?.name) {+ return {+ blind: `the package.json at ${dir} is unparseable or declares no name, so this package cannot be probed`,+ };+ }+ const declaredRange =+ manifest.devDependencies?.typescript ?? manifest.dependencies?.typescript ?? null;+ return {+ name: manifest.name,+ dir,+ declaredRange,+ resolvedVersion:+ readJson(path.join(dir, 'node_modules', 'typescript', 'package.json'))?.version ?? null,+ binVersion: declaredRange ? binVersionOf(dir) : null,+ scripts: manifest.scripts ?? null,+ };+}++export function memberDirs(root, yamlText, onUnparsed, onEmptyPattern) {+ const { patterns, unparsed } = parsePackagePatterns(yamlText);+ for (const line of unparsed) onUnparsed(line);+ const dirs = [];+ for (const pattern of patterns) {+ const expanded = expandPackagePattern(root, pattern);+ if (expanded === null) {+ onUnparsed(pattern);+ continue;+ }+ const withManifest = expanded.filter((dir) => fs.existsSync(path.join(dir, 'package.json')));+ if (withManifest.length === 0) onEmptyPattern(pattern);+ dirs.push(...withManifest);+ }+ if (patterns.length === 0) onEmptyPattern('the packages: block itself');+ return [...new Set(dirs)].sort();+}++export function evaluate({+ root,+ rootSource = null,+ rootProbe,+ members,+ gated,+ baseConditions,+ declarationBuild,+ emitConfigs,+ sourceSites,+ tsconfigs = { files: [], sites: [] },+}) {+ const violations = collectViolations(+ rootProbe,+ members,+ { baseConditions, declarationBuild },+ emitConfigs,+ sourceSites,+ tsconfigs.sites,+ );+ if (violations.length === 0) {+ return {+ code: 0,+ violations,+ err: [],+ out: [+ `check-typescript-resolution: OK at ${root}${rootSource === null ? '' : ` [from ${rootSource}]`} (root tsc ${rootProbe.binVersion} over a ${rootProbe.shimVersion} tsserver shim; ${gated.length} of ${members.length} workspace packages declare typescript and all run ${GATE_LINE}.x; base customConditions ["${SOURCE_CONDITION}"] with every one of the ${declarationBuild.configs.length} packages that publish an emitted declaration resetting it, and every one of the ${emitConfigs.length} tsdown configs among them emitting declarations through that reset config, per entry (${unbundleCensus(emitConfigs)}); ${sourceSites.length} packages declare an \`exports\` field and each resolves through the source condition first, or not at all, exactly as its publication status requires; of the ${tsconfigs.files.length} tsconfig files under the root, customConditions appears only in the base ${BASE_TSCONFIG} and in ${RESET_TSCONFIGS.join(' or ')} configs that reset it)`,+ ],+ };+ }+ return {+ code: 1,+ violations,+ out: [],+ err: [+ 'check-typescript-resolution: the declaration and compiler contract this workspace declares does not hold.\n',+ ...violations.map((violation) => ` ${violation}`),+ `\nA compiler-version violation is usually a stale install: run \`pnpm install\` from ${root}, and declare typescript in any package that was added rather than letting resolution walk up to the root shim. A customConditions violation is a tsconfig edit, and the remedy differs by which one fired: the base tsconfig must declare \`customConditions: ["@inkeep/source"]\` so leaf typechecks resolve siblings from source; each declaration build config must extend that base and reset \`customConditions: []\` so the published surface resolves from built declarations instead; a declaration build config that is missing entirely must be added; and every other tsconfig under the root must carry no customConditions key of its own, since a child replaces the base array rather than adding to it. A dts violation is a tsdown edit: bind \`dts\` to \`{ tsconfig: 'tsconfig.build.json' }\` so the declaration emit runs under the reset config rather than the base. Do not answer a base-tsconfig violation by setting \`[]\` there, which is the opposite of what it asks.`,+ ],+ };+}++function main() {+ const rootSource = process.env.OK_RESOLUTION_ROOT ? 'OK_RESOLUTION_ROOT' : null;+ const root = process.env.OK_RESOLUTION_ROOT+ ? path.resolve(process.env.OK_RESOLUTION_ROOT)+ : path.resolve(import.meta.dirname, '..');+ const workspaceFile = path.join(root, 'pnpm-workspace.yaml');+ if (!fs.existsSync(workspaceFile)) {+ console.error(+ `check-typescript-resolution: no pnpm-workspace.yaml beside ${root}. The subtree layout moved.`,+ );+ process.exit(1);+ }+ const blind = [];+ const dirs = memberDirs(+ root,+ fs.readFileSync(workspaceFile, 'utf8'),+ (line) => blind.push(`unrecognised packages: entry ${JSON.stringify(line)}`),+ (pattern) => blind.push(`packages: pattern ${JSON.stringify(pattern)} matched no package.json`),+ );+ const probed = dirs.map((dir) => probeMember(dir));+ for (const entry of probed) {+ if (entry.blind) blind.push(entry.blind);+ }+ if (blind.length > 0) {+ console.error(+ `check-typescript-resolution: cannot enumerate the workspace, so a package could be checked on the wrong compiler unseen. Refusing to report a pass.\n\n ${blind.join('\n ')}`,+ );+ process.exit(1);+ }+ const members = probed;+ const gated = members.filter((member) => member.declaredRange);+ if (gated.length === 0) {+ console.error(+ 'check-typescript-resolution: no workspace package declares typescript. Refusing to report a pass on an empty corpus.',+ );+ process.exit(1);+ }+ const rootProbe = {+ binVersion: binVersionOf(root),+ shimVersion:+ readJson(path.join(root, 'node_modules', 'typescript', 'package.json'))?.version ?? null,+ tsserverBytes: (() => {+ try {+ return fs.statSync(path.join(root, 'node_modules', 'typescript', 'lib', 'tsserver.js'))+ .size;+ } catch {+ return 0;+ }+ })(),+ };+ const declarationBuild = declarationBuildConfigs(root, dirs);+ const baseTsconfig = readJsoncOrError(path.join(root, BASE_TSCONFIG));+ const listed = tsconfigFiles(root);+ const declared = tsconfigConditions(root, listed.files);+ const unreadable = [+ ...new Set([+ ...declarationBuild.blind,+ ...(baseTsconfig.ok ? [] : [baseTsconfig.reason]),+ ...listed.blind,+ ...declared.blind,+ ]),+ ];+ if (unreadable.length > 0) {+ console.error(+ `check-typescript-resolution: cannot read a tsconfig this gate has to inspect, so a resolution violation could pass unseen. Refusing to report a pass.\n\n ${unreadable.join('\n ')}`,+ );+ process.exit(1);+ }+ if (declarationBuild.configs.length === 0 && declarationBuild.missing.length === 0) {+ console.error(+ 'check-typescript-resolution: no workspace package publishes an emitted declaration, so the declaration-build condition reset would be asserted against an empty set. Refusing to report a pass.',+ );+ process.exit(1);+ }+ const baseConditions = baseTsconfig.value?.compilerOptions?.customConditions ?? null;+ const sourceSites = dirs+ .map((dir) => sourceConditionSites(readJson(path.join(dir, 'package.json'))))+ .filter((site) => site !== null);+ const emitConfigs = declarationEmitConfigs(root, dirs);+ if (emitConfigs.length === 0) {+ console.error(+ 'check-typescript-resolution: none of the packages that publish an emitted declaration has a tsdown.config.ts, so the declaration-emit assertion would run against an empty set. Refusing to report a pass.',+ );+ process.exit(1);+ }+ const { code, out, err } = evaluate({+ root,+ rootSource,+ rootProbe,+ members,+ gated,+ baseConditions,+ declarationBuild,+ emitConfigs,+ sourceSites,+ tsconfigs: { files: listed.files, sites: declared.sites },+ });+ for (const line of out) console.log(line);+ for (const line of err) console.error(line);+ if (code !== 0) process.exit(code);+}++if (process.argv[1] && import.meta.url === pathToFileURL(process.argv[1]).href) main();diff --git a/scripts/check-typescript-resolution.test.mjs b/scripts/check-typescript-resolution.test.mjsnew file mode 100644index 000000000..ec04ecc85--- /dev/null+++ b/scripts/check-typescript-resolution.test.mjs@@ -0,0 +1,1683 @@+import { spawnSync } from 'node:child_process';+import fs from 'node:fs';+import os from 'node:os';+import path from 'node:path';+import { fileURLToPath } from 'node:url';+import { describe, expect, it } from 'vitest';+import {+ CONFIG_ABSENT,+ checkConditions,+ checkDeclarationEmit,+ checkMember,+ checkRoot,+ checkSourceCondition,+ checkTsconfigConditions,+ collectViolations,+ declarationBuildConfigs,+ declarationEmitConfigs,+ declarationEmitEntries,+ dtsBindings,+ evaluate,+ GATE_LINE,+ memberDirs,+ NESTED_BUILD_OUTPUTS,+ outputDirRules,+ probeMember,+ publishesDeclarations,+ SHIM_LINE,+ SOURCE_CONDITION,+ sourceConditionSites,+ staleNonTscListing,+ tsconfigConditions,+ tsconfigFiles,+ unbundleCensus,+ versionLine,+} from './check-typescript-resolution.mjs';+import { stripJsonc } from './read-jsonc.mjs';++const OK_ROOT = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..');+const realConfig = (pkg) =>+ fs.readFileSync(path.join(OK_ROOT, 'packages', pkg, 'tsdown.config.ts'), 'utf8');+const withoutLinesMatching = (text, pattern) =>+ text+ .split('\n')+ .filter((line) => !pattern.test(line))+ .join('\n');++const writeTree = (prefix, files) => {+ const dir = fs.mkdtempSync(path.join(os.tmpdir(), prefix));+ for (const [relative, body] of Object.entries(files)) {+ const file = path.join(dir, relative);+ fs.mkdirSync(path.dirname(file), { recursive: true });+ fs.writeFileSync(file, typeof body === 'string' ? body : `${JSON.stringify(body, null, 2)}\n`);+ }+ return dir;+};++const withTree = (files, assertions) => {+ const dir = writeTree('ts-resolution-walk-', files);+ try {+ assertions(dir);+ } finally {+ fs.rmSync(dir, { recursive: true, force: true });+ }+};++const healthyRoot = { binVersion: '7.0.2', shimVersion: '6.0.3', tsserverBytes: 272 };++const gatedMember = (over = {}) => ({+ name: '@inkeep/open-knowledge-core',+ dir: '/ok/packages/core',+ declaredRange: '^7.0.2',+ resolvedVersion: '7.0.2',+ binVersion: '7.0.2',+ scripts: { typecheck: 'tsc --noEmit' },+ ...over,+});++describe('versionLine', () => {+ it('reduces a full version to its minor line', () => {+ expect(versionLine('7.0.2')).toBe('7.0');+ expect(versionLine('6.0.3')).toBe('6.0');+ expect(versionLine('7.1.0-beta.1')).toBe('7.1');+ });++ it('reports no line for a version it cannot read', () => {+ expect(versionLine(null)).toBeNull();+ expect(versionLine('')).toBeNull();+ expect(versionLine('Version 7')).toBeNull();+ });+});++describe('checkRoot', () => {+ it('accepts the gate compiler on the bin over a language-server shim', () => {+ expect(checkRoot(healthyRoot)).toEqual([]);+ });++ it('rejects a root bin that fell back to the shim compiler', () => {+ const [violation] = checkRoot({ ...healthyRoot, binVersion: '6.0.3' });+ expect(violation).toContain('root `tsc` bin reports 6.0.3');+ expect(violation).toContain(`${GATE_LINE}.x`);+ });++ it('rejects a root bin that is absent entirely', () => {+ expect(checkRoot({ ...healthyRoot, binVersion: null })[0]).toContain('reports nothing');+ });++ it('rejects a root shim bumped onto the gate line, which ships no tsserver', () => {+ const [violation] = checkRoot({ ...healthyRoot, shimVersion: '7.0.2' });+ expect(violation).toContain('root `typescript` package is 7.0.2');+ expect(violation).toContain(`${SHIM_LINE}.x`);+ });++ it('rejects a shim whose tsserver entry point is missing or empty', () => {+ expect(checkRoot({ ...healthyRoot, tsserverBytes: 0 })[0]).toContain(+ 'tsserver.js is missing or empty',+ );+ });++ it('reports the wrong-line shim once rather than also reporting its tsserver', () => {+ expect(checkRoot({ ...healthyRoot, shimVersion: '7.0.2', tsserverBytes: 0 })).toHaveLength(1);+ });+});++describe('checkMember', () => {+ it('accepts a package that declares and resolves the gate compiler', () => {+ expect(checkMember(gatedMember())).toEqual([]);+ });++ it('names the package whose resolution silently sits on the shim line', () => {+ const [violation] = checkMember(gatedMember({ resolvedVersion: '6.0.3' }));+ expect(violation).toContain('@inkeep/open-knowledge-core');+ expect(violation).toContain('resolves 6.0.3');+ });++ it('catches a declared range that resolved to nothing at all', () => {+ expect(checkMember(gatedMember({ resolvedVersion: null }))[0]).toContain('resolves nothing');+ });++ it('catches a package whose bin disagrees with its resolved package', () => {+ const [violation] = checkMember(gatedMember({ binVersion: '6.0.3' }));+ expect(violation).toContain('runs a `tsc` reporting 6.0.3');+ });++ it('accepts a package that neither declares typescript nor runs tsc', () => {+ expect(+ checkMember({+ name: '@inkeep/open-knowledge-native-config',+ dir: '/ok/packages/native-config',+ declaredRange: null,+ resolvedVersion: null,+ binVersion: null,+ scripts: { build: 'node scripts/build.mjs --release' },+ }),+ ).toEqual([]);+ });++ it('catches a package that runs tsc without declaring the compiler it runs', () => {+ const [violation] = checkMember({+ name: '@inkeep/open-knowledge-plugin',+ dir: '/ok/packages/plugin',+ declaredRange: null,+ resolvedVersion: null,+ binVersion: null,+ scripts: { typecheck: 'tsc --noEmit' },+ });+ expect(violation).toContain('@inkeep/open-knowledge-plugin');+ expect(violation).toContain('without declaring typescript');+ });++ it('reads a path-qualified tsc, which resolves the same undeclared binary', () => {+ const violations = checkMember({+ name: '@inkeep/example',+ dir: '/ok/packages/example',+ declaredRange: null,+ resolvedVersion: null,+ binVersion: null,+ scripts: { typecheck: 'node_modules/.bin/tsc --noEmit' },+ });+ expect(violations).toHaveLength(1);+ expect(violations[0]).toContain('without declaring typescript');+ });++ it('reads tsgo, the other name the Go compiler ships its binary under', () => {+ const violations = checkMember({+ name: '@inkeep/example',+ dir: '/ok/packages/example',+ declaredRange: null,+ resolvedVersion: null,+ binVersion: null,+ scripts: { typecheck: 'tsgo --noEmit' },+ });+ expect(violations).toHaveLength(1);+ expect(violations[0]).toContain('without declaring typescript');+ });++ it('does not match a lookalike that merely starts with the compiler name', () => {+ expect(+ checkMember({+ name: '@inkeep/example',+ dir: '/ok/packages/example',+ declaredRange: null,+ resolvedVersion: null,+ binVersion: null,+ scripts: { lint: 'tsgo-files --noEmit' },+ }),+ ).toEqual([]);+ });++ it('reads tsc out of a compound script without matching a lookalike command', () => {+ const scripts = {+ typecheck: 'pnpm run typecheck:bash && tsc',+ build: 'tsdown && node scripts/postbuild.mjs',+ lint: 'tsc-files --noEmit',+ };+ const violations = checkMember({+ name: '@inkeep/example',+ dir: '/ok/packages/example',+ declaredRange: null,+ resolvedVersion: null,+ binVersion: null,+ scripts,+ });+ expect(violations).toHaveLength(1);+ expect(violations[0]).toContain('`typecheck` script');+ });+});++const healthyConditions = {+ baseConditions: [SOURCE_CONDITION],+ declarationBuild: {+ configs: [+ ['packages/core/tsconfig.build.json', []],+ ['packages/server/tsconfig.build.json', []],+ ['packages/cli/tsconfig.build.json', []],+ ],+ missing: [],+ },+};++describe('checkConditions', () => {+ it('accepts the split the declaration architecture rests on', () => {+ expect(checkConditions(healthyConditions)).toEqual([]);+ });++ it('reports a base that lost the source condition, which makes every leaf typecheck build-first', () => {+ const [violation] = checkConditions({ ...healthyConditions, baseConditions: [] });+ expect(violation).toContain('the base tsconfig');+ expect(violation).toContain(SOURCE_CONDITION);+ });++ it('reports a declaration build config that inherits the source condition instead of resetting it', () => {+ const violations = checkConditions({+ ...healthyConditions,+ declarationBuild: {+ configs: [+ ['packages/core/tsconfig.build.json', undefined],+ ['packages/server/tsconfig.build.json', [SOURCE_CONDITION]],+ ['packages/cli/tsconfig.build.json', []],+ ],+ missing: [],+ },+ });+ expect(violations).toHaveLength(2);+ expect(violations[0]).toContain('packages/core/tsconfig.build.json');+ expect(violations[1]).toContain('packages/server/tsconfig.build.json');+ });+});++describe('probeMember', () => {+ it('reports a blind reason for a manifest it cannot read, rather than dropping the package', () => {+ const result = probeMember('/ok/packages/broken', () => null);+ expect(result.blind).toContain('/ok/packages/broken');+ expect(result.name).toBeUndefined();+ });++ it('reports a blind reason for a manifest that parses but declares no name', () => {+ expect(probeMember('/ok/packages/nameless', () => ({ type: 'module' })).blind).toBeTruthy();+ });+});++describe('collectViolations', () => {+ const boundEmit = [+ [+ 'packages/core/tsdown.config.ts',+ "export default defineConfig({ dts: { tsconfig: 'tsconfig.build.json' } });",+ ],+ ];+ const sourceSites = [+ { name: '@inkeep/open-knowledge-core', private: true, total: 1, missing: [], present: ['.'] },+ ];++ it('reports nothing for a healthy workspace', () => {+ expect(collectViolations(healthyRoot, [gatedMember()], null, boundEmit, sourceSites)).toEqual(+ [],+ );+ });++ it('reports the root and every offending member together', () => {+ const violations = collectViolations(+ { ...healthyRoot, binVersion: '6.0.3' },+ [+ gatedMember(),+ gatedMember({ name: '@inkeep/open-knowledge-server', resolvedVersion: '6.0.3' }),+ ],+ null,+ boundEmit,+ sourceSites,+ );+ expect(violations).toHaveLength(2);+ expect(violations[0]).toContain('root `tsc` bin');+ expect(violations[1]).toContain('@inkeep/open-knowledge-server');+ });++ it('refuses when the source-condition corpus it was handed is empty', () => {+ const violations = collectViolations(healthyRoot, [gatedMember()], null, boundEmit, []);+ expect(violations).toHaveLength(1);+ expect(violations[0]).toContain('Refusing to report a pass');+ });+});++describe('memberDirs', () => {+ const root = path.resolve(import.meta.dirname, '..');+ const collect = (yaml) => {+ const unparsed = [];+ const empty = [];+ const dirs = memberDirs(+ root,+ yaml,+ (line) => unparsed.push(line),+ (pattern) => empty.push(pattern),+ );+ return { dirs, unparsed, empty };+ };++ it('enumerates the real workspace, nested member and docs included', () => {+ const { dirs, unparsed, empty } = collect(+ fs.readFileSync(path.join(root, 'pnpm-workspace.yaml'), 'utf8'),+ );+ expect(unparsed).toEqual([]);+ expect(empty).toEqual([]);+ const names = dirs.map((dir) => path.relative(root, dir));+ expect(names).toContain('docs');+ expect(names).toContain(path.join('packages', 'md-conformance', 'md-audit'));+ expect(names).toContain(path.join('packages', 'core'));+ expect(dirs.length).toBeGreaterThanOrEqual(8);+ });++ it('keeps enumerating past a comment interleaved in the packages list', () => {+ const withComment = collect(+ "packages:\n - 'docs'\n # a nested package needs its own entry\n\n - 'packages/md-conformance/md-audit'\n",+ );+ const withoutComment = collect(+ "packages:\n - 'docs'\n - 'packages/md-conformance/md-audit'\n",+ );+ expect(withComment.dirs).toEqual(withoutComment.dirs);+ expect(withComment.dirs).toHaveLength(2);+ });++ it('stops at the next top-level key instead of swallowing a later list', () => {+ const { dirs } = collect(+ "packages:\n - 'docs'\n\nminimumReleaseAgeExclude:\n - '@inkeep/*'\n - '@visimer/*'\n",+ );+ expect(dirs.map((dir) => path.relative(root, dir))).toEqual(['docs']);+ });++ it('reports a pattern it cannot expand rather than dropping it silently', () => {+ const { unparsed } = collect("packages:\n - 'docs'\n - 'packages/*/*'\n");+ expect(unparsed).toEqual(['packages/*/*']);+ });++ it('reports a pattern that matched no package.json', () => {+ const { empty } = collect("packages:\n - 'docs'\n - 'no-such-directory'\n");+ expect(empty).toEqual(['no-such-directory']);+ });++ it('reports an empty packages block rather than returning a clean pass', () => {+ const { dirs, empty } = collect('packages:\n\noverrides:\n react: 19.2.5\n');+ expect(dirs).toEqual([]);+ expect(empty).toEqual(['the packages: block itself']);+ });+});++describe('declarationBuildConfigs', () => {+ const publisher = { exports: { '.': { types: './dist/index.d.mts' } } };+ const reset = { compilerOptions: { customConditions: [] } };+ const fixture = {+ '/ok/packages/core/package.json': publisher,+ '/ok/packages/server/package.json': publisher,+ '/ok/packages/cli/package.json': publisher,+ '/ok/packages/app/package.json': { name: '@inkeep/open-knowledge-app', private: true },+ '/ok/packages/core/tsconfig.build.json': reset,+ '/ok/packages/server/tsconfig.build.json': reset,+ '/ok/packages/app/tsconfig.build.json': reset,+ };+ const dirs = ['/ok/packages/app', '/ok/packages/cli', '/ok/packages/core', '/ok/packages/server'];+ const readConfig = (file) =>+ file in fixture ? { ok: true, value: fixture[file] } : { ok: false, reason: `${file} is gone` };+ const derive = () =>+ declarationBuildConfigs(+ '/ok',+ dirs,+ (file) => fixture[file] ?? null,+ (file) => file in fixture,+ readConfig,+ );++ it('names the publishing package that carries no build config rather than shrinking the corpus', () => {+ const { configs, missing } = derive();++ expect(missing).toEqual(['packages/cli/tsconfig.build.json']);+ expect(configs.map(([file]) => file)).toEqual([+ 'packages/core/tsconfig.build.json',+ 'packages/server/tsconfig.build.json',+ ]);+ });++ it('enrols an exports-sugar package regardless of whether dist has been built yet', () => {+ const fixture = { '/ok/p/package.json': { exports: { '.': './dist/i.mjs' } } };+ const derive = (exists) =>+ declarationBuildConfigs('/ok', ['/ok/p'], (f) => fixture[f] ?? null, exists);++ for (const exists of [(f) => f in fixture, (f) => f in fixture || f === '/ok/p/dist/i.d.mts']) {+ const { configs, missing } = derive(exists);+ expect(missing).toEqual(['p/tsconfig.build.json']);+ expect(configs).toEqual([]);+ }+ });++ it('leaves a build config out of the corpus when its package publishes no declaration', () => {+ const { configs, missing } = derive();++ expect(missing).not.toContain('packages/app/tsconfig.build.json');+ expect(configs.map(([file]) => file)).not.toContain('packages/app/tsconfig.build.json');+ });++ it('reads a build config that carries JSONC comments rather than reporting it as condition-less', () => {+ const commented = {+ '/ok/packages/core/package.json': publisher,+ '/ok/packages/core/tsconfig.build.json': true,+ };+ const { configs, blind } = declarationBuildConfigs(+ '/ok',+ ['/ok/packages/core'],+ (file) => commented[file] ?? null,+ (file) => file in commented,+ () => ({+ ok: true,+ value: JSON.parse(+ stripJsonc(+ '{\n // reset for the published surface\n "compilerOptions": { "customConditions": [] },\n}\n',+ ),+ ),+ }),+ );++ expect(blind).toEqual([]);+ expect(configs).toEqual([['packages/core/tsconfig.build.json', []]]);+ });++ it('reports an unparseable build config as a blind spot rather than as no conditions', () => {+ const broken = {+ '/ok/packages/core/package.json': publisher,+ '/ok/packages/core/tsconfig.build.json': true,+ };+ const { configs, blind } = declarationBuildConfigs(+ '/ok',+ ['/ok/packages/core'],+ (file) => broken[file] ?? null,+ (file) => file in broken,+ (file) => ({ ok: false, reason: `${file} is malformed rather than merely commented` }),+ );++ expect(configs).toEqual([]);+ expect(blind).toEqual([+ '/ok/packages/core/tsconfig.build.json is malformed rather than merely commented',+ ]);+ });++ it('enrols every real workspace package that points a types entry at a dist declaration', () => {+ const root = path.resolve(import.meta.dirname, '..');+ const onDisk = memberDirs(+ root,+ fs.readFileSync(path.join(root, 'pnpm-workspace.yaml'), 'utf8'),+ () => {},+ () => {},+ );+ const { configs, missing } = declarationBuildConfigs(root, onDisk);++ expect(missing).toEqual([]);+ expect(configs.map(([file]) => file).sort()).toEqual([+ 'packages/cli/tsconfig.build.json',+ 'packages/core/tsconfig.build.json',+ 'packages/server/tsconfig.build.json',+ ]);+ expect(configs.every(([, conditions]) => Array.isArray(conditions))).toBe(true);+ });+});++describe('publishesDeclarations', () => {+ it('enrols a package that emits declarations into an output directory', () => {+ expect(publishesDeclarations({ exports: { '.': { types: './dist/index.d.mts' } } })).toBe(true);+ expect(publishesDeclarations({ exports: { '.': { types: './build/index.d.mts' } } })).toBe(+ true,+ );+ expect(publishesDeclarations({ types: 'lib/index.d.cts' })).toBe(true);+ });++ it('reads the publishConfig overlay a workspace uses when dev-time exports point at source', () => {+ expect(+ publishesDeclarations({ publishConfig: { exports: { '.': { types: './dist/i.d.mts' } } } }),+ ).toBe(true);+ });++ it('enrols a package-root declaration that nothing exempts, rather than reading its shape as proof', () => {+ expect(publishesDeclarations({ name: '@x/y', types: 'index.d.ts' })).toBe(true);+ expect(publishesDeclarations({ name: '@x/y', private: true })).toBe(false);+ });++ it('exempts only the packages named in the non-tsc list', () => {+ expect(+ publishesDeclarations({ name: '@inkeep/open-knowledge-native-config', types: 'index.d.ts' }),+ ).toBe(false);+ });+});++describe('staleNonTscListing', () => {+ it('says nothing about a package that is not on the list', () => {+ expect(staleNonTscListing({ name: '@x/y', types: 'dist/index.d.mts' })).toBe(null);+ expect(staleNonTscListing(null)).toBe(null);+ });++ it('stays quiet while the listed package really does emit its declaration outside tsc', () => {+ expect(+ staleNonTscListing({+ name: '@inkeep/open-knowledge-native-config',+ types: 'index.d.ts',+ }),+ ).toBe(null);+ });++ it('refuses the exemption once the listed package publishes from an output directory', () => {+ const stale = staleNonTscListing({+ name: '@inkeep/open-knowledge-native-config',+ types: 'dist/index.d.mts',+ });++ expect(stale).toContain('dist/index.d.mts');+ expect(stale).toContain('remove it from NON_TSC_DECLARATIONS');+ });+});++describe('checkConditions reports a missing build config beside its siblings', () => {+ it('emits one violation per missing config rather than pre-empting the batch', () => {+ const violations = checkConditions({+ baseConditions: [SOURCE_CONDITION],+ declarationBuild: {+ configs: [['packages/server/tsconfig.build.json', [SOURCE_CONDITION]]],+ missing: ['packages/core/tsconfig.build.json'],+ },+ });++ expect(violations).toHaveLength(2);+ expect(violations[0]).toContain('packages/core/tsconfig.build.json does not exist');+ expect(violations[1]).toContain(+ 'packages/server/tsconfig.build.json declares customConditions',+ );+ });++ it('stays silent when every publisher carries a build config that resets the condition', () => {+ expect(+ checkConditions({+ baseConditions: [SOURCE_CONDITION],+ declarationBuild: { configs: [['packages/core/tsconfig.build.json', []]], missing: [] },+ }),+ ).toEqual([]);+ });+});++describe('evaluate wires every probe into the verdict', () => {+ const healthy = {+ root: '/ok',+ rootProbe: { binVersion: '7.0.2', shimVersion: '6.0.3', tsserverBytes: 272 },+ members: [+ {+ name: '@inkeep/open-knowledge-core',+ declaredRange: '^7.0.2',+ resolvedVersion: '7.0.2',+ binVersion: '7.0.2',+ scripts: { typecheck: 'tsc --noEmit' },+ },+ ],+ gated: [{ name: '@inkeep/open-knowledge-core' }],+ baseConditions: [SOURCE_CONDITION],+ declarationBuild: { configs: [['packages/core/tsconfig.build.json', []]], missing: [] },+ emitConfigs: [+ [+ 'packages/core/tsdown.config.ts',+ "export default defineConfig({ dts: { tsconfig: 'tsconfig.build.json' }, unbundle: true });",+ ],+ ],+ sourceSites: [+ { name: '@inkeep/open-knowledge-core', private: true, total: 1, missing: [], present: ['.'] },+ ],+ tsconfigs: {+ files: ['packages/core/tsconfig.build.json', 'packages/core/tsconfig.json', 'tsconfig.json'],+ sites: [+ ['packages/core/tsconfig.build.json', []],+ ['tsconfig.json', [SOURCE_CONDITION]],+ ],+ },+ };++ it('counts the tsconfigs it walked in the OK line', () => {+ expect(evaluate(healthy).out.join(' ')).toContain('of the 3 tsconfig files under the root');+ });++ it('fails when a leaf tsconfig declares customConditions of its own', () => {+ const result = evaluate({+ ...healthy,+ tsconfigs: {+ files: [...healthy.tsconfigs.files],+ sites: [...healthy.tsconfigs.sites, ['packages/core/tsconfig.json', []]],+ },+ });++ expect(result.code).toBe(1);+ expect(result.violations).toHaveLength(1);+ expect(result.violations[0]).toContain(+ 'packages/core/tsconfig.json declares customConditions []',+ );+ });++ it('reports OK when every probe holds', () => {+ const result = evaluate(healthy);++ expect(result.code).toBe(0);+ expect(result.out.join(' ')).toContain('check-typescript-resolution: OK at /ok');+ expect(result.out.join(' ')).toContain('1 tsdown configs');+ expect(result.out.join(' ')).toContain('1 packages declare an `exports` field');+ });++ it('names the redirect in the OK line when the root came from the environment', () => {+ const result = evaluate({ ...healthy, rootSource: 'OK_RESOLUTION_ROOT' });++ expect(result.out.join(' ')).toContain('OK at /ok [from OK_RESOLUTION_ROOT]');+ });++ it('fails when a tsdown config emits declarations under the base tsconfig', () => {+ const result = evaluate({+ ...healthy,+ emitConfigs: [+ ['packages/core/tsdown.config.ts', 'export default defineConfig({ dts: true });'],+ ],+ });++ expect(result.code).toBe(1);+ expect(result.violations[0]).toContain('emits declarations with dts: true');+ });++ it('fails when a private package omits the source condition on a subpath', () => {+ const result = evaluate({+ ...healthy,+ sourceSites: [+ {+ name: '@inkeep/open-knowledge-core',+ private: true,+ total: 1,+ missing: ['.'],+ present: [],+ },+ ],+ });++ expect(result.code).toBe(1);+ expect(result.violations[0]).toContain('is private and 1 of its 1');+ });++ it('fails when a publishing package carries no build config', () => {+ const result = evaluate({+ ...healthy,+ declarationBuild: { configs: [], missing: ['packages/core/tsconfig.build.json'] },+ });++ expect(result.code).toBe(1);+ expect(result.violations).toHaveLength(1);+ expect(result.violations[0]).toContain('packages/core/tsconfig.build.json does not exist');+ });++ it('fails when a build config does not reset the source condition', () => {+ const result = evaluate({+ ...healthy,+ declarationBuild: {+ configs: [['packages/core/tsconfig.build.json', [SOURCE_CONDITION]]],+ missing: [],+ },+ });++ expect(result.code).toBe(1);+ expect(result.violations[0]).toContain('declares customConditions');+ });++ it('fails when the base tsconfig drops the source condition', () => {+ const result = evaluate({ ...healthy, baseConditions: [] });++ expect(result.code).toBe(1);+ expect(result.violations[0]).toContain('the base tsconfig declares customConditions');+ });+});++describe('checkDeclarationEmit', () => {+ const build = "dts: { tsconfig: 'tsconfig.build.json' },";++ it('accepts an emit bound to the condition-clearing build config', () => {+ expect(checkDeclarationEmit([['packages/core/tsdown.config.ts', build]])).toEqual([]);+ });++ it('accepts an entry that emits no declaration at all', () => {+ expect(checkDeclarationEmit([['packages/cli/tsdown.config.ts', 'dts: false,']])).toEqual([]);+ });++ it('accepts a config that mixes a disabled entry with a bound one', () => {+ expect(+ checkDeclarationEmit([['packages/cli/tsdown.config.ts', `dts: false,\n${build}`]]),+ ).toEqual([]);+ });++ it('rejects a bare dts: true, which emits under the base tsconfig', () => {+ const [violation] = checkDeclarationEmit([['packages/core/tsdown.config.ts', 'dts: true,']]);++ expect(violation).toContain('emits declarations with dts: true');+ expect(violation).toContain('resolves siblings from ../<sibling>/src');+ });++ it('rejects an emit pointed at some other tsconfig', () => {+ const [violation] = checkDeclarationEmit([+ ['packages/core/tsdown.config.ts', "dts: { tsconfig: 'tsconfig.json' },"],+ ]);++ expect(violation).toContain('emits declarations with dts:');+ });++ it('refuses a config that binds no dts option rather than passing it', () => {+ const [violation] = checkDeclarationEmit([+ ['packages/core/tsdown.config.ts', 'format: "esm",'],+ ]);++ expect(violation).toContain('binds no dts option');+ });++ it('refuses an unreadable config rather than reporting a pass on it', () => {+ const [violation] = checkDeclarationEmit([['packages/core/tsdown.config.ts', null]]);++ expect(violation).toContain('could not be read');+ expect(violation).toContain('Refusing to report a pass');+ });++ it('refuses a config the package needs but does not have', () => {+ const [violation] = checkDeclarationEmit([['packages/core/tsdown.config.ts', CONFIG_ABSENT]]);++ expect(violation).toContain('packages/core/tsdown.config.ts does not exist');+ expect(violation).toContain('Refusing to report a pass');+ });++ it('reads a binding whose object nests another object as one binding', () => {+ expect(+ checkDeclarationEmit([+ [+ 'packages/core/tsdown.config.ts',+ "dts: { tsconfig: 'tsconfig.build.json', compilerOptions: { declarationMap: true } },",+ ],+ ]),+ ).toEqual([]);+ });++ it('accepts the relative spelling of the build config path', () => {+ expect(+ checkDeclarationEmit([+ ['packages/core/tsdown.config.ts', "dts: { tsconfig: './tsconfig.build.json' },"],+ ]),+ ).toEqual([]);+ });++ it('accepts the build config path written as a template literal', () => {+ expect(+ checkDeclarationEmit([+ ['packages/core/tsdown.config.ts', 'dts: { tsconfig: `tsconfig.build.json` },'],+ ]),+ ).toEqual([]);+ });++ it('ignores a dts binding that only appears inside a comment', () => {+ const [violation] = checkDeclarationEmit([+ ['packages/core/tsdown.config.ts', '// dts: true,\nformat: "esm",'],+ ]);++ expect(violation).toContain('binds no dts option');+ });+});++describe('dtsBindings', () => {+ it('walks to the matching brace instead of stopping at the first nested one', () => {+ expect(+ dtsBindings("dts: { tsconfig: 'tsconfig.build.json', compilerOptions: { a: 1 } },"),+ ).toEqual(["{ tsconfig: 'tsconfig.build.json', compilerOptions: { a: 1 } }"]);+ });++ it('reads the literal spellings and reports both entries of a two-entry config', () => {+ expect(dtsBindings('dts: false, x: 1, dts: true')).toEqual(['false', 'true']);+ });++ it('does not read a brace inside a string as the end of the binding', () => {+ expect(dtsBindings("dts: { banner: '}' }")).toEqual(["{ banner: '}' }"]);+ });+});++describe('checkDeclarationEmit reads an array config one entry at a time', () => {+ const REAL_CONFIGS = [+ ['packages/core/tsdown.config.ts', realConfig('core')],+ ['packages/server/tsdown.config.ts', realConfig('server')],+ ['packages/cli/tsdown.config.ts', realConfig('cli')],+ ];++ it('accepts every tsdown config the workspace actually ships', () => {+ expect(checkDeclarationEmit(REAL_CONFIGS)).toEqual([]);+ });++ for (const [pkg, dropped] of [+ ['core', /dts: \{ tsconfig: 'tsconfig\.build\.json', emitDtsOnly: true \},/],+ ['cli', /dts: \{ tsconfig: 'tsconfig\.build\.json' \},/],+ ]) {+ it(`reds when ${pkg}'s second entry loses its dts binding while the first still binds false`, () => {+ const file = `packages/${pkg}/tsdown.config.ts`;+ const mutated = withoutLinesMatching(realConfig(pkg), dropped);++ expect(mutated).not.toEqual(realConfig(pkg));+ const [violation] = checkDeclarationEmit([[file, mutated]]);+ expect(violation).toContain(`${file} entry [1] binds no dts option`);+ });+ }++ it('names the offending entry rather than the whole file', () => {+ const [violation] = checkDeclarationEmit([+ [+ 'packages/core/tsdown.config.ts',+ 'export default defineConfig([{ dts: false }, { dts: true }]);',+ ],+ ]);++ expect(violation).toContain('entry [1] emits declarations with dts: true');+ });++ it('reads a lone object config as the single entry it is', () => {+ const [violation] = checkDeclarationEmit([+ ['packages/server/tsdown.config.ts', 'export default defineConfig({ format: "esm" });'],+ ]);++ expect(violation).toContain('packages/server/tsdown.config.ts binds no dts option');+ expect(violation).not.toContain('entry [');+ });++ it('keeps splitting entries across a template literal that nests another one', () => {+ const open = '${';+ const source = [+ 'export default defineConfig([',+ ` { entry: { a: 'src/a.ts' }, dts: false, banner: \`${open}xs.map((v) => \`}${open}v}\`).join('')}\` },`,+ " { entry: { b: 'src/b.ts' }, format: 'esm' },",+ ']);',+ ].join('\n');++ expect(source).toContain(`banner: \`${open}xs.map((v) => \`}${open}v}\`).join('')}\``);+ const violations = checkDeclarationEmit([['packages/core/tsdown.config.ts', source]]);++ expect(violations).toHaveLength(1);+ expect(violations[0]).toContain('entry [1] binds no dts option');+ });++ it('does not read a commented-out binding as a live one', () => {+ const [violation] = checkDeclarationEmit([+ [+ 'packages/core/tsdown.config.ts',+ "export default defineConfig([{ dts: false }, {\n // dts: { tsconfig: 'tsconfig.build.json' },\n format: 'esm',\n}]);",+ ],+ ]);++ expect(violation).toContain('entry [1] binds no dts option');+ });++ it('records the unbundle option per entry so a flip is visible in the pass line', () => {+ expect(declarationEmitEntries(REAL_CONFIGS)).toEqual([+ {+ file: 'packages/core/tsdown.config.ts',+ label: '[0]',+ dts: 'false',+ unbundle: 'false',+ },+ {+ file: 'packages/core/tsdown.config.ts',+ label: '[1]',+ dts: "{ tsconfig: 'tsconfig.build.json', emitDtsOnly: true }",+ unbundle: 'true',+ },+ {+ file: 'packages/server/tsdown.config.ts',+ label: null,+ dts: "{ tsconfig: 'tsconfig.build.json' }",+ unbundle: 'false',+ },+ {+ file: 'packages/cli/tsdown.config.ts',+ label: '[0]',+ dts: 'false',+ unbundle: 'false',+ },+ {+ file: 'packages/cli/tsdown.config.ts',+ label: '[1]',+ dts: "{ tsconfig: 'tsconfig.build.json' }",+ unbundle: 'false',+ },+ ]);+ expect(unbundleCensus(REAL_CONFIGS)).toBe(+ '5 build entries across them, unbundle true on 1 and false on 4 and unbound on 0',+ );+ });+});++describe('declarationEmitConfigs', () => {+ const publisher = {+ exports: { '.': { types: './dist/index.d.mts' } },+ devDependencies: { tsdown: '^0.22.14' },+ };+ const fixture = {+ '/ok/packages/core/package.json': publisher,+ '/ok/packages/cli/package.json': publisher,+ '/ok/packages/plugin/package.json': {+ exports: { '.': { types: './dist/index.d.mts' } },+ },+ '/ok/packages/app/package.json': { name: '@inkeep/open-knowledge-app', private: true },+ '/ok/packages/core/tsdown.config.ts': 'dts: false,',+ };+ const dirs = ['/ok/packages/app', '/ok/packages/cli', '/ok/packages/core', '/ok/packages/plugin'];+ const derive = () =>+ declarationEmitConfigs(+ '/ok',+ dirs,+ (file) => fixture[file] ?? null,+ (file) => fixture[file] ?? null,+ (file) => file in fixture,+ );++ it('records a tsdown builder whose config is absent rather than dropping it from the corpus', () => {+ expect(derive()).toEqual([+ ['packages/cli/tsdown.config.ts', CONFIG_ABSENT],+ ['packages/core/tsdown.config.ts', 'dts: false,'],+ ]);+ });++ it('leaves out a publisher that does not build with tsdown at all', () => {+ expect(derive().map(([file]) => file)).not.toContain('packages/plugin/tsdown.config.ts');+ });++ it('enrols every real tsdown builder in the workspace', () => {+ const onDisk = memberDirs(+ OK_ROOT,+ fs.readFileSync(path.join(OK_ROOT, 'pnpm-workspace.yaml'), 'utf8'),+ () => {},+ () => {},+ );+ const entries = declarationEmitConfigs(OK_ROOT, onDisk);++ expect(entries.map(([file]) => file).sort()).toEqual([+ 'packages/cli/tsdown.config.ts',+ 'packages/core/tsdown.config.ts',+ 'packages/server/tsdown.config.ts',+ ]);+ expect(entries.every(([, source]) => typeof source === 'string')).toBe(true);+ });+});++describe('main() refuses rather than passing', () => {+ const run = (root) =>+ spawnSync('node', ['scripts/check-typescript-resolution.mjs'], {+ cwd: OK_ROOT,+ encoding: 'utf8',+ env: { ...process.env, OK_RESOLUTION_ROOT: root },+ });++ it('refuses when there is no workspace file to enumerate from', () => {+ const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'ts-resolution-empty-'));+ try {+ const result = run(dir);+ expect(result.status).toBe(1);+ expect(result.stderr).toContain('no pnpm-workspace.yaml');+ } finally {+ fs.rmSync(dir, { recursive: true, force: true });+ }+ });++ it('refuses when the workspace enumerates no members', () => {+ const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'ts-resolution-partial-'));+ try {+ fs.writeFileSync(path.join(dir, 'pnpm-workspace.yaml'), 'packages:\n - "nope/*"\n');+ const result = run(dir);+ expect(result.status).toBe(1);+ expect(result.stderr).toContain('cannot enumerate the workspace');+ expect(result.stderr).toContain('matched no package.json');+ } finally {+ fs.rmSync(dir, { recursive: true, force: true });+ }+ });++ const fixtureRoot = (files) => writeTree('ts-resolution-', files);++ const WORKSPACE = "packages:\n - 'packages/*'\n";+ const GATED = { typescript: '^7.0.2' };+ const BASE_TSCONFIG = { compilerOptions: { customConditions: [SOURCE_CONDITION] } };++ const refusalCase = (files, expected) => {+ const dir = fixtureRoot(files);+ try {+ const result = run(dir);+ expect(result.status).toBe(1);+ for (const fragment of expected) expect(result.stderr).toContain(fragment);+ return result;+ } finally {+ fs.rmSync(dir, { recursive: true, force: true });+ }+ };++ it('refuses when a matched package.json parses but cannot be probed', () => {+ refusalCase(+ { 'pnpm-workspace.yaml': WORKSPACE, 'packages/nameless/package.json': { type: 'module' } },+ ['cannot enumerate the workspace', 'declares no name'],+ );+ });++ it('refuses when no enumerated package declares the compiler', () => {+ refusalCase({ 'pnpm-workspace.yaml': WORKSPACE, 'packages/a/package.json': { name: 'a' } }, [+ 'no workspace package declares typescript',+ 'Refusing to report a pass on an empty corpus',+ ]);+ });++ it('refuses when no enumerated package publishes an emitted declaration', () => {+ refusalCase(+ {+ 'pnpm-workspace.yaml': WORKSPACE,+ 'packages/a/package.json': { name: 'a', private: true, devDependencies: GATED },+ 'tsconfig.json': BASE_TSCONFIG,+ },+ ['no workspace package publishes an emitted declaration'],+ );+ });++ it('refuses when a declaration publisher builds without a tsdown config to inspect', () => {+ refusalCase(+ {+ 'pnpm-workspace.yaml': WORKSPACE,+ 'packages/a/package.json': {+ name: 'a',+ private: true,+ devDependencies: GATED,+ exports: { '.': { '@inkeep/source': './src/index.ts', types: './dist/index.d.mts' } },+ },+ 'packages/a/tsconfig.build.json': { compilerOptions: { customConditions: [] } },+ 'tsconfig.json': BASE_TSCONFIG,+ },+ ['none of the packages that publish an emitted declaration has a tsdown.config.ts'],+ );+ });++ it('reads a base tsconfig that carries comments rather than calling it condition-less', () => {+ const result = refusalCase(+ {+ 'pnpm-workspace.yaml': WORKSPACE,+ 'packages/a/package.json': {+ name: 'a',+ private: true,+ devDependencies: GATED,+ exports: { '.': { '@inkeep/source': './src/index.ts', types: './dist/index.d.mts' } },+ },+ 'packages/a/tsconfig.build.json': { compilerOptions: { customConditions: [] } },+ 'tsconfig.json':+ '{\n // the source condition every leaf typecheck resolves through\n "compilerOptions": { "customConditions": ["@inkeep/source"] },\n}\n',+ },+ ['none of the packages that publish an emitted declaration has a tsdown.config.ts'],+ );++ expect(result.stderr).not.toContain('the base tsconfig declares customConditions');+ });++ it('names the malformed tsconfig and its cause rather than reporting a content violation', () => {+ const result = refusalCase(+ {+ 'pnpm-workspace.yaml': WORKSPACE,+ 'packages/a/package.json': { name: 'a', private: true, devDependencies: GATED },+ 'tsconfig.json': '{ "compilerOptions": ',+ },+ ['cannot read a tsconfig this gate has to inspect', 'malformed rather than merely commented'],+ );++ expect(result.stderr).toContain('tsconfig.json');+ expect(result.stderr).not.toContain('declares customConditions');+ });++ const EMITTING_PACKAGE = {+ name: 'a',+ private: true,+ devDependencies: { ...GATED, tsdown: '^0.15.6' },+ exports: { '.': { '@inkeep/source': './src/index.ts', types: './dist/index.d.mts' } },+ };+ const evaluatedTree = (extra) => ({+ 'pnpm-workspace.yaml': WORKSPACE,+ 'tsconfig.json': BASE_TSCONFIG,+ 'packages/a/package.json': EMITTING_PACKAGE,+ 'packages/a/tsconfig.build.json': { compilerOptions: { customConditions: [] } },+ 'packages/a/tsdown.config.ts':+ "export default defineConfig({ dts: { tsconfig: 'tsconfig.build.json' } });\n",+ ...extra,+ });++ it('fails on a leaf tsconfig that switches its own program onto dist resolution', () => {+ const result = refusalCase(+ evaluatedTree({ 'packages/a/tsconfig.json': { compilerOptions: { customConditions: [] } } }),+ ['packages/a/tsconfig.json declares customConditions []', 'REPLACES the base array'],+ );++ expect(result.stderr).not.toContain('packages/a/tsconfig.build.json declares');+ });++ it('flags a published package that carries the source condition on one arm of a nested group', () => {+ const result = refusalCase(+ evaluatedTree({+ 'packages/a/package.json': {+ ...EMITTING_PACKAGE,+ private: false,+ exports: {+ '.': {+ import: { types: './dist/index.d.mts', default: './dist/index.mjs' },+ require: { '@inkeep/source': './src/index.ts', default: './dist/index.cjs' },+ },+ },+ },+ }),+ ['is published and 1 of its', 'not in the published tarball'],+ );++ expect(result.stderr).not.toContain('is private and');+ });++ it('says nothing about a leaf tsconfig that leaves the base resolution alone', () => {+ const result = refusalCase(+ evaluatedTree({ 'packages/a/tsconfig.json': { extends: '../../tsconfig.json' } }),+ ['the declaration and compiler contract this workspace declares does not hold'],+ );++ expect(result.stderr).not.toContain('packages/a/tsconfig.json declares customConditions');+ });+});++describe('sourceConditionSites', () => {+ it('ignores a manifest with no exports field', () => {+ expect(sourceConditionSites({ name: 'x' })).toBe(null);+ });++ it('ignores an exports map with no subpaths at all', () => {+ expect(sourceConditionSites({ name: 'x', private: true, exports: {} })).toBe(null);+ });++ it('splits subpaths by whether they carry the source condition', () => {+ const site = sourceConditionSites({+ name: 'x',+ private: true,+ exports: {+ '.': { '@inkeep/source': './src/index.ts', default: './dist/index.mjs' },+ './b': { default: './dist/b.mjs' },+ },+ });++ expect(site).toMatchObject({ private: true, total: 2, present: ['.'], missing: ['./b'] });+ });++ it('reads a conditions-only exports map as the one "." subpath it is sugar for', () => {+ const site = sourceConditionSites({+ name: 'x',+ private: false,+ exports: { '@inkeep/source': './src/index.ts', default: './dist/index.mjs' },+ });++ expect(site).toMatchObject({ private: false, total: 1, present: ['.'], missing: [] });+ });++ it('reads a top-level fallback array and a bare string as the one "." subpath', () => {+ const array = sourceConditionSites({+ name: 'x',+ private: true,+ exports: [{ '@inkeep/source': './src/index.ts' }, './dist/index.mjs'],+ });+ expect(array).toMatchObject({ total: 1, present: ['.'], missing: ['.'] });++ const string = sourceConditionSites({ name: 'x', private: true, exports: './dist/index.mjs' });+ expect(string).toMatchObject({ total: 1, present: [], missing: ['.'] });++ expect(sourceConditionSites({ name: 'x', private: true, exports: [] })).toBe(null);+ });++ it('sees the source condition inside a nested condition group or a fallback array', () => {+ const site = sourceConditionSites({+ name: 'x',+ private: false,+ exports: {+ './nested': {+ import: { default: './dist/n.mjs' },+ require: { '@inkeep/source': './src/n.ts', default: './dist/n.cjs' },+ },+ './array': [{ '@inkeep/source': './src/a.ts' }, './dist/a.mjs'],+ './flat': { types: './dist/f.d.mts', default: './dist/f.mjs' },+ },+ });++ expect(site).toMatchObject({ private: false, total: 3, present: ['./nested', './array'] });+ expect(site.missing).toEqual(['./nested', './array', './flat']);+ });++ it('counts a subpath that orders another condition ahead of the source one as missing', () => {+ const site = sourceConditionSites({+ name: 'x',+ private: true,+ exports: {+ '.': {+ types: './dist/index.d.mts',+ '@inkeep/source': './src/index.ts',+ default: './dist/index.mjs',+ },+ },+ });++ expect(site.missing).toEqual(['.']);+ expect(site.present).toEqual(['.']);+ });++ it('keeps a string-valued subpath in the corpus, where it can never carry a condition', () => {+ const site = sourceConditionSites({+ name: 'x',+ private: true,+ exports: {+ '.': { '@inkeep/source': './src/index.ts', default: './dist/index.mjs' },+ './b': './dist/b.mjs',+ },+ });++ expect(site.total).toBe(2);+ expect(site.missing).toEqual(['./b']);+ expect(site.present).toEqual(['.']);+ });++ it('refuses to classify a package that declares an exports map and no private field', () => {+ const site = sourceConditionSites({+ name: 'x',+ exports: { '.': { '@inkeep/source': './src/index.ts' } },+ });++ expect(site).toMatchObject({ unclassified: true, total: 1 });+ expect(site.private).toBeUndefined();+ });++ it('reads private: false as published rather than folding it in with an absent field', () => {+ const site = sourceConditionSites({+ name: 'x',+ private: false,+ exports: { '.': './dist/i.mjs' },+ });++ expect(site.private).toBe(false);+ expect(site.unclassified).toBeUndefined();+ });++ it('classifies every real workspace package that declares an exports field', () => {+ const onDisk = memberDirs(+ OK_ROOT,+ fs.readFileSync(path.join(OK_ROOT, 'pnpm-workspace.yaml'), 'utf8'),+ () => {},+ () => {},+ );+ const sites = onDisk+ .map((dir) =>+ sourceConditionSites(JSON.parse(fs.readFileSync(path.join(dir, 'package.json'), 'utf8'))),+ )+ .filter((site) => site !== null);++ expect(sites.length).toBeGreaterThanOrEqual(3);+ expect(sites.every((site) => site.unclassified === undefined)).toBe(true);+ expect(checkSourceCondition(sites)).toEqual([]);+ });+});++describe('checkSourceCondition', () => {+ const privateComplete = {+ name: 'core',+ private: true,+ total: 2,+ missing: [],+ present: ['.', './b'],+ };+ const publishedClean = { name: 'cli', private: false, total: 1, missing: ['.'], present: [] };++ it('accepts a private package that carries the condition on every subpath', () => {+ expect(checkSourceCondition([privateComplete, publishedClean])).toEqual([]);+ });++ it('refuses an empty corpus rather than passing against nothing', () => {+ const [violation] = checkSourceCondition([]);+ expect(violation).toContain('Refusing to report a pass');+ });++ it('rejects a private package that omits the condition on a subpath', () => {+ const [violation] = checkSourceCondition([+ { ...privateComplete, missing: ['./b'], present: ['.'] },+ ]);+ expect(violation).toContain('is private and 1 of its 2');+ expect(violation).toContain('can pass against a stale dist');+ });++ it('rejects a published package that declares the condition', () => {+ const [violation] = checkSourceCondition([{ ...publishedClean, missing: [], present: ['.'] }]);+ expect(violation).toContain('is published and 1 of its');+ expect(violation).toContain('not in the published tarball');+ });++ it('refuses a package it could not classify instead of guessing a direction', () => {+ const violations = checkSourceCondition([+ { name: 'newcomer', unclassified: true, total: 3, missing: [], present: [] },+ ]);++ expect(violations).toHaveLength(1);+ expect(violations[0]).toContain('newcomer declares an `exports` field with 3 subpaths');+ expect(violations[0]).toContain('no explicit `private` field');+ });++ it('names ordering as a cause alongside omission, since the two need different edits', () => {+ const [violation] = checkSourceCondition([+ { ...privateComplete, missing: ['./b'], present: ['.', './b'] },+ ]);++ expect(violation).toContain('orders another condition ahead of it');+ });+});++describe('checkTsconfigConditions', () => {+ const canonical = [+ ['packages/cli/tsconfig.check.json', []],+ ['packages/core/tsconfig.build.json', []],+ ['tsconfig.json', [SOURCE_CONDITION]],+ ];++ it('accepts the base condition beside the build and check configs that reset it', () => {+ expect(checkTsconfigConditions(canonical)).toEqual([]);+ });++ it('names the leaf config that moves its program onto dist, and the value it carries', () => {+ const [violation] = checkTsconfigConditions([...canonical, ['packages/app/tsconfig.json', []]]);++ expect(violation).toContain('packages/app/tsconfig.json declares customConditions []');+ expect(violation).toContain('REPLACES the base array');+ });++ it('rejects a leaf that claims the source condition only the base may declare', () => {+ const [violation] = checkTsconfigConditions([['docs/tsconfig.json', [SOURCE_CONDITION]]]);++ expect(violation).toContain(+ `docs/tsconfig.json declares customConditions ["${SOURCE_CONDITION}"]`,+ );+ });++ it('rejects a reset-named config outside a canonical package location, even when it resets', () => {+ const violations = checkTsconfigConditions([+ ...canonical,+ ['tsconfig.build.json', []],+ ['packages/a/nested/deep/tsconfig.check.json', []],+ ]);++ expect(violations).toHaveLength(2);+ expect(violations[0]).toContain('tsconfig.build.json declares customConditions []');+ expect(violations[0]).toContain('outside the canonical locations');+ expect(violations[0]).toContain(+ '(packages/<package> or packages/md-conformance/md-audit or docs)',+ );+ expect(violations[1]).toContain('packages/a/nested/deep/tsconfig.check.json');+ expect(violations[1]).toContain('outside the canonical locations');+ });++ it('leaves a non-reset leaf outside a canonical location to the leaf message', () => {+ const violations = checkTsconfigConditions([+ ...canonical,+ ['packages/app/e2e/tsconfig.json', []],+ ]);+ expect(violations).toHaveLength(1);+ expect(violations[0]).toContain('REPLACES the base array');+ expect(violations[0]).not.toContain('outside the canonical locations');+ });++ it('accepts the reset at every canonical location the guard recognises', () => {+ expect(+ checkTsconfigConditions([+ ...canonical,+ ['packages/md-conformance/md-audit/tsconfig.build.json', []],+ ['docs/tsconfig.check.json', []],+ ]),+ ).toEqual([]);+ });++ it('rejects a build or check config carrying anything other than a reset', () => {+ const violations = checkTsconfigConditions([+ ['packages/cli/tsconfig.check.json', [SOURCE_CONDITION]],+ ['packages/core/tsconfig.build.json', null],+ ]);++ expect(violations).toHaveLength(2);+ expect(violations[0]).toContain('A tsconfig.check.json exists to reset');+ expect(violations[1]).toContain(+ 'packages/core/tsconfig.build.json declares customConditions null, not []',+ );+ });++ it('leaves a build config already asserted by the declaration check to that check', () => {+ expect(+ checkTsconfigConditions(+ [['packages/core/tsconfig.build.json', [SOURCE_CONDITION]]],+ ['packages/core/tsconfig.build.json'],+ ),+ ).toEqual([]);+ });+});++describe('tsconfigFiles', () => {+ it('walks the root and its packages, past node_modules and dot directories', () => {+ withTree(+ {+ 'tsconfig.json': {},+ 'tsconfig.md': 'not a config at all',+ 'packages/a/package.json': {},+ 'packages/a/tsconfig.json': {},+ 'packages/a/tsconfig.build.json': {},+ 'packages/a/nested/deep/tsconfig.check.json': {},+ 'packages/a/node_modules/dep/tsconfig.json': {},+ '.turbo/tsconfig.json': {},+ },+ (dir) => {+ expect(tsconfigFiles(dir).files).toEqual([+ 'packages/a/nested/deep/tsconfig.check.json',+ 'packages/a/tsconfig.build.json',+ 'packages/a/tsconfig.json',+ 'tsconfig.json',+ ]);+ },+ );+ });++ it('skips every directory the gitignore rules name, at their declared anchor or by name and prefix', () => {+ const rules = outputDirRules(+ [+ 'node_modules/',+ 'dist/',+ 'packages/desktop/out/',+ 'packages/desktop/build/parcel-watcher-staging/',+ 'tmp/',+ 'playwright-report-*/',+ 'desktop-smoke-test-results-*/',+ '/rooted-only/',+ 'packages/*/coverage/',+ ].join('\n'),+ );+ const files = Object.fromEntries(+ [+ 'tsconfig.json',+ 'packages/a/tsconfig.build.json',+ 'packages/a/dist/tsconfig.json',+ 'packages/a/deep/tmp/tsconfig.json',+ 'packages/a/playwright-report-linux/tsconfig.build.json',+ 'packages/a/desktop-smoke-test-results-win/tsconfig.json',+ 'packages/desktop/out/tsconfig.json',+ 'packages/desktop/build/parcel-watcher-staging/tsconfig.json',+ 'packages/app/out/tsconfig.json',+ 'rooted-only/tsconfig.json',+ 'packages/a/rooted-only/tsconfig.json',+ 'packages/a/coverage/tsconfig.json',+ ].map((rel) => [rel, {}]),+ );+ withTree(files, (dir) => {+ expect(tsconfigFiles(dir, fs.readdirSync, rules).files).toEqual([+ 'packages/a/coverage/tsconfig.json',+ 'packages/a/rooted-only/tsconfig.json',+ 'packages/a/tsconfig.build.json',+ 'packages/app/out/tsconfig.json',+ 'tsconfig.json',+ ]);+ });+ });++ it('keeps a root-anchored single-segment pattern at the root only', () => {+ const rules = outputDirRules('/perf-fixtures/\nperf-cache/\n');+ expect(rules.anchored.has('perf-fixtures')).toBe(true);+ expect(rules.names.has('perf-fixtures')).toBe(false);+ expect(rules.names.has('perf-cache')).toBe(true);+ });++ it('walks a directory the gitignore names with a wildcard path, rather than skipping it', () => {+ const rules = outputDirRules('packages/*/coverage/\n');+ expect(rules.anchored.size).toBe(0);+ expect(rules.names.size).toBe(0);+ });++ it('takes its rules from the gitignore beside the root it walks when none are passed', () => {+ withTree(+ {+ '.gitignore': 'generated/\nreport-*/\npackages/b/out/\n',+ 'tsconfig.json': {},+ 'packages/a/tsconfig.build.json': {},+ 'packages/a/generated/tsconfig.json': {},+ 'packages/a/report-ci/tsconfig.json': {},+ 'packages/b/out/tsconfig.json': {},+ 'packages/a/out/tsconfig.json': {},+ },+ (dir) => {+ expect(tsconfigFiles(dir).files).toEqual([+ 'packages/a/out/tsconfig.json',+ 'packages/a/tsconfig.build.json',+ 'tsconfig.json',+ ]);+ },+ );+ });++ it('walks every directory when no gitignore sits beside the root', () => {+ withTree({ 'tsconfig.json': {}, 'packages/a/dist/tsconfig.json': {} }, (dir) => {+ expect(tsconfigFiles(dir).files).toEqual(['packages/a/dist/tsconfig.json', 'tsconfig.json']);+ });+ });++ it('skips the nested build output at its one declared path, with or without a root gitignore', () => {+ expect(NESTED_BUILD_OUTPUTS).toEqual(['packages/native-config/target']);+ const files = {+ 'tsconfig.json': {},+ 'packages/native-config/target/tsconfig.json': {},+ 'packages/native-config/tsconfig.json': {},+ 'packages/other/target/tsconfig.json': {},+ };+ const listed = [+ 'packages/native-config/tsconfig.json',+ 'packages/other/target/tsconfig.json',+ 'tsconfig.json',+ ];+ withTree(files, (dir) => {+ expect(tsconfigFiles(dir).files).toEqual(listed);+ });+ withTree({ ...files, '.gitignore': 'dist/\n' }, (dir) => {+ expect(tsconfigFiles(dir).files).toEqual(listed);+ });+ });++ it('drops a root-anchored wildcard pattern rather than turning it into a bare prefix', () => {+ const rules = outputDirRules('/report-*/\nreport-*/\n');+ expect(rules.anchored.size).toBe(0);+ expect(rules.prefixes).toEqual(['report-']);+ });++ const rootGitignore = path.join(OK_ROOT, '.gitignore');++ it.runIf(fs.existsSync(rootGitignore))(+ 'derives real rules from whichever gitignore sits beside the walk root',+ () => {+ const real = outputDirRules(fs.readFileSync(rootGitignore, 'utf8'));+ expect(real.names.has('dist')).toBe(true);+ expect(real.names.has('out')).toBe(false);+ expect(real.anchored.has('packages/desktop/out')).toBe(true);+ expect(real.names.has('target')).toBe(false);+ },+ );++ const nativeConfigGitignore = path.join(OK_ROOT, 'packages/native-config/.gitignore');++ it.runIf(fs.existsSync(nativeConfigGitignore))(+ 'carves out the one nested build output its own gitignore anchors without a trailing slash',+ () => {+ expect(fs.readFileSync(nativeConfigGitignore, 'utf8')).toMatch(/^\/target$/m);+ },+ );++ it.runIf(fs.existsSync(path.join(OK_ROOT, 'specs')))(+ 'derives the subtree record in full when the walk root is the subtree itself',+ () => {+ const real = outputDirRules(fs.readFileSync(rootGitignore, 'utf8'));+ expect(real.prefixes).toEqual(+ expect.arrayContaining([+ 'playwright-report-',+ 'test-results-',+ 'desktop-smoke-report-',+ 'desktop-smoke-test-results-',+ ]),+ );+ expect(real.anchored.has('packages/desktop/build/parcel-watcher-staging')).toBe(true);+ expect(real.anchored.has('perf-fixtures')).toBe(true);+ expect(real.names.has('perf-fixtures')).toBe(false);+ },+ );++ it('reports a directory it cannot list rather than walking past it', () => {+ const { files, blind } = tsconfigFiles('/ok', () => {+ throw new Error('EACCES');+ });++ expect(files).toEqual([]);+ expect(blind).toHaveLength(1);+ expect(blind[0]).toContain('could not be listed (EACCES)');+ expect(blind[0]).toContain('could sit there unseen');+ });+});++describe('tsconfigConditions', () => {+ it('reports every config that declares the key, and only those, with the value it declares', () => {+ withTree(+ {+ 'tsconfig.json': { compilerOptions: { customConditions: [SOURCE_CONDITION] } },+ 'packages/a/tsconfig.json': { compilerOptions: { customConditions: [] } },+ 'packages/b/tsconfig.build.json': { compilerOptions: { customConditions: null } },+ 'packages/c/tsconfig.json': { compilerOptions: { strict: true } },+ 'packages/d/tsconfig.json': { extends: '../../tsconfig.json' },+ },+ (dir) => {+ expect(tsconfigConditions(dir, tsconfigFiles(dir).files)).toEqual({+ blind: [],+ sites: [+ ['packages/a/tsconfig.json', []],+ ['packages/b/tsconfig.build.json', null],+ ['tsconfig.json', [SOURCE_CONDITION]],+ ],+ });+ },+ );+ });++ it('reads a config through its comments rather than calling it condition-less', () => {+ withTree(+ {+ 'packages/a/tsconfig.json':+ '{\n // a stray reset hiding under a comment\n "compilerOptions": { "customConditions": [] },\n}\n',+ },+ (dir) => {+ expect(tsconfigConditions(dir, tsconfigFiles(dir).files).sites).toEqual([+ ['packages/a/tsconfig.json', []],+ ]);+ },+ );+ });++ it('reports an unparseable config as a blind spot rather than as no conditions', () => {+ withTree({ 'packages/a/tsconfig.json': '{ "compilerOptions": ' }, (dir) => {+ const { sites, blind } = tsconfigConditions(dir, tsconfigFiles(dir).files);++ expect(sites).toEqual([]);+ expect(blind).toHaveLength(1);+ expect(blind[0]).toContain('malformed rather than merely commented');+ });+ });+});++describe('the tsconfigs on disk', () => {+ it('declares customConditions only in the base config and in configs that reset it', () => {+ const listed = tsconfigFiles(OK_ROOT);+ const declared = tsconfigConditions(OK_ROOT, listed.files);++ expect(listed.blind).toEqual([]);+ expect(declared.blind).toEqual([]);+ expect(declared.sites).toEqual([+ ['packages/cli/tsconfig.build.json', []],+ ['packages/cli/tsconfig.check.json', []],+ ['packages/core/tsconfig.build.json', []],+ ['packages/server/tsconfig.build.json', []],+ ['tsconfig.json', [SOURCE_CONDITION]],+ ]);+ expect(checkTsconfigConditions(declared.sites)).toEqual([]);+ });+});diff --git a/scripts/read-jsonc.mjs b/scripts/read-jsonc.mjsnew file mode 100644index 000000000..551468ee2--- /dev/null+++ b/scripts/read-jsonc.mjs@@ -0,0 +1,73 @@+import fs from 'node:fs';++export function stripJsonc(text) {+ let out = '';+ let i = 0;+ while (i < text.length) {+ const c = text[i];+ const d = text[i + 1];+ if (c === '/' && d === '/') {+ while (i < text.length && text[i] !== '\n') i += 1;+ continue;+ }+ if (c === '/' && d === '*') {+ i += 2;+ while (i < text.length && !(text[i] === '*' && text[i + 1] === '/')) i += 1;+ i = Math.min(i + 2, text.length);+ continue;+ }+ if (c === '"') {+ let j = i + 1;+ while (j < text.length) {+ if (text[j] === '\\') {+ j += 2;+ continue;+ }+ if (text[j] === '"') {+ j += 1;+ break;+ }+ j += 1;+ }+ out += text.slice(i, j);+ i = j;+ continue;+ }+ if (c === '}' || c === ']') {+ let k = out.length - 1;+ while (k >= 0 && /\s/.test(out[k])) k -= 1;+ if (k >= 0 && out[k] === ',') out = out.slice(0, k) + out.slice(k + 1);+ out += c;+ i += 1;+ continue;+ }+ out += c;+ i += 1;+ }+ return out;+}++export function readJsoncOrError(file) {+ let text;+ try {+ text = fs.readFileSync(file, 'utf8');+ } catch (error) {+ if (error.code === 'ENOENT') {+ return { ok: false, code: 'ENOENT', reason: `${file} does not exist` };+ }+ return {+ ok: false,+ code: error.code ?? 'EREAD',+ reason: `${file} could not be read (${error.message})`,+ };+ }+ try {+ return { ok: true, value: JSON.parse(stripJsonc(text)) };+ } catch (error) {+ return {+ ok: false,+ code: 'EPARSE',+ reason: `${file} is not parseable as JSON even after JSONC comments and trailing commas are stripped (${error.message}), so the file itself is malformed rather than merely commented`,+ };+ }+}diff --git a/scripts/read-jsonc.test.mjs b/scripts/read-jsonc.test.mjsnew file mode 100644index 000000000..6a7f63a20--- /dev/null+++ b/scripts/read-jsonc.test.mjs@@ -0,0 +1,61 @@+import fs from 'node:fs';+import os from 'node:os';+import path from 'node:path';+import { describe, expect, it } from 'vitest';+import { readJsoncOrError, stripJsonc } from './read-jsonc.mjs';++const withFile = (body, run) => {+ const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'read-jsonc-'));+ const file = path.join(dir, 'tsconfig.json');+ try {+ fs.writeFileSync(file, body);+ return run(file);+ } finally {+ fs.rmSync(dir, { recursive: true, force: true });+ }+};++describe('stripJsonc', () => {+ it('drops line and block comments outside strings', () => {+ expect(+ JSON.parse(stripJsonc('{\n // leading\n "a": 1, /* inline */\n "b": 2\n}\n')),+ ).toEqual({ a: 1, b: 2 });+ });++ it('keeps comment-shaped text that lives inside a string value', () => {+ expect(JSON.parse(stripJsonc('{ "a": "http://x/y", "b": "/* not a comment */" }'))).toEqual({+ a: 'http://x/y',+ b: '/* not a comment */',+ });+ });++ it('drops trailing commas in objects and arrays', () => {+ expect(JSON.parse(stripJsonc('{ "a": [1, 2, ], }'))).toEqual({ a: [1, 2] });+ });++ it('leaves a comma inside a string alone', () => {+ expect(JSON.parse(stripJsonc('{ "a": ",]" }'))).toEqual({ a: ',]' });+ });+});++describe('readJsoncOrError', () => {+ it('reads a commented tsconfig as the object it denotes', () => {+ const result = withFile(+ '{\n // the base condition\n "compilerOptions": { "customConditions": ["@inkeep/source"] },\n}\n',+ readJsoncOrError,+ );++ expect(result.ok).toBe(true);+ expect(result.value.compilerOptions.customConditions).toEqual(['@inkeep/source']);+ });++ it('separates a file that is not there from one that is malformed', () => {+ const absent = readJsoncOrError(path.join(os.tmpdir(), 'read-jsonc-absent', 'tsconfig.json'));+ expect(absent).toMatchObject({ ok: false, code: 'ENOENT' });+ expect(absent.reason).toContain('does not exist');++ const broken = withFile('{ "compilerOptions": ', readJsoncOrError);+ expect(broken).toMatchObject({ ok: false, code: 'EPARSE' });+ expect(broken.reason).toContain('malformed rather than merely commented');+ });+});diff --git a/tsconfig.json b/tsconfig.jsonindex b016ac511..956a04be3 100644--- a/tsconfig.json+++ b/tsconfig.json@@ -12,7 +12,10 @@"declarationMap": true,"sourceMap": true,"isolatedModules": true,- "verbatimModuleSyntax": true+ "verbatimModuleSyntax": true,+ "customConditions": ["@inkeep/source"],+ "types": [],+ "erasableSyntaxOnly": true},"exclude": ["node_modules", "dist"]}diff --git a/turbo.json b/turbo.jsonindex 8aeec8b76..2b454991c 100644--- a/turbo.json+++ b/turbo.json@@ -4,6 +4,7 @@"test-support/fixtures/share-url-v1-v2.json","test-support/fixtures/codex-legacy-warning-envelopes.json","pnpm-workspace.yaml",+ "tsconfig.json","patches/*.patch"],"tasks": {@@ -39,6 +40,14 @@"typecheck": {"dependsOn": ["^build"]},+ "@inkeep/open-knowledge#check:dts": {+ "dependsOn": ["build"],+ "inputs": [+ "tsconfig.check.json",+ "scripts/check-published-dts.mjs",+ "$TURBO_ROOT$/scripts/read-jsonc.mjs"+ ]+ },"@inkeep/open-knowledge-docs#build": {"dependsOn": ["^build", "typecheck"],"outputs": ["dist/**", ".next/**"],@@ -104,6 +113,8 @@"src/**/*.tsx","src/**/*.json","tests/contract/**/*.ts",+ "scripts/**/*.ts",+ "scripts/**/*.mjs","vitest.config.ts","../../test-support/*.ts"]@@ -140,6 +151,26 @@"../server/src/**/*.ts"]},+ "@inkeep/open-knowledge-core#test": {+ "dependsOn": ["^build"],+ "cache": true,+ "inputs": [+ "src/**/*.ts",+ "src/**/*.tsx",+ "src/**/*.json",+ "src/**/*.css",+ "tests/contract/**/*.ts",+ "scripts/**/*.mjs",+ "scripts/**/*.test.ts",+ "package.json",+ "vitest.config.ts",+ "vite.dedupe.ts",+ "tests/lingui-macro-shim.tsx",+ "tests/integration/idb-preload.ts",+ "../../test-support/*.ts",+ "../test-support/*.ts"+ ]+ },"test:dom": {"dependsOn": ["^build"],"cache": true,@@ -285,7 +316,7 @@]},"test:e2e": {- "dependsOn": ["^build"],+ "dependsOn": ["^build", "build"],"cache": false},"test:visual": {