@akanjs/devkit 3.2.0-rc.17 → 3.2.0-rc.19

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (82) hide show
  1. package/CHANGELOG.md +74 -5
  2. package/DEV_RUNTIME_KNOBS.md +4 -3
  3. package/akanApp/akanApp.host.test.ts +18 -2
  4. package/akanApp/akanApp.host.wiring.test.ts +723 -0
  5. package/akanApp/devIdleSuspend.test.ts +107 -20
  6. package/akanApp/devIdleSuspend.ts +31 -14
  7. package/akanApp/devIdleSuspend.watcher.test.ts +77 -0
  8. package/apiReport/apiReport.test.ts +29 -0
  9. package/apiReport/apiReportDiff.ts +35 -1
  10. package/app/applicationBuildReporter.ts +2 -49
  11. package/app/routeSourceValidator.test.ts +17 -0
  12. package/app/routeSourceValidator.ts +5 -1
  13. package/artifact/implicitRootLayout.test.ts +67 -3
  14. package/artifact/implicitRootLayout.ts +9 -4
  15. package/artifact/implicitRootLayoutRender.test.tsx +297 -0
  16. package/codeAgent/agent/akanSystemPrompt.ts +1 -1
  17. package/codeAgent/skills/akan-scaffold/SKILL.md +1 -1
  18. package/commandDecorators/command.ts +2 -1
  19. package/commandDecorators/commandBuilder.ts +1 -1
  20. package/commandDecorators/commandDecorators.test.ts +28 -4
  21. package/context/akanContext.ts +20 -527
  22. package/context/akanContextInspection.ts +296 -0
  23. package/context/akanMcpContract.ts +13 -253
  24. package/context/doctor/agentGuideCheck.ts +81 -0
  25. package/context/doctor/configLeftoverCheck.ts +35 -0
  26. package/context/doctor/doctorFindings.ts +70 -0
  27. package/context/doctor/generatedFreshness.ts +56 -0
  28. package/context/doctor/moduleShapeCheck.ts +88 -0
  29. package/context/doctor/recipeDuplicateCheck.ts +39 -0
  30. package/context/doctor/recipeIndexCheck.ts +87 -0
  31. package/context/doctor/rootShapeCheck.ts +55 -0
  32. package/context/doctor/workflowScope.ts +97 -0
  33. package/context/safeRead.ts +9 -0
  34. package/devkitUtils.test.ts +34 -0
  35. package/executors/executors.test.ts +28 -4
  36. package/executors/workspaceExecutor.ts +1 -2
  37. package/frontendBuild/devGeneratedIndexSync.ts +5 -36
  38. package/frontendBuild/hmrWatcher.stop.test.ts +36 -0
  39. package/frontendBuild/hmrWatcher.ts +2 -0
  40. package/frontendBuild/optionalPeers.test.ts +35 -7
  41. package/incrementalBuilder/buildBatch.proc.ts +13 -3
  42. package/incrementalBuilder/buildBatchProtocol.ts +2 -0
  43. package/incrementalBuilder/buildBatchRunner.test.ts +61 -0
  44. package/incrementalBuilder/buildBatchRunner.ts +6 -3
  45. package/incrementalBuilder/builderBoot.ts +106 -0
  46. package/incrementalBuilder/builderBuildStatus.ts +23 -0
  47. package/incrementalBuilder/builderChannel.ts +11 -0
  48. package/incrementalBuilder/builderLanes.ts +157 -0
  49. package/incrementalBuilder/builderWatch.ts +213 -0
  50. package/incrementalBuilder/csrRegistry.ts +234 -0
  51. package/incrementalBuilder/incrementalBuilder.proc.test.ts +92 -1
  52. package/incrementalBuilder/incrementalBuilder.proc.ts +80 -822
  53. package/incrementalBuilder/ssrRegistry.ts +278 -0
  54. package/integration/devStability.integration.test.ts +62 -56
  55. package/package.json +3 -3
  56. package/test/testHelpers.ts +36 -0
  57. package/util/errorReport.ts +66 -0
  58. package/workflow/constantSource.ts +187 -0
  59. package/workflow/dictionarySource.ts +184 -0
  60. package/workflow/executor.ts +5 -8
  61. package/workflow/fieldExpression.ts +153 -0
  62. package/workflow/fieldLabel.ts +61 -0
  63. package/workflow/fieldOrder.ts +117 -0
  64. package/workflow/fieldType.ts +2 -1
  65. package/workflow/keyRename.ts +1 -1
  66. package/workflow/moduleIndex.ts +1 -1
  67. package/workflow/modulePaths.ts +27 -0
  68. package/workflow/mutationScaffold.ts +7 -15
  69. package/workflow/mutationSource.ts +2 -1
  70. package/workflow/plan.ts +2 -1
  71. package/workflow/primitiveReport.ts +78 -0
  72. package/workflow/serviceSource.ts +33 -0
  73. package/workflow/signalSource.ts +96 -0
  74. package/workflow/source.ts +50 -1100
  75. package/workflow/sourceAst.ts +30 -0
  76. package/workflow/sourceImports.ts +105 -0
  77. package/workflow/sourceText.ts +13 -0
  78. package/workflow/templateSource.ts +30 -0
  79. package/workflow/testSource.ts +31 -0
  80. package/workflow/types.ts +1 -1
  81. package/workflow/uiPolicy.ts +1 -1
  82. package/workspace/workspaceLayout.ts +3 -1
package/CHANGELOG.md CHANGED
@@ -56,6 +56,13 @@
56
56
  - **The `akan-service` skill** carries a recipe for pages backed by an external HTTP API: an `adapt()` adapter in `srvkit/` that reads its base URL at boot, a `lib/_<service>` service, a `Public` `query(Any, { nullable: true })` endpoint and its dictionary label, and the page that calls it.
57
57
  - **The README's "Inside an existing repository"** runs the creator through `npx -y bun@1.4.4 x …` on a host with only Node and npm, so nothing global is written. It also gives copy-ready `build` and `start` scripts, says a fresh clone builds without a committed env file, and says which environment a `.env`-less build is for and what a deployed host sets instead.
58
58
 
59
+ - a166716: The agent guide tells a coding agent to finish the task and to write a final message a reader can follow.
60
+
61
+ - `AGENTS.md`'s managed block gains two sections. **Finishing Work**: carry the task to `verify ok`, treat a failing check or a stale generated file as an obstacle to work through (never by silencing the check), ask only when the work cannot go on, and confirm before a push, a deploy or a write to a shared database. **Reporting**: lead with the outcome, name every changed file, give each check's result line, and say what was left undone.
62
+ - A new workspace's `AGENTS.md` asks the agent to finish the task with a small marked workaround while a framework issue is drafted.
63
+ - The `akan-scaffold` skill builds the request without a supporting entity nobody asked for and says why one may be needed, instead of stopping to ask.
64
+ - `akan code` closes a turn that changed files with those files and what `akan_verify` said.
65
+
59
66
  - 61fbd7d: `get_graph` takes `since`, a git revision, and returns the Change Map: the Akan Graph of what changed since HEAD forked from that revision, working tree and untracked files included. Every node, field and edge is marked `added`, `removed` or `changed`. The unchanged nodes a changed one calls, or is called by, stay in as context, and `unmapped` lists the changed files under `apps/` or `libs/` that no node covers, each marked the same way. `since: "HEAD"` maps uncommitted work only. Files `.gitignore` covers stay out, a renamed file reads as removed and added, and a CRLF checkout of an unchanged file reads as unchanged. A revision git does not know returns a `graph-since-unknown` diagnostic, and so does one HEAD shares no commit with (a shallow clone, say) instead of comparing with its tip. A revision that starts with `-` also returns it and never reaches git.
60
67
 
61
68
  - **`AkanGraphDiff.between(base, head)`** in `@akanjs/language` diffs two graphs. `index.graph(readText, { digests: true })` gives each member, query, component and field a hash of its body text, so an edit inside a method, or to a field's options, marks it changed and moving it does not.
@@ -121,6 +128,21 @@
121
128
  - **`internal`, `adaptor` and `plugs`** join `AkanGraphNodeKind` and `AkanGraphEdgeKind` in `akanjs/common`.
122
129
  - **`FileFacts.internals` and `FileFacts.adaptors`** in `@akanjs/language`, with `ServiceClassFact.plugs`; `AkanIndex.setFile` also reads non-test files that call `adapt` or `dangerouslyAdapt`.
123
130
 
131
+ - 882e976: The Akan Graph takes a lib's named re-export of a package class only along the chain it walks from the plug's import path, the same chain its `export *` walk follows. The forms it reads are `export { Stripe } from "stripe-sdk"`, `export { default as PayPal } from "paypal-sdk"` and `import { TossClient } from "toss-sdk"; export { TossClient as Toss }`. A plug `Stripe` imported from `@libs/shared/srvkit` follows that folder's index and the modules the index exports. It also follows a relative named re-export (`export { Wise } from "./vendors/wise"`) and an `export *` into another folder or lib (`export * from "../common/square"`, `export * from "@libs/util/srvkit"`). A re-export the chain does not reach no longer claims the plug. Examples are `libs/shared/webkit/stray.ts`, a file in a subfolder whose committed index does not export it, and `srvkit/stripe.helper.ts`, which the generated barrel skips.
132
+
133
+ A facet folder (`ui`, `webkit`, `srvkit`, `common`, `plugin`) with no index on disk is read as the barrel `akan sync` writes. The generated barrels are gitignored, so this is every facet in a Change Map. As a result, a plug gets the same id in the graph view and in the Change Map, with or without `akan sync`. The folder scans that stood in for a missing barrel are gone. The barrel rule (which files and folders, the naming rule, and Biome's sort order) now lives in `akanjs/common` as `facetBarrelOf`, `facetBarrelNamesOf`, `compareExportNames` and `barrelFacetDirs`. The facet index template, the dev server's index sync and the graph all share it, and `akan sync` writes the same bytes as before.
134
+
135
+ A package `export *` on the chain is refused only for a name that a module along the chain declares. A declaration elsewhere in the imported lib no longer blocks it. Two re-exports that name the same package through different paths (`"stripe-sdk"`, `"stripe-sdk/server"`) are one adaptor. Guards still find a named re-export anywhere in the lib, as before. A guard reached through an `export *` reads a missing facet barrel the same way, so the Change Map locates `guard:libs/util:Admin` behind `libs/shared/srvkit/util.ts: export * from "@libs/util/srvkit"` as the graph view does.
136
+
137
+ Ids that change for a saved graph or a Change Map base:
138
+
139
+ - In a Change Map, a guard reached through an `export *` in a facet folder with no index is the guard the graph view links, where it was the unlocated `guard:<lib>:<Name>`.
140
+ - A plug whose name the lib re-exports from a package only off the import's chain is the unlocated `adaptor:<lib>:<Name>`, where it was `adaptor:<that package>:<Name>`.
141
+ - A plug reached through a relative named re-export, or through an `export *` into another lib, is `adaptor:<package>:<Name>` where it could be the unlocated `adaptor:<lib>:<Name>`.
142
+ - A plug whose name two modules along the chain re-export from different packages is the unlocated `adaptor:<lib>:<Name>`, as TypeScript drops a name two `export *` share, where it was the first file's package.
143
+ - A plug a chain's sole package `export *` reaches is `adaptor:<package>:<Name>` even when the lib declares `<Name>` off the chain, where it was the unlocated `adaptor:<lib>:<Name>`.
144
+ - An owner can have several same-name adaptors. With no index in the import's facet folder, a plug of one of them follows the generated barrel. It used to take the first adaptor under the folder. Through an import path that is neither a module nor a facet folder, the plug is the unlocated `adaptor:<owner>:<Name>`, where it was the first adaptor.
145
+
124
146
  - bb40785: The Akan Graph maps `page/`. Each route file is a `route` node named by its URL pattern after the locale (`route:apps/demo:/memo/:memoId`, groups dropped as the router drops them), and each `_layout.tsx` is a `layout` node keyed by its folder (`layout:apps/demo:/(app)`, `root` for a `rootLayout()`). A `wraps` edge runs from each layout to the routes and layouts directly inside it, located at the wrapped file. A route or layout whose default export runs `.guard()` reads `guard` and links each function its guard calls that the file imports or declares: `.guard(() => signedIn())` reaches `signedIn` in `@libs/shared/webkit`, with its location and the comment above it, and a function declared in the page itself is keyed by that file (`guard:apps/demo:page/pin.tsx#isOwn`). A call to anything else (`Boolean`, akanjs's `redirect`, a package's `dayjs`) is looked through, a helper handed to a guard (`isOwn(isId(id))`) is not a guard, and an imported guard is looked up under its import path first. A layout's guard gates every route it wraps; the routes themselves do not repeat it, so a guard added to a layout marks only that layout changed in the Change Map. A route's default export, or the const it names (`const route = page()…; export default route`), is the route node itself, so the slices and actions a page uses hang off its URL. `_overrides.tsx` and the git-ignored `page/(libs)/` links are left out; a lib's own pages are its routes. A route's digest covers its whole file, so the Change Map marks an edited page changed instead of listing it as unmapped.
125
147
 
126
148
  An unscoped `get_graph` still answers a graph of up to 600 nodes whole. Past that, it first drops the routes and layouts that neither changed nor use a change, and the route-only guards they leave unlinked, before it asks for a scope; an `app` or `module` scope brings them back. Studio's first column reads "Pages & components".
@@ -166,6 +188,7 @@
166
188
  - It sits behind the same gate as the other `/_akan` devtools routes, and `akan tunnel` / `akan start --share` refuse it.
167
189
 
168
190
  - 2d3b958: `ApiReportPolicy.check` counts a changeset that a branch adds in place of a similar one it deletes. git's rename detection paired the two, so the added changeset was not listed and its `minor` bump did not satisfy the check.
191
+ - 2d5d659: The API break check (`bun run api:report --base`) no longer asks for a `minor` changeset when an inferred type's union members or object members only moved. The checker orders them by when it first met each one, so a refactor that changes which file is checked first reordered them without changing the type. Reordered overloads still count as a change.
169
192
  - 465ccb9: `@akanjs/devkit/apiReport/apiReport` renders a package's public API, one report per entry point, from its declaration emit. The akanjs repository now commits that report for `akanjs` and checks it in CI: a removed export or a changed declaration needs a `minor` changeset that says how to upgrade.
170
193
  - 222c7df: `akan lint` holds `server/`, `service/` and `signal/` of the `akanjs` package to the bare built-in `Error`s they construct or extend today (`akan.error.bare-error`): its `akan.baseline.json` records them per file and holds their total, so moving one between files passes and a new one anywhere fails. A change that removes one must lower the section too: `akan lint --no-fix` fails while the recorded total is above the code's, and `akan verify akanjs` or `akan lint akanjs` lowers it. No other package or workspace is measured by it. A baseline committed before a rule is added now adopts that rule with the debt its code held at the fork point.
171
194
 
@@ -173,6 +196,7 @@
173
196
 
174
197
  - d12f556: The barrel-import rewrite maps a name that a barrel re-exports by name from another barrel (`export { migration } from "./migration"`) to the file that declares it, as it already did through `export *`. It used to stop at the inner barrel, so a page that imported one name loaded every module behind it.
175
198
  - a480576: A file moved since the fork point keeps its `akan.baseline.json` entries, whether it was moved with `git mv` or a plain rename. The growth check reads the committed entries under the path git pairs the file with, and `--fix` rewrites the working entries there, so moving a recorded file no longer fails as new debt. A move that also rewrote more than half the file, or left a file at the old path, still reads as new, since git no longer sees it as a move.
199
+ - 1b04784: The dev build batch worker now waits for the runner to take its result before exiting, so a result can't be lost however fast the worker finishes. In the tests, workers that exited within milliseconds of starting could lose everything they sent and be reported as crashed.
176
200
  - 0504209: `akan build <app> --env <env>` builds for an environment other than the workspace `.env`'s, the way the desktop and mobile builds already do. Before, the shell's `AKAN_PUBLIC_ENV` lost to the `.env`, so a new workspace could only build `local` without editing it. The local-build notice, the image guard and the README now say what a `local` build changes in a built server: no endpoint rate limits, and local defaults for Redis and the database mode. They no longer say the dev routes are served, which a built server never does.
177
201
  - bf872ce: A variable the shell sets now outranks the workspace `.env` when `akan` builds or runs an app, as dotenv and Bun's own `.env` loading do: `AKAN_PUBLIC_ENV=main akan build <app>` builds `main` where the `.env` says `local`. The order is `--env` (for `AKAN_PUBLIC_ENV`), then the process environment (the shell, and the `.env.local` and `.env.<NODE_ENV>` Bun loads into it), then the `.env`, then the defaults; an empty export counts as unset. The bundles, the bundled server env, `akan.env.json` and the Dockerfile still take one set of values. Where an exported value outranks the `.env`, `akan build` now warns with both values instead of the old warning that listed the values it ignored, and the server-env message, the `--env` help, the local-build notice, the README and the CLI reference state the new order.
178
202
 
@@ -187,6 +211,13 @@
187
211
 
188
212
  In `@akanjs/devkit`, `shouldAbandonBackendRecovery` is replaced by `backendRecoveryPolicy`, which gives up after five failed backend restarts as before.
189
213
 
214
+ - 9134033: A failed command prints the errors inside an AggregateError, not just its message.
215
+
216
+ - A `Bun.build` failure thrown as `new AggregateError(result.logs, "…")` printed only that message. An app plugin's `syncAssets` hook is one place that throws it, and there `akan sync` printed only `[licenseNotices] server graph failed` and dropped the `Could not resolve` lines that named the cause. The CLI now prints up to 20 inner errors under the message, then `…and N more`, then the `cause` chain. Bun build and resolve logs keep their `file:line:col`, and everything prints last, where a tail of the output keeps it.
217
+ - Any failed command's error now prints its `cause` chain as `Caused by:` lines, an AggregateError or not. A cause or an inner error that loops back on itself prints `[circular]` and ends there.
218
+ - `--json` is unchanged: its `error` field stays the one-line message.
219
+ - `akan build`, `typecheck` and `verify` already printed inner errors. They now stop at the same 20.
220
+
190
221
  - e65172d: The CLI refreshes a cloud sign-in once less than an hour, or half the token's lifetime, is left, whichever is shorter. Before, a token that lived an hour or less read as due the moment it arrived, so every command rotated the refresh token and then called the cloud unsigned. Any unexpired token is now sent with the request, except the refresh call, which carries none. `akan login` signs in again when a session is due for refresh and has no refresh token left.
191
222
  - c3b5b3c: The framework no longer puts `@akanjs/native/core` on a web page. `isNativeApp()` and the other host checks read the platform the shell writes before the bundle runs, and a native shell still starts core with the page. A file that imports `akanjs/client/native` statically still brings core to every page that reaches it. On the minimal app this takes 15 KB raw (5.6 KB brotli) off the vendor floor and 20 KB raw (6.6 KB brotli) off every route entry. `akan build` also resolves the `production` export condition for the browser, SSR-client, CSR and MCP App view bundles, so a package such as Lexical ships its production build alone. On the minimal app the Agent editor chunk drops from 91 KB to 63 KB brotli. `akan start` is unchanged.
192
223
  - 6d5b544: A database service now has `create<Model>Many(rows)`. It creates the rows on the same path as `create<Model>`: `_preCreate` and `_postCreate`, the document's save and create hooks, and the live and pubsub events each row's commit fires. Every row's `_preCreate` and document pre hooks run first, so a check there that queries the table does not see the batch's own rows. The rows are then written in one transaction, joining the caller's when one is open, with one multi-row INSERT per 500 rows instead of one statement per row; if the database refuses one row, none is written. Every row's `_postCreate` runs once the transaction commits, as `create<Model>`'s runs once its row is stored, so a `_postCreate` that throws leaves the rows written. A service that already declares a method of that name, itself or in a lib service it extends, keeps its own at runtime, but its signature no longer typechecks against the generated one: rename it.
@@ -215,6 +246,7 @@
215
246
  - **Git.** When git has no identity configured, as in many containers and CI images, the first commit is made as `Akan.js <noreply@akanjs.com>` instead of failing; once `user.name` and `user.email` are set, `git commit --amend --reset-author` makes it yours. In a folder another git repository tracks, the scaffold no longer runs `git init`, which made the outer repository record a gitlink instead of the files, and it commits nothing there: the new files are left for you to commit in that repository. A folder that repository ignores, as `app/` or `app/*` does, still gets its own repository and commit.
216
247
  - **`@akanjs/devkit`**: `applyTemplate` takes `dryRun` to list the files a template would write without writing them, and `WorkspaceExecutor.commit` takes an `identity` to commit under.
217
248
 
249
+ - 82d62b1: A CSR bundle and each MCP App view no longer carry the route-level boundary, which only a server render draws. The generated root layout's `LevelBoundary` export is now undefined in a CSR build, which MCP App views share, so their `import * as root` of the layout no longer keeps it. In `akan build minimal --fast` each MCP App view and the CSR `index.html` are about 0.45KB smaller raw. A server render is unchanged.
218
250
  - 1870fcd: `akan verify` adds a `fix:` line to a module file's two-parent import that names the layer barrel to import from instead, such as `import from "@apps/<app>/common"`. The lint message itself now points at the layer barrel too.
219
251
  - 5691327: `setErrorConstructor` on `FetchClient`, `HttpClient` and `WsClient`, `HttpClientOptions.ErrorCls` and `FetchClient.build`'s `Err` option are deprecated. Every dictionary's `Err` is `akanjs/common`'s `Err`, which a restored error already is, so they change nothing. They keep working. A generated `lib/sig.ts` no longer calls `fetch.setErrorConstructor(Err)`, and a generated `lib/useClient.ts` no longer passes `{ Err: pageProto.Err }`; `akan sync` rewrites both. No upgrade step is needed.
220
252
  - 7c39aea: The 82 source files at the root of `@akanjs/devkit` now sit in folders by concern:
@@ -237,6 +269,8 @@
237
269
 
238
270
  **For an existing workspace** nothing is required. To give a fresh clone values other than the empty defaults, commit an `env/env.server.example.ts` (and `env.client.example.ts`) without secrets in it; in an older workspace, add `!**/env.client.example.ts` to `.gitignore` for the client one. If you link env files into a new worktree, link them before the first `akan` command there, or replace the defaults it wrote.
239
271
 
272
+ - 668a52d: Listing an app's or lib's modules (`SysExecutor.getModules`, and the constant-file readers built on it) no longer fails with `ENOENT` when the process runs outside the workspace root, and skips a dangling symlink instead of rejecting.
273
+ - fa42f4e: A dev server about to idle-suspend now decides again once its idle watcher has started, and stays awake if a builder request or builder message came in while the watcher was starting, or if the builder or backend stopped being ready. It used to release the builder anyway, so a `build-graph` or route request sent in that window waited for the next wake or failed. A dev file watcher stopped in the middle of a scan no longer reports what that scan found, which the next idle wake used to replay as a stale change.
240
274
  - fd2c575: A dev server that stops no longer re-arms its idle-suspend timer or keeps a file watcher running. A wake that settles after the stop, a builder message or relayed request that arrives after it, and an idle watcher that finishes starting after it each used to re-arm the timer, report the host awake, or leave the watcher open. A request that reaches a host stopped while suspended is now refused at once instead of being held for a wake that never comes.
241
275
  - e2b809a: The typecheck behind `akan typecheck`, `akan verify` and `akan build` now uses its incremental cache. It wrote a `.tsbuildinfo` on every run, then checked every file again anyway, so a run with nothing changed cost as much as the first: about 8 seconds on a 2,400-file project. Now a run re-checks only the files that changed and the files they affect, and reads the rest from the cache. The same project's second run takes about 1.2 seconds. The diagnostics are the same, in the same order, as a full check: options, global, syntax, type and declaration errors, an edited file's new errors and the errors it causes in files that import it. `--clean` still clears the cache first.
242
276
  - bf28968: An app can now serve its default locale at unprefixed paths. Set `i18n.localePrefix` to `"as-needed"` in `akan.config.ts`, and `/books/OL45804W` is the English page itself. Before, every page lived under `/<locale>/…`, and an unprefixed path answered with a 307 to the locale the browser asked for. An app with one language, or with URLs fixed from outside (OAuth callbacks, QR codes, links in mail, a migrated site), could only meet them with raw `<a href>`s, which reloaded the whole page and went through that 307 on every click.
@@ -288,10 +322,21 @@
288
322
  Starting the browser now has its own bound of 120 s, `startTimeoutMs` on `PreviewView.probe`. Running out of it reads `Timed out starting the <engine> browser after 120 s.`, where the engine is `chrome` or `webkit`. A browser that misses its bound may still come up late, so later pages in that process try again, but each waits only its own `timeoutMs` for the browser. Once the browser answers, the full bound applies again. So a browser that never starts holds the first page for 120 s, where before it held it for `timeoutMs` (60 s for `akan preview`, 30 s for the code agent's check).
289
323
 
290
324
  - eefd9cb: `akan preview <app> /_akan/studio` opens Studio instead of a 404. Preview added the default locale to every path, and the server routes `/_akan/*` without one, so `/en/_akan/studio` matched no page. A path under `/_akan`, `/__csr`, `/__rsc`, `/.well-known` or the app's API prefix, a file the app's `public/` holds, and the server's own `/favicon.ico`, `/robots.txt`, `/sitemap.xml` (at the root only, the one place the server answers it) and `manifest.webmanifest` now open as written: no locale, and no CSR boot query under `--csr`. Every other path, including one that already starts with a locale or ends in a dotted segment such as `/release/1.2.3`, is a page and gets the default locale as before. The `akan-debug` skill and the `akan preview` reference say so.
291
- - 01ca04b: `akan preview` opens `/openapi.json` and `/mcp` as written, as the server mounts them outside `/:lang`; before, they got the default locale and opened a 404 page. `/mcp` answers only `POST`, so its preview fails with 405, and the docs say preview cannot check it. A full URL (`http://localhost:<port>/oauth/token`) now opens its path and query with no locale and no CSR boot query, so an endpoint mounted outside the API prefix can be opened; before, a full URL was taken by its path and given the locale. Preview always stays on the app's dev server, for a path that starts with `//` too, and notes a full URL that names another server. `--csr` prints a note naming each path it opens without the CSR boot instead of dropping the flag silently. A page `--changed` finds opens as a page even at a server route's path such as `/openapi.json`, under the same locale rule as a typed page, and a trailing slash names the same page, so `/en` and `/en/` open once. A screenshot's file name carries the page's query and a short hash of the query as sent, a path that is not plain lower-case words carries a hash of the path, and a long path or query is cut with a hash, so `/a/b` and `/a-b`, `?a=b+c` and `?a=b%20c`, or `/_akan/studio?view=runtime` and `?view=signals` no longer overwrite one another and a long query no longer fails the page. The `akan-debug` skill, `akan preview --help` and the `akan preview` reference state the same rule.
325
+ - 01ca04b: `akan preview` opens `/openapi.json` and `/mcp` as written, as the server mounts them outside `/:lang`; before, they got the default locale and opened a 404 page. `/mcp` answers only `POST`, so its preview fails with 405, and the docs say preview cannot check it. A full URL (`http://localhost:<port>/oauth/token`) now opens its path and query with no locale and no CSR boot query, so an endpoint mounted outside the API prefix can be opened; before, a full URL was taken by its path and given the locale. Preview always stays on the app's dev server, for a path that starts with `//` too, and notes a full URL that names another server. `localhost`, `127.0.0.1` and `0.0.0.0` on the dev port, which `akan start` binds, are the dev server and get no note; `*.localhost`, which can name a sub-route host, still gets one. A full URL's scheme matches in any case (`HTTP://…`). `--csr` prints a note naming each path it opens without the CSR boot instead of dropping the flag silently. A page `--changed` finds opens as a page even at a server route's path such as `/openapi.json`, under the same locale rule as a typed page, and a trailing slash names the same page, so `/en` and `/en/` open once. A path that ends in a slash outside the framework's prefix routes is a page, as the server reads it: `/openapi.json/` or `/logo.png/` misses its exact route and the locale proxy redirects it. Two paths that would write one screenshot open once, such as `/board?akanMobileTarget=preview` and `/board` under `--csr`, or `?a=1&&b=2` and `?a=1&b=2`, and a note names the path that folded; the `--csr` note names only the rows that open. A screenshot's file name carries the page's query and a short hash of the query as sent, a path that is not plain lower-case words carries a hash of the path, and a long path or query is cut with a hash, so `/a/b` and `/a-b`, `?a=b+c` and `?a=b%20c`, or `/_akan/studio?view=runtime` and `?view=signals` no longer overwrite one another and a long query no longer fails the page. The `akan-debug` skill, `akan preview --help` and the `akan preview` reference state which paths open as written.
292
326
  - b101fcf: `akan remove-application`, `remove-library`, `remove-package`, `remove-module` and `remove-scalar` no longer delete a target they picked themselves. Left out, or named but not in the workspace, the target is refused in a terminal or not, with the choices and the line to rerun, such as `` Missing app: this command deletes files and never picks its target, so rerun it as `akan remove-application <app>` (choices: pokedex). `` Before, `akan remove-application` in a one-app workspace removed `apps/<app>` without asking, and without a terminal `akan remove-scalar <name>` removed the scalar from the only app or lib. A terminal is no longer offered a select for these commands. Other commands still take the only app, or the only app or lib without a terminal, as before. A command declares this with `destructive: true` on its target.
293
327
  - 44149b1: `akan remove-module` now removes a service module named exactly, as in `akan remove-module pokedex:_billing` for `apps/pokedex/lib/_billing`. Before, no command could remove a service module: `remove-module` left out every `lib/_<name>` folder and refused one by name with `Invalid module name: _billing`. A service module left out or misnamed gets the same refusal as any target of a remove command, and its choices now list the service modules. `create-view`, `create-unit`, `create-template` and `create-crud-page` still take only a model module. A command opts in to service modules by taking `ModuleOrService` instead of `Module`.
294
328
  - 4fcf44f: A new `rename-key` workflow renames a slice key or a Filter query key everywhere it is spelled. That covers the key itself, every name derived from it (`initMemoInPublic`, `memoListInPublic`, `queryByName`) in the app and every lib, and its module dictionary entry. It is the same rename the editor extension's F2 runs, so agents get it through `plan_workflow` / `apply_workflow` and the CLI through `akan workflow plan rename-key --app <app> --module <module> --slice <key> --to <newKey>` (or `--query <key>`). The plan lists each file it will change. A use that could also be another model's is left alone, and `akan verify` then reports it.
329
+ - 9a2a8c9: The build refuses a `LevelBoundary` or `McpAppRoot` export on an app's root layout: `page/_layout.tsx`, or a grouped or base-path root layout. Akan.js defines both on the root layout it generates and reads neither from an app's layout, so such an export was silently ignored. The error names the export and the file and says why. Remove the export; it never took effect.
330
+
331
+ `akanjs/common` exports `GENERATED_ROOT_LAYOUT_EXPORTS`, the set of those names.
332
+
333
+ - 9a2a8c9: A root layout whose own route level fails after the page has started streaming now draws the route-level notice ("This page could not be loaded." with "Try again") instead of blanking the page. That covers an app's `page/_layout.tsx`, or a grouped root layout, that fails below its own `.loading()`, and a component in it that suspends and then fails.
334
+
335
+ - The generated root layout renders the boundary inside `System.Provider`, around the app's root layout. The provider stays, with the bridge that starts the router, so "Try again" refreshes the page. The notice takes the place of the whole root layout, its header and navigation included.
336
+ - Only a server render gets it. A CSR bundle renders the root layout as before, and an MCP App view does not render the root layout's body.
337
+ - A failure before the first byte is answered as before, since the server runs no error boundary. So is a redirect or not-found the root layout raises; after the first byte the boundary draws no notice for one.
338
+ - The page's markup and its `useId` values are unchanged. Its inline payload gains one wrapper.
339
+
295
340
  - 627dde4: The route JS budget stops failing deploy builds: a plain `akan build` reports an overage, `akan build --check-budget` fails on it, and CI runs that for `apps/minimal` and `apps/akan`, which now commit their `akan.budget.json`. The rc npm publish, which calls CI, skips that job, so an app's budget never holds a release.
296
341
 
297
342
  - **Report by default:** a plain `akan build`, the one a deploy runs, prints a route over its entry or with none, or an unreadable `akan.budget.json`, as a warning under the route table and passes, as `akan verify` does. `--quiet` drops the rest of the summary but still prints the warning.
@@ -316,7 +361,7 @@
316
361
  - af133d7: A route level whose server render fails after the page has started streaming now draws a notice ("This page could not be loaded.") with a "Try again" button in its own place, and the layouts above it stay. Before, the browser rethrew the error with no error boundary above it, so React unmounted the whole page (production error #441, a blank screen). That covered a page or layout below a `.loading()` that throws, and a fetch handle field that reaches no `Load.*` when the server refuses it: awaited in a component below the page, rendered as a child, or `use()`-d by a client component outside `Load.*`.
317
362
 
318
363
  - The generated root layout exports `LevelBoundary`, and server rendering puts it around every route level below that root layout, inside the level's Suspense. The notice is the one a failed level already draws in a CSR app. "Try again" calls `router.refresh()`, and the page's next payload renders the level again.
319
- - The root layout's own level and any `_overrides` level above it get no boundary: the root layout renders `System.Provider`, which starts the router, so a notice at or above it would have no router to retry with. The root level includes an app's `page/_layout.tsx`, and an error there after the first byte still blanks the page.
364
+ - The root layout's own level and any `_overrides` level above it get no boundary: the root layout renders `System.Provider`, which starts the router, so a notice at or above it would have no router to retry with. The generated root layout bounds its own content inside `System.Provider` instead.
320
365
  - A not-found or redirect raised below the route after the page started streaming renders nothing in that level's place, as the host answers it.
321
366
  - An error that fails a level before the first byte has left still gets the nearest layout's `.error()` and its status, since React's server renderer runs no error boundary. The page's markup is the same as before. Its inline payload gains the boundary's client reference and one wrapper per level, and its head gains a modulepreload for the boundary.
322
367
  - **Propagation change:** an error the server streamed now stops at the nearest route level. An error boundary an app put above a layout's `children` no longer sees it. An error thrown while the browser renders a client component carries no digest and propagates as before, so render bugs still surface.
@@ -415,7 +460,11 @@
415
460
  - **`ServiceOptions.serverMode`** carries a doc comment, so an editor shows the same explanation on hover.
416
461
 
417
462
  - 6bb1610: Internal: the dev host (`AkanAppHost`) runs the backend, the builder, idle suspend, RSS recycling and dev-plan restarts through one collaborator each instead of one 126-member class. Its public members, start and stop order, restart timing and messages are unchanged.
463
+ - b7b141a: Internal: `akan doctor` runs one check class per family under `context/doctor/` (`rootShapeCheck.ts`, `agentGuideCheck.ts`, `configLeftoverCheck.ts`, `moduleShapeCheck.ts`, `recipeDuplicateCheck.ts`, `recipeIndexCheck.ts`, collected by `doctorFindings.ts` and scoped by `workflowScope.ts` and `generatedFreshness.ts`), and `inspect_akan_context` answers each request type through `AkanContextInspection` in `context/akanContextInspection.ts`. The doctor's diagnostics, their order, codes, severities and repair actions, the `akan context` output and every MCP answer are unchanged, and `akanContext.ts` and `akanMcpContract.ts` export the same names.
464
+ - 158c507: Internal: `ApplicationCommand` in `application/application.command.ts` now declares its commands through one helper per family (`workspaceTargets`, `migrationTargets`, `inspectTargets`, `buildAndTestTargets`, `nativeBuildTargets`, `startTargets`, `releaseTargets`, `updateTargets`, `databaseTargets`) instead of one 530-line builder. Every command, alias, option, default and `--help` line is unchanged, in the same order. `@akanjs/devkit/commandDecorators` now exports `CommandBuilderContext`, the type such a helper takes.
418
465
  - 7aad7c1: `executors.ts` is split into one file per class under `executors/` and re-exports the same names, so every import of `@akanjs/devkit/executors` and the root barrel is unchanged. Each file under `executors/` also loads on its own: `akanConfig` and `scanInfo` import the `SysExecutor` subclasses when they use them, so no import order loads a subclass before its base.
466
+ - 34b9822: Internal: the dev builder process (`IncrementalBuilder`) runs its work lanes, the CSR and SSR dev registries, the file watcher and boot recovery through one collaborator each, in `builderLanes.ts`, `csrRegistry.ts`, `ssrRegistry.ts`, `builderWatch.ts`, `builderBoot.ts` and `builderBuildStatus.ts`, instead of one 90-member class. Behaviour is unchanged: the same messages are sent in the same order, and route builds, recycling at the memory ceiling and degraded-boot recovery work as before.
467
+ - 382a4c2: Internal: the workflow engine's source-editing helpers in `workflow/source.ts` are split by what they edit into `constantSource.ts`, `dictionarySource.ts`, `serviceSource.ts`, `signalSource.ts`, `templateSource.ts`, `testSource.ts`, `sourceImports.ts`, `fieldExpression.ts`, `fieldLabel.ts`, `fieldOrder.ts`, `modulePaths.ts`, `primitiveReport.ts` and `sourceText.ts`, with the shared AST lookups in `sourceAst.ts`. `workflow/source.ts` re-exports the same names, so `@akanjs/devkit/workflow` and every scaffold and `akan workflow` edit behave as before.
419
468
  - 58f1c64: A route's client code no longer carries the UI of every module in the app and in each lib its store merges.
420
469
 
421
470
  - **Bootstrap.** Each route's `"use client"` entry, every generated root layout and the SSR dev registry start with `import "@apps/<app>/lib/useClient"` and `import "@apps/<app>/lib/st"`, which load the client runtime and the store. They used to import `@apps/<app>/client` bare, and that bundled the whole barrel.
@@ -452,8 +501,8 @@
452
501
  - A tool error carries `_meta["akanjs/failure"]: { code, statusCode }`, beside the server's own `_meta` for a 2026-07-28 client. The code is the one an HTTP caller gets:
453
502
  - a domain `Err` by its dictionary key, such as `base.error.documentNotFound`;
454
503
  - an `AkanError` by its code, such as `invalidArgument` for an argument the call got wrong;
455
- - a 401 or 403 by its status alone (`unauthorized`, `forbidden`);
456
- - a 5xx by a dictionary key or this server's own `AkanError` code, else by its status (`internalError`, `serviceUnavailable`), never by a code a duck-typed error put in its body.
504
+ - a guard's 401 or 403 by its status alone (`unauthorized`, `forbidden`);
505
+ - a 5xx by the dictionary key or code token its HTTP answer carries, else by its status (`internalError`, `serviceUnavailable`). Its text is redacted but its code is not, and the code comes from the error's own JSON when that carries one, which can be a third-party library's.
457
506
  - A JSON-RPC error carries `data.code`, which tells apart what `-32602` covers:
458
507
  - `unknownTool`, `unknownPrompt` (an unlisted page prompt included) and `unknownResource`;
459
508
  - `invalidArgument` for bad arguments or a missing tool name, prompt name or resource uri;
@@ -503,10 +552,12 @@
503
552
  - Updated dependencies [b3f85fa]
504
553
  - Updated dependencies [a707354]
505
554
  - Updated dependencies [4d61170]
555
+ - Updated dependencies [1ef031b]
506
556
  - Updated dependencies [c723713]
507
557
  - Updated dependencies [0351ad4]
508
558
  - Updated dependencies [ba417c6]
509
559
  - Updated dependencies [485f707]
560
+ - Updated dependencies [882e976]
510
561
  - Updated dependencies [bb40785]
511
562
  - Updated dependencies [d2bd9b7]
512
563
  - Updated dependencies [b391491]
@@ -518,6 +569,7 @@
518
569
  - Updated dependencies [ddd3d96]
519
570
  - Updated dependencies [3f231a7]
520
571
  - Updated dependencies [96f9ff6]
572
+ - Updated dependencies [0a81afa]
521
573
  - Updated dependencies [af7c411]
522
574
  - Updated dependencies [1ebc57a]
523
575
  - Updated dependencies [c3b5b3c]
@@ -525,6 +577,7 @@
525
577
  - Updated dependencies [6d5b544]
526
578
  - Updated dependencies [73f8830]
527
579
  - Updated dependencies [5691327]
580
+ - Updated dependencies [14134d3]
528
581
  - Updated dependencies [958f175]
529
582
  - Updated dependencies [9f30e93]
530
583
  - Updated dependencies [ad09fac]
@@ -538,6 +591,7 @@
538
591
  - Updated dependencies [e143263]
539
592
  - Updated dependencies [e4f7876]
540
593
  - Updated dependencies [cb0fd5b]
594
+ - Updated dependencies [f7be62b]
541
595
  - Updated dependencies [24dcb1e]
542
596
  - Updated dependencies [256b6e3]
543
597
  - Updated dependencies [c48d780]
@@ -556,18 +610,22 @@
556
610
  - Updated dependencies [b24fef3]
557
611
  - Updated dependencies [465ccb9]
558
612
  - Updated dependencies [513e48d]
613
+ - Updated dependencies [1a43215]
559
614
  - Updated dependencies [5cd1fc3]
560
615
  - Updated dependencies [f47cc82]
561
616
  - Updated dependencies [cf5eeff]
617
+ - Updated dependencies [6b3b4e4]
562
618
  - Updated dependencies [7f0de74]
563
- - Updated dependencies [c0b84d0]
564
619
  - Updated dependencies [1f93507]
565
620
  - Updated dependencies [5d3cb3e]
621
+ - Updated dependencies [ad4571f]
622
+ - Updated dependencies [9a2a8c9]
566
623
  - Updated dependencies [9a9e1fa]
567
624
  - Updated dependencies [af133d7]
568
625
  - Updated dependencies [463fd1e]
569
626
  - Updated dependencies [f8de6a7]
570
627
  - Updated dependencies [1ed9f6a]
628
+ - Updated dependencies [0c83204]
571
629
  - Updated dependencies [b0ccf6f]
572
630
  - Updated dependencies [7836476]
573
631
  - Updated dependencies [9055634]
@@ -575,6 +633,7 @@
575
633
  - Updated dependencies [a373d51]
576
634
  - Updated dependencies [c723e7a]
577
635
  - Updated dependencies [6c3a303]
636
+ - Updated dependencies [eadb12a]
578
637
  - Updated dependencies [27440aa]
579
638
  - Updated dependencies [bc5fdb0]
580
639
  - Updated dependencies [e3de9ef]
@@ -585,10 +644,19 @@
585
644
  - Updated dependencies [e3de9ef]
586
645
  - Updated dependencies [e3de9ef]
587
646
  - Updated dependencies [463fd1e]
647
+ - Updated dependencies [f923ffb]
648
+ - Updated dependencies [802bffe]
588
649
  - Updated dependencies [99fda20]
589
650
  - Updated dependencies [db5b284]
590
651
  - Updated dependencies [5e08722]
591
652
  - Updated dependencies [2bf769f]
653
+ - Updated dependencies [6d96075]
654
+ - Updated dependencies [a12577f]
655
+ - Updated dependencies [8e24168]
656
+ - Updated dependencies [48b8050]
657
+ - Updated dependencies [cf12100]
658
+ - Updated dependencies [966b5f2]
659
+ - Updated dependencies [2728800]
592
660
  - Updated dependencies [91ccf38]
593
661
  - Updated dependencies [c2af76a]
594
662
  - Updated dependencies [df32c46]
@@ -606,6 +674,7 @@
606
674
  - Updated dependencies [3b7247e]
607
675
  - Updated dependencies [e4c3009]
608
676
  - Updated dependencies [0d7294c]
677
+ - Updated dependencies [e323d6c]
609
678
  - Updated dependencies [d9eaacc]
610
679
  - akanjs@3.2.0
611
680
  - @akanjs/language@3.2.0
@@ -74,9 +74,10 @@ which is the one case where replacing it again cannot help; it says that too, an
74
74
  | `AKAN_BUILDER_RPC_TIMEOUT_MS` | `120000` | How long the backend waits for a builder answer. Generous on purpose: a cold CSR build of every page legitimately takes tens of seconds. |
75
75
  | `AKAN_SERVER_PAGES_SPLITTING` | off | Emit the server pages bundle as chunks instead of one file. Experimental — the memory/latency trade has not been measured on a real app. |
76
76
 
77
- Two more are read by the dev server for its end-to-end tests only; never set them. `AKAN_DEV_SSR_ARM_DELAY_MS`
78
- holds the SSR registry's boot build back, and `AKAN_CSR_DEV_APP_WRITE_DELAY_MS` holds a registry's `app.js`
79
- back after a patch is announced.
77
+ Three more are read by the dev server for its end-to-end tests only; never set them. `AKAN_DEV_SSR_ARM_DELAY_MS`
78
+ holds the SSR registry's boot build back, `AKAN_CSR_DEV_APP_WRITE_DELAY_MS` holds a registry's `app.js` back
79
+ after a patch is announced, and `AKAN_DEV_BUILDER_READY_GATE` keeps a builder whose boot build succeeded from
80
+ reporting ready until the file it names exists.
80
81
 
81
82
  ## Observability
82
83
 
@@ -328,6 +328,22 @@ describe("a stop while the builder is starting", () => {
328
328
  };
329
329
  return builder;
330
330
  };
331
+ // Not `.rejects`: on a start that never settles it waits out three ready timeouts instead of failing the test.
332
+ const settled = async (starting: Promise<unknown>) => {
333
+ let timer: Timer | undefined;
334
+ const pending = new Promise<string>((resolve) => {
335
+ timer = setTimeout(() => resolve("still starting"), 2_000);
336
+ });
337
+ const outcome = await Promise.race([
338
+ starting.then(
339
+ () => "started",
340
+ (error: unknown) => (error instanceof Error ? error.message : String(error)),
341
+ ),
342
+ pending,
343
+ ]);
344
+ clearTimeout(timer);
345
+ return outcome;
346
+ };
331
347
 
332
348
  test("stops a builder created after the stop, and never starts it", async () => {
333
349
  const { app } = track(await createTempApp("demo"));
@@ -345,7 +361,7 @@ describe("a stop while the builder is starting", () => {
345
361
  await Bun.sleep(50);
346
362
  await host.stop();
347
363
  created.resolve(builder as unknown as IncrementalBuilderHost);
348
- await expect(starting).rejects.toThrow("dev server stopped before the builder started");
364
+ expect(await settled(starting)).toBe("dev server stopped before the builder started");
349
365
  expect({ creates, started: builder.started, stopped: builder.stopped }).toEqual({
350
366
  creates: 1,
351
367
  started: 0,
@@ -374,7 +390,7 @@ describe("a stop while the builder is starting", () => {
374
390
  await Bun.sleep(50);
375
391
  expect(builder.started).toBe(1);
376
392
  await host.stop();
377
- await expect(starting).rejects.toThrow("dev server stopped before the builder was ready");
393
+ expect(await settled(starting)).toBe("dev server stopped before the builder was ready");
378
394
  exitLate?.();
379
395
  await Bun.sleep(50);
380
396
  expect({ creates, stopped: builder.stopped }).toEqual({ creates: 1, stopped: 1 });