akanjs 3.3.0-rc.7 → 3.3.0-rc.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/ARCHITECTURE.md +2 -2
- package/CHANGELOG.md +209 -0
- package/CONTRIBUTING.md +2 -2
- package/client/clientRuntime.ts +1 -10
- package/client/cn.ts +4 -4
- package/client/csrTypes.ts +6 -0
- package/client/frameConfig.ts +3 -3
- package/client/index.ts +1 -5
- package/client/router.ts +4 -3
- package/client/rscNavigation.ts +0 -7
- package/common/CodeTranscript.ts +4 -2
- package/common/Logger.ts +3 -0
- package/common/TraceContext.ts +95 -0
- package/common/TrustedProxy.ts +10 -0
- package/common/codeAgentProfile.ts +1 -1
- package/common/codeAgentWire.ts +7 -2
- package/common/inlineToken.ts +26 -0
- package/common/logContext.ts +1 -0
- package/constant/index.ts +0 -1
- package/constant/types.ts +0 -2
- package/document/documentSchema.ts +0 -3
- package/document/filterMeta.ts +3 -16
- package/fetch/client/fetchClient.ts +8 -17
- package/fetch/client/httpClient.ts +7 -11
- package/fetch/client/wsClient.ts +0 -5
- package/fetch/requestStorage.ts +10 -0
- package/index.ts +6 -0
- package/package.json +257 -57
- package/server/SSR_MEMORY_DIAGNOSIS.md +84 -1
- package/server/admissionQueue.ts +107 -0
- package/server/akanApp.ts +30 -14
- package/server/akanAppHeaders.ts +20 -6
- package/server/cachePolicy.ts +2 -1
- package/server/console.ts +5 -12
- package/server/devtools/README.md +15 -3
- package/server/devtools/devtoolsAccess.ts +119 -0
- package/server/devtools/devtoolsRouter.ts +30 -26
- package/server/devtools/devtoolsUnlockPage.ts +38 -0
- package/server/gateway/gatewayChildren.ts +3 -0
- package/server/gateway/gatewayHttpProxy.ts +10 -2
- package/server/gateway/gatewayStatus.ts +10 -0
- package/server/htmlResultCache.ts +45 -11
- package/server/imageOptimizer.ts +44 -12
- package/server/index.ts +0 -4
- package/server/logging/logQuery.ts +9 -1
- package/server/mcp/McpDispatcher.ts +13 -10
- package/server/metrics/metricAggregate.ts +27 -0
- package/server/metrics/metricExposition.ts +92 -0
- package/server/metrics/metricMerge.ts +81 -0
- package/server/metrics/metricRegistry.ts +271 -0
- package/server/metrics/requestMetrics.ts +110 -0
- package/server/metrics/runtimeFamilies.ts +61 -0
- package/server/ops/statusAccess.ts +14 -2
- package/server/processMetricsCollector.ts +1 -0
- package/server/renderBusyResponse.ts +92 -0
- package/server/resolver/databaseModelInstance.ts +21 -19
- package/server/resolver/httpEndpointHandler.ts +43 -0
- package/server/resolver/jobTrace.ts +18 -0
- package/server/resolver/modelFacade.ts +24 -18
- package/server/resolver/modelLoaders.ts +10 -3
- package/server/resolver/signal.resolver.ts +28 -31
- package/server/resolver/timedQuery.ts +3 -3
- package/server/routeCacheQuery.ts +58 -0
- package/server/routeCacheTally.ts +64 -0
- package/server/routeElementComposer.tsx +16 -0
- package/server/routeTreeBuilder.ts +6 -0
- package/server/routing/apiRouter.ts +35 -10
- package/server/routing/appWsData.ts +4 -0
- package/server/routing/builtinRoutes.ts +1 -0
- package/server/routing/devRoutes.ts +50 -0
- package/server/routing/devSurfacePolicy.ts +40 -0
- package/server/routing/devSurfaces.ts +99 -0
- package/server/routing/hostAllowlist.ts +2 -0
- package/server/routing/soloAppRoutes.ts +8 -1
- package/server/rscHostRenderStream.ts +5 -3
- package/server/rscHostRequests.ts +17 -3
- package/server/rscRenderAdmission.ts +130 -0
- package/server/rscRenderControl.ts +2 -1
- package/server/rscRenderHandler.ts +93 -28
- package/server/rscRenderLevels.ts +40 -0
- package/server/rscRenderRefusal.ts +23 -0
- package/server/rscResultCaches.ts +20 -2
- package/server/rscWorker.tsx +20 -4
- package/server/rscWorkerHost.ts +16 -2
- package/server/serverMetrics.ts +20 -1
- package/server/sitemap.ts +0 -5
- package/server/ssrTypes.ts +6 -0
- package/server/webCsrSurface.ts +23 -11
- package/server/webDocumentRoute.ts +8 -6
- package/server/webRouteContext.ts +14 -4
- package/server/webRouter.ts +15 -12
- package/server/webRscRoute.ts +15 -14
- package/service/agent.service.ts +34 -8
- package/service/agentLoop/agentLoop.ts +35 -24
- package/service/agentLoop/agentLoopTypes.ts +16 -7
- package/service/agentLoop/loopCompaction.ts +1 -1
- package/service/agentLoop/loopContext.ts +33 -0
- package/service/agentLoop/loopToolkits.ts +17 -8
- package/service/index.ts +0 -1
- package/service/ipcTypes.ts +22 -0
- package/service/mentionToken.ts +44 -0
- package/service/predefinedAdaptor/anthropicLlm.ts +18 -17
- package/service/predefinedAdaptor/database.adaptor.ts +2 -0
- package/service/predefinedAdaptor/directoryNotWritableError.ts +30 -0
- package/service/predefinedAdaptor/index.ts +1 -0
- package/service/predefinedAdaptor/llm.adaptor.ts +9 -3
- package/service/predefinedAdaptor/llmContext.ts +26 -0
- package/service/predefinedAdaptor/llmFence.ts +55 -0
- package/service/predefinedAdaptor/openaiDialect.ts +45 -18
- package/service/predefinedAdaptor/solidSqlite.ts +2 -0
- package/service/predefinedAdaptor/storage.adaptor.ts +5 -0
- package/signal/SignalFailure.ts +24 -2
- package/signal/httpPeer.ts +9 -0
- package/signal/index.ts +0 -3
- package/signal/openapi/openapi.ts +4 -0
- package/signal/requestTrace.ts +87 -0
- package/signal/signalContext.ts +11 -18
- package/signal/trace.ts +134 -34
- package/store/agent/AgentBridge.ts +6 -2
- package/store/agent/AgentContext.ts +81 -14
- package/store/agent/AgentInline.ts +72 -0
- package/store/agent/StoreSurfaceSource.ts +2 -1
- package/store/baseSt.ts +0 -6
- package/store/index.ts +1 -3
- package/store/stateBuilder.ts +1 -6
- package/types/client/clientRuntime.d.ts +0 -2
- package/types/client/cn.d.ts +0 -4
- package/types/client/csrTypes.d.ts +6 -0
- package/types/client/frameConfig.d.ts +1 -3
- package/types/client/index.d.ts +4 -5
- package/types/client/rscNavigation.d.ts +0 -10
- package/types/common/CodeTranscript.d.ts +1 -0
- package/types/common/Logger.d.ts +2 -0
- package/types/common/TraceContext.d.ts +27 -0
- package/types/common/TrustedProxy.d.ts +1 -0
- package/types/common/codeAgentWire.d.ts +10 -2
- package/types/common/inlineToken.d.ts +5 -0
- package/types/common/logContext.d.ts +1 -0
- package/types/constant/index.d.ts +1 -1
- package/types/constant/types.d.ts +0 -2
- package/types/document/documentSchema.d.ts +0 -2
- package/types/document/filterMeta.d.ts +0 -13
- package/types/fetch/client/fetchClient.d.ts +1 -4
- package/types/fetch/client/httpClient.d.ts +1 -5
- package/types/fetch/client/wsClient.d.ts +0 -2
- package/types/fetch/requestStorage.d.ts +3 -0
- package/types/index.d.ts +10 -0
- package/types/server/admissionQueue.d.ts +26 -0
- package/types/server/akanAppHeaders.d.ts +3 -1
- package/types/server/cachePolicy.d.ts +2 -0
- package/types/server/console.d.ts +0 -7
- package/types/server/devtools/devtoolsAccess.d.ts +12 -0
- package/types/server/devtools/devtoolsRouter.d.ts +0 -1
- package/types/server/devtools/devtoolsUnlockPage.d.ts +11 -0
- package/types/server/gateway/gatewayChildren.d.ts +2 -0
- package/types/server/gateway/gatewayHttpProxy.d.ts +1 -0
- package/types/server/gateway/gatewayStatus.d.ts +1 -0
- package/types/server/htmlResultCache.d.ts +6 -3
- package/types/server/index.d.ts +2 -2
- package/types/server/logging/logStdoutWriter.d.ts +1 -0
- package/types/server/logging/rotatingLogWriter.d.ts +1 -1
- package/types/server/metrics/metricAggregate.d.ts +6 -0
- package/types/server/metrics/metricExposition.d.ts +8 -0
- package/types/server/metrics/metricMerge.d.ts +9 -0
- package/types/server/metrics/metricRegistry.d.ts +76 -0
- package/types/server/metrics/requestMetrics.d.ts +22 -0
- package/types/server/metrics/runtimeFamilies.d.ts +9 -0
- package/types/server/ops/statusAccess.d.ts +6 -1
- package/types/server/renderBusyResponse.d.ts +9 -0
- package/types/server/resolver/httpEndpointHandler.d.ts +14 -0
- package/types/server/resolver/jobTrace.d.ts +5 -0
- package/types/server/resolver/modelLoaders.d.ts +3 -0
- package/types/server/resolver/timedQuery.d.ts +1 -1
- package/types/server/routeCacheQuery.d.ts +11 -0
- package/types/server/routeCacheTally.d.ts +23 -0
- package/types/server/routeElementComposer.d.ts +2 -0
- package/types/server/routing/appWsData.d.ts +3 -0
- package/types/server/routing/devRoutes.d.ts +9 -0
- package/types/server/routing/devSurfacePolicy.d.ts +12 -0
- package/types/server/routing/devSurfaces.d.ts +18 -0
- package/types/server/routing/hostAllowlist.d.ts +1 -0
- package/types/server/routing/soloAppRoutes.d.ts +2 -1
- package/types/server/rscHostRenderStream.d.ts +2 -1
- package/types/server/rscRenderAdmission.d.ts +14 -0
- package/types/server/rscRenderControl.d.ts +2 -1
- package/types/server/rscRenderHandler.d.ts +5 -2
- package/types/server/rscRenderLevels.d.ts +8 -0
- package/types/server/rscRenderRefusal.d.ts +9 -0
- package/types/server/rscResultCaches.d.ts +8 -1
- package/types/server/rscWorkerHost.d.ts +2 -1
- package/types/server/serverMetrics.d.ts +2 -1
- package/types/server/sitemap.d.ts +0 -2
- package/types/server/ssrTypes.d.ts +5 -0
- package/types/server/webRouteContext.d.ts +3 -1
- package/types/server/webRouter.d.ts +2 -1
- package/types/service/agent.service.d.ts +3 -0
- package/types/service/agentLoop/agentLoopTypes.d.ts +16 -7
- package/types/service/agentLoop/loopContext.d.ts +13 -0
- package/types/service/agentLoop/loopToolkits.d.ts +1 -0
- package/types/service/index.d.ts +0 -1
- package/types/service/ipcTypes.d.ts +28 -0
- package/types/service/mentionToken.d.ts +13 -0
- package/types/service/predefinedAdaptor/anthropicLlm.d.ts +3 -3
- package/types/service/predefinedAdaptor/directoryNotWritableError.d.ts +6 -0
- package/types/service/predefinedAdaptor/index.d.ts +1 -0
- package/types/service/predefinedAdaptor/llm.adaptor.d.ts +9 -3
- package/types/service/predefinedAdaptor/llmContext.d.ts +11 -0
- package/types/service/predefinedAdaptor/llmFence.d.ts +15 -0
- package/types/service/predefinedAdaptor/openaiDialect.d.ts +3 -3
- package/types/service/predefinedAdaptor/storage.adaptor.d.ts +1 -0
- package/types/signal/SignalFailure.d.ts +2 -0
- package/types/signal/httpPeer.d.ts +5 -0
- package/types/signal/index.d.ts +1 -1
- package/types/signal/requestTrace.d.ts +31 -0
- package/types/signal/signalContext.d.ts +2 -1
- package/types/signal/trace.d.ts +25 -10
- package/types/store/agent/AgentBridge.d.ts +1 -0
- package/types/store/agent/AgentContext.d.ts +6 -2
- package/types/store/agent/AgentInline.d.ts +16 -0
- package/types/store/baseSt.d.ts +0 -2
- package/types/store/index.d.ts +2 -2
- package/types/store/stateBuilder.d.ts +0 -4
- package/types/ui/Reference/origin.d.ts +0 -2
- package/types/ui/recipe/badgeRecipe.d.ts +2 -2
- package/types/ui/recipe/buttonRecipe.d.ts +2 -2
- package/types/ui/recipe/inputRecipe.d.ts +2 -2
- package/types/vendor/@akanjs/native/packages/cli/src/lib/project.d.ts +5 -0
- package/types/vendor/@akanjs/native/plugins/external-view/src/index.d.ts +20 -8
- package/types/vendor/use-agentic/ToolRunner.d.ts +2 -1
- package/types/vendor/use-agentic/types.d.ts +8 -0
- package/types/webkit/useCsrRefs.d.ts +1 -1
- package/types/webkit/usePageLocation.d.ts +3 -1
- package/ui/Reference/origin.ts +0 -10
- package/ui/System/SSR.tsx +4 -2
- package/vendor/@akanjs/native/CHANGELOG.md +24 -1
- package/vendor/@akanjs/native/native/desktop/Cargo.lock +1 -0
- package/vendor/@akanjs/native/native/desktop/Cargo.toml +2 -0
- package/vendor/@akanjs/native/native/desktop/src/acl.rs +27 -7
- package/vendor/@akanjs/native/native/desktop/src/external.rs +240 -29
- package/vendor/@akanjs/native/native/desktop/src/lib.rs +3 -3
- package/vendor/@akanjs/native/native/desktop/src/navigation.rs +4 -0
- package/vendor/@akanjs/native/packages/cli/src/lib/acl.ts +10 -2
- package/vendor/@akanjs/native/packages/cli/src/lib/project.ts +11 -1
- package/vendor/@akanjs/native/plugins/external-view/native-plugin.json +26 -0
- package/vendor/@akanjs/native/plugins/external-view/src/desktop.ts +9 -1
- package/vendor/@akanjs/native/plugins/external-view/src/index.ts +20 -8
- package/vendor/use-agentic/AgentSession.ts +1 -1
- package/vendor/use-agentic/CHANGELOG.md +14 -0
- package/vendor/use-agentic/Compaction.ts +1 -1
- package/vendor/use-agentic/ToolRunner.ts +12 -0
- package/vendor/use-agentic/WIRE.md +8 -2
- package/vendor/use-agentic/types.ts +8 -0
- package/webkit/McpAppAgent.ts +3 -1
- package/webkit/usePageLocation.ts +8 -2
- package/client/locale.ts +0 -5
- package/service/serviceRegistry.ts +0 -27
- package/types/client/locale.d.ts +0 -6
- package/types/service/serviceRegistry.d.ts +0 -10
package/ARCHITECTURE.md
CHANGED
|
@@ -167,7 +167,7 @@ Declared in [server/rscWorkerHost.ts](server/rscWorkerHost.ts).
|
|
|
167
167
|
| `cache-state` | `RscFlightStream` | `RscWorker` |
|
|
168
168
|
| `chunk` | `RscFlightStream` | `RscWorker` |
|
|
169
169
|
| `end` | `RscFlightStream`, `RscRenderHandler` | `RscWorker` |
|
|
170
|
-
| `redirect` | `RscRenderFallbacks` | `RscWorker` |
|
|
170
|
+
| `redirect` | `RscRenderFallbacks` | `RscRenderHandler`, `RscWorker` |
|
|
171
171
|
| `late-redirect` | `RscFlightStream` | `RscWorker` |
|
|
172
172
|
| `late-not-found` | `RscFlightStream` | `RscWorker` |
|
|
173
173
|
| `not-found` | `RscRenderFallbacks` | `RscWorker` |
|
|
@@ -178,7 +178,7 @@ Declared in [server/rscWorkerHost.ts](server/rscWorkerHost.ts).
|
|
|
178
178
|
| `page-prompt.draw.result` | `RscRenderer` | `RscWorker` |
|
|
179
179
|
| `page-prompts.visible.result` | `RscRenderer` | `RscWorker` |
|
|
180
180
|
| `web-manifest.result` | `RscRenderer` | `RscWorker` |
|
|
181
|
-
| `error` | `RscRenderFallbacks`, `RscRenderer` | `RscWorker` |
|
|
181
|
+
| `error` | `RscRenderFallbacks`, `RscRenderHandler`, `RscRenderer` | `RscWorker` |
|
|
182
182
|
|
|
183
183
|
### `HmrMessage`: dev server → browser tab
|
|
184
184
|
|
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,131 @@
|
|
|
4
4
|
|
|
5
5
|
### Minor Changes
|
|
6
6
|
|
|
7
|
+
- 4a568b2: What an agent turn carries beside the conversation reaches the model as marked data in a user turn, outside the system prompt.
|
|
8
|
+
|
|
9
|
+
- **A turn's `context` is no longer written into the system prompt.** `OpenaiDialect` and `AnthropicLlm` send it as a `<turn-context …>` block that ends the turn's last user-role content, after that turn's tool results: a text block on the Messages API, and on the chat-completions wire the end of the user message the turn closes on, or a user message of its own after tool messages. The block closes on a delimiter chosen so that its content cannot contain it, in any case or width or with characters that do not show between its letters. The delimiter is keyed with a secret of the process: the same text gets the same one in every request a process sends, and another process gives it another. The system prompt is the instructions alone, so it is the same text on every turn of a conversation and a provider's prefix cache keeps it.
|
|
10
|
+
- **A compaction summary is history in a user turn on both dialects.** It is sent as a `<conversation-summary …>` block. The chat-completions dialect used to send it with the system role, and the Messages API mapping with no fence. When the user's message follows the summary, the block opens that message, so neither dialect sends two user turns in a row.
|
|
11
|
+
- **`LlmContext`** (`akanjs/service`) is what an adaptor of the app's own calls: `LlmContext.of(request.context)` is the context text, empty when there is none, and `LlmContext.summary(text)` the summary block.
|
|
12
|
+
- **A context block can be marked `untrusted: true`** (`AgentWireContext`, and `ContextBlock` in the page) when it holds text someone other than the developer or the user may have written. Both dialects fence marked blocks apart from the app's own, in a `<page-content …>` block, the one a `readScreen` result arrives in. A turn that carries one counts as an untrusted read. In the page the first change after it asks the user first, as after `readScreen`. In `agentService.loop` the run is tainted from its first round: `approve` hears `tainted: true`, and with no `approve` a write is answered with the code `writeAfterPageText` and a sentence for the model, and the loop logs once per run that `approve` is what decides such a call. The run stores `tainted: true` on each assistant message it writes while tainted, so a resume and the next ask in that conversation keep the taint when the block is not passed again.
|
|
13
|
+
- **Text from a mentioned record is treated like text a tool read.** An `@` mention's reference reaches the model with its pointer, label, value and note together in one `<page-content …>` block under the "Referenced data" heading; before, only the value was fenced. The token in the user's message is sent as `@[pointer](mention:pointer)`, so the record's title is in that block only; the chat still draws the title. When the id or the path is not a token, as a slug is not, the token is sent as `@[ref-1a2b3c4d](mention:ref-1a2b3c4d)` and the block spells the pointer under that name. A message that carries a reference counts as an untrusted read: in `Agent.Chat` the first change after it shows the approval card a change after `readScreen` shows, and an `agentService.loop` run whose messages carry `references` is tainted from its first round. A loop's compaction digest names a pointed-at record by its pointer.
|
|
14
|
+
- **The page's default context keeps ids, enum members, numbers and booleans inline, and leaves free text to a read tool.**
|
|
15
|
+
- A string rides inline only when it is one token: up to 40 letters, digits, `.`, `_` or `-`, of at most three words. A word ends at a separator or at a lower-to-upper case change, so `created-at-desc` and `createdAtDesc` pass and `archive-every-note-now` does not. More parts pass only as an id's: each hex, with a digit or eight characters long, as in a UUID. A run of over sixteen letters with no digit never passes. It used to ride inline up to 200 characters.
|
|
16
|
+
- In the `state` block any other string is listed by key and type with no value.
|
|
17
|
+
- The `route` block applies the rule to each path segment and path param, and keeps at most twelve words of each. A search param rides inline when a store declares its key with `search("key", …)` and its value is a token. Of the others at most four ride, key and value both tokens, so `?tab=settings&page=2&sort=created-at-desc` reads the same on a page whose stores declare none; the rest are left out, key and value. A page's typed `search` is read on the server and does not count as a declaration. What is left out reads `…` in the path, the block names the keys to read in `withheld` and the number of search params left out in `searchParamsWithheld`. `readState` answers `pathname`, `params` and `searchParams` whether or not a component subscribes them, as page content.
|
|
18
|
+
- In the `screen` block a `Load` scope's label, which is its record's title, and the ids and labels of a list scope's `items` follow the rule; the block then says to read the scope with `readScreen`.
|
|
19
|
+
- Not covered: an `Agent.Zone`'s `label` and a value published with `st.expose`, `st.useState` or `useAgentResource` still ride whole, as no read tool returns them. Publish an id or an enum member there, not text a user wrote.
|
|
20
|
+
- The MCP App view names its screen to the host by origin and path under the same rule, without the query string or the hash.
|
|
21
|
+
- `AgentService.preamble` and each adaptor's fallback prompt say what a `<turn-context …>` block is, and that a `<page-content …>` block may also end a user turn.
|
|
22
|
+
- The agent and MCP guidelines and the `akan-agent` skill describe all of the above.
|
|
23
|
+
|
|
24
|
+
**Upgrading.**
|
|
25
|
+
|
|
26
|
+
An `LlmAdaptor` of your own that builds its whole request with `OpenaiDialect.requestBody` or `AnthropicLlm.requestBody` needs no change. One that builds its own messages must change, also when it takes its system prompt from `OpenaiDialect.systemPrompt(request)` or `AnthropicLlm.systemPrompt(request)`: those now return the instructions without the context, so such an adaptor would send no context at all. Append the context to the last user-role content, and map a `summary` message to a user turn:
|
|
27
|
+
|
|
28
|
+
```ts
|
|
29
|
+
// before
|
|
30
|
+
const system = OpenaiDialect.systemPrompt(request); // held the context
|
|
31
|
+
const turns = request.messages.map((message) =>
|
|
32
|
+
message.summary
|
|
33
|
+
? { role: "system", content: message.text }
|
|
34
|
+
: toTurn(message)
|
|
35
|
+
);
|
|
36
|
+
// after
|
|
37
|
+
const system = OpenaiDialect.systemPrompt(request); // the instructions alone
|
|
38
|
+
const turns = request.messages.map((message) =>
|
|
39
|
+
message.summary
|
|
40
|
+
? { role: "user", content: LlmContext.summary(message.text ?? "") }
|
|
41
|
+
: toTurn(message)
|
|
42
|
+
);
|
|
43
|
+
const context = LlmContext.of(request.context); // "" when the turn carries none
|
|
44
|
+
if (context) turns.push({ role: "user", content: context }); // or append it to the last user turn
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
Marked blocks come fenced by the same call. A test that looked for a context value in `body.system`, or in the first chat-completions message, finds it in the last user-role content, and one that looked for a summary in a system message finds it in a user message.
|
|
48
|
+
|
|
49
|
+
A loop request or a page context that already used a field named `untrusted` on a block for something else must rename it: any value but `false` or `undefined` now marks the block.
|
|
50
|
+
|
|
51
|
+
A store for `agentService.loop` messages must keep `tainted` on assistant messages too. Store each message `onMessage` hands over whole, as before; a store that picks fields adds this one. A loop that passes user messages with `references` and has no `approve` no longer writes: each write is answered with the code `writeAfterPageText`. Pass `approve`, or send the message without `references`. This lasts for the rest of the conversation, not for one run, because the stored messages keep the reference; a marked context block lasts as long through the mark on what the model said. Passing `untrusted` does not lift it.
|
|
52
|
+
|
|
53
|
+
A loop that passes messages with `references` and has an `approve` hears `tainted: true` on every call from that message on, in that run and in every later ask of the conversation. An approver that allows untainted calls by itself and holds tainted ones for a person will hold them all.
|
|
54
|
+
|
|
55
|
+
In a loop the model reads a mention in the user's words as `@[ticket/t1](mention:ticket/t1)`, or as `@[ref-1a2b3c4d](mention:ref-1a2b3c4d)` when the id or path is not a token, and finds the title only in that message's "Referenced data" block. A compaction summary names a mentioned record by its pointer and no longer by its title, so after a compaction the model reads the record again to name it. A prompt or a test that expected the title in the user's text looks in the block.
|
|
56
|
+
|
|
57
|
+
An app that relied on the model seeing a search param, a path param, a short store string or a list row's title in its context now has the model read it with `readState` or `readScreen`. The model is told which to call, so most apps change nothing. To keep a search param in the context whatever else the link carries, declare it in a store (`search("status", String, { default: "" })`); an undeclared one rides only as one of the first four whose key and value are tokens.
|
|
58
|
+
|
|
59
|
+
An id that is not a token is left out like other free text: a slug of more than three words (`my-first-blog-post`) or a mixed-case random id such as a nanoid (`V1StGXR8_Z5jdHi6B-myT`). A list scope's `items` then lists the other rows only, a list whose ids are all such lists none, and the block's `note` says to call `readScreen` with the scope's path, where every row is. A live store key holding such an id is listed with no value. A 24-character hex id, a UUID, a ULID and a number ride as before.
|
|
60
|
+
|
|
61
|
+
The URL an MCP App view reports to its host as model context no longer has the query string or the hash, and a path segment of free text reads `…`. A host prompt or a test that read a search param from that URL gets it from a tool the view publishes.
|
|
62
|
+
|
|
63
|
+
Two cases need an edit. Instructions that point at the context point at the tool instead:
|
|
64
|
+
|
|
65
|
+
```tsx
|
|
66
|
+
// before
|
|
67
|
+
<Agent.Chat instructions="The search box's text is searchParams.q in the route context." />
|
|
68
|
+
// after
|
|
69
|
+
<Agent.Chat instructions="The search box's text is the q search param: call readState with key searchParams." />
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
And a chat or zone that withholds a read tool gives it back when its agent needs such a value:
|
|
73
|
+
|
|
74
|
+
```tsx
|
|
75
|
+
// before
|
|
76
|
+
<Agent.Zone builtins={["highlight"]}>
|
|
77
|
+
// after
|
|
78
|
+
<Agent.Zone builtins={["highlight", "readState", "readScreen"]}>
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
What `readState` and `readScreen` return is page content, so the first change after one asks the user first.
|
|
82
|
+
|
|
83
|
+
A chat where the user mentions a record now asks before the first change that follows. `AgentConfirm.set({ afterScreenRead: false })` turns that off together with the ask after `readScreen`.
|
|
84
|
+
|
|
85
|
+
- 19c6fa7: `akan code` on the `local` profile can be told to stop asking about a command for the rest of the session, and one option turns asking off for a run.
|
|
86
|
+
|
|
87
|
+
- **A third answer.** The prompt before a shell command is now `approve? run: <command> [y/n/a]`. `a` runs the command and stops asking about it until the session ends. What is remembered is the program, and the sub-command too for `git`, `bun`, `bunx`, `npm`, `npx`, `pnpm`, `yarn`, `akan`, `docker`, `kubectl`, `helm`, `cargo` and `go`: allowing `git status` leaves `git diff` asked about, and allowing `bun test` leaves `bun x` asked about. `gh` is remembered two words deep, so allowing `gh pr view` leaves `gh pr merge` asked about. A line of several commands (`&&`, `;`, `|`, `$(…)`, a subshell) runs unasked only once every command in it is allowed. `/allowed` lists what the session has allowed and `/allowed clear` forgets it. Nothing is written to disk, so a resumed, forked or reloaded session asks again.
|
|
88
|
+
- **Still asked every time**, with a prompt that offers only `[y/n]`: a networking command (`curl`, `wget`, `nc`, `ssh`, `scp`, `rsync`, …) and a redirection to or from `/dev/tcp/…` or `/dev/udp/…`; a command that sends something out of the machine (`git push`, `npm publish`, `pnpm publish`, `yarn publish`, `yarn npm`, `bun publish`, `cargo publish`, `gh api`, and a `docker` line with `push` or `--push` in it); `rm`; a command that runs another or sets what a later one runs (`sudo`, `env`, `timeout`, `xargs`, `sh`, `bash`, `eval`, `builtin`, `source`, `.`, `trap`, `alias`, `export`, `declare`, `find -exec`, …); a variable set in front of a command other than `CI`, `NODE_ENV`, `FORCE_COLOR`, `NO_COLOR`, `TZ`, `LANG`, `LC_ALL`, `TERM`, `DEBUG` or `PORT` given one plain word; a line that writes a file with `>` or `>>`; and a line that cannot be split into its commands with confidence (a loop or `if`, backticks, a here-document, a program named by a variable).
|
|
89
|
+
- **`--no-ask`.** `akan code --no-ask` runs the session without asking before a shell command or a network request: the same as `--no-ask-commands --no-ask-network`. It prints one line at start saying so. It changes nothing else: secret files stay refused, this repo's MCP servers and extensions still wait for their own approval (`--trust-workspace`), the agent's own questions are still asked, and the `pod`, `review` and `web` profiles behave as before.
|
|
90
|
+
|
|
91
|
+
A program that drives `akan code --rpc` sees `remember: string[]` on an `approval` request when the session answer is offered, sends `{ "type": "approve", "approvalId": …, "approved": true, "remember": "session" }` to give it, and reads the names on `approval_resolved.remembered`. A host that sends only `approved` keeps working as before.
|
|
92
|
+
|
|
93
|
+
**Upgrading.** No step is needed: the three wire fields in `akanjs/common` (`CodeAgentApprovalRequest.remember`, the `approve` command's `remember`, `approval_resolved.remembered`) and `CodeTranscriptPart`'s `remembered` are optional additions.
|
|
94
|
+
|
|
95
|
+
- 217b061: `akan code` on the default `local` profile now asks before it runs a shell command, as it already did before reaching an unlisted host. File reads, writes and edits are not asked about.
|
|
96
|
+
|
|
97
|
+
**Upgrading.** An interactive `akan code` session shows `approve? run: <command> [y/n/a]` before each shell command; `a` answers yes and stops asking about that command until the session ends. Pass `--no-ask-commands` to run them unasked as before, or `--no-ask` to stop the network questions as well. A one-shot `akan code "<prompt>"` and a sub-agent have nobody to ask, so their commands run as before. A program that drives `akan code --rpc` on the `local` profile receives an `approval` event for each command and answers it with `approve`, as it does for the `web` profile's writes; `codeAgentPresets.local(root).approval` is now `"commands"`.
|
|
98
|
+
|
|
99
|
+
- 0baacae: Every dev route (`/_akan/devtools`, `/_akan/constant`, `/_akan/signal`, `/_akan/dictionary`, `/_akan/deps`, `/_akan/studio`, `/_akan/hmr`, `/_akan/ssr-dev`, `/_akan/csr-dev` and `/__rsc/manifest`) is listed once, in `akanjs/server/routing/devSurfaces`, and takes its gate, its Host check and its `akan dev --share` rule from that entry. A dev route answers only localhost, an IP address or a host the app names, on a deployed server too. A share reads the same list, so it now also refuses `/__rsc/manifest`; it still serves `/_akan/ssr-dev` and `/_akan/csr-dev`, which a shared dev page loads its modules from.
|
|
100
|
+
|
|
101
|
+
The framework keeps `/_akan/`, `/__rsc` and `/__csr` for its own routes: a server now refuses at start an endpoint, a framework route or a web route under them that is neither mounted as a dev route nor on the list of production routes next to the registry, and the error names the path. A dev server starts its on-demand CSR build only for a Host a dev route answers. A share refuses `/__csr` and drops `csr=true` from a page's query, so a shared page renders on the server instead of starting that build.
|
|
102
|
+
|
|
103
|
+
Outside a local runtime, `AKAN_DEVTOOLS=true` opens devtools only to a caller that presents the `AKAN_LOG_DEBUG_HEADER` secret, which must have at least 32 characters: a script sends it as `x-akan-debug`, and a browser posts it once to the form devtools shows, which unlocks that browser for 15 minutes, for that app and environment only, with an HttpOnly, Secure, SameSite=Strict cookie on the devtools paths; ten wrong secrets in a minute from one address get 429 until the minute is over. With no secret set, or a shorter one, devtools stays closed and the server log says which. Request logging through `x-akan-debug` takes the secret as before, whatever its length.
|
|
104
|
+
|
|
105
|
+
**Upgrading.** Open devtools, Studio and `/__rsc/manifest` through `localhost`, an IP address, `<app>-<env>.<serveDomain>`, a domain in the app's routes or a name in `AKAN_ALLOWED_HOSTS`; any other Host now gets 403, even on a server that answers every Host for the rest of the app. A deployed server with `AKAN_DEVTOOLS=true` also needs `AKAN_LOG_DEBUG_HEADER` set to a random secret of at least 32 characters (new: a shorter one keeps devtools closed there, and still works for request logging): send it as `x-akan-debug` from scripts, or unlock a browser at the form on any devtools page over HTTPS or `localhost` (for example through a port-forward). A local `akan start` or dev server needs nothing. An endpoint registered under `/_akan/`, `/__rsc` or `/__csr` (with `globalPrefix: false`) now stops the server at start: move it to another path.
|
|
106
|
+
|
|
107
|
+
- e704d16: A server that cannot write its SQLite directory, its solid SQLite directory or a local file storage root now stops at boot with `directoryNotWritable`, instead of booting and then failing with `attempt to write a readonly database` or an `EACCES` on the first upload. The message names the directory, the uid that owns it, the uid the server runs as, and the one-time fix: `chown -R <uid>:<gid> <dir>` as root on the volume that holds it, or the `volumePermissions` init container of the `infra/app` Helm chart. This is what a volume an image running as root wrote looks like to the generated image, which runs as uid 1000.
|
|
108
|
+
|
|
109
|
+
**Upgrading.** `BlobStorage` now has an `onInit` that makes this check. A subclass of your own that defines `onInit` calls `super.onInit()` first. A deployment whose data directory another user owns stops at boot with the message above: run the `chown` it names once, or let the chart's `volumePermissions` init container do it.
|
|
110
|
+
|
|
111
|
+
- aff1ba2: An external view opens only origins the app's config lists, in `native.desktop.externalView.allowOrigins`: a view's own `allowOrigins` narrow within them, and an origin outside them is `NOT_ALLOWED`, naming that key. `evaluate` and `initScript` need their own permission, granted by `desktop.externalView.evaluate: true`, and `sendKey` its own, granted by `desktop.externalView.sendKey: true`; both are off by default. While a view is open, opening its id again keeps its origins or narrows them, and refuses one it was not opened for; once closed, the id opens again for any origins the config lists, with the same browser profile, which belongs to the id. Origins compare exactly as the URL parser reads them: scheme, host and port, the host in punycode without a trailing dot, the default port left out, and an origin with user info refused; there are no wildcards. A view loads a URL as the URL parser writes it, so the engine never reads the page's text another way. A page opens a view only over its own window. The desktop shell checks all of this itself on macOS, Windows and Linux, and grants nothing when the build carries no permission list; on Windows a view now takes only the two DevTools calls `sendKey` and `capture` make. A top-level navigation or redirect off a view's origins stays refused, as before.
|
|
112
|
+
|
|
113
|
+
A plugin manifest's `scope` can say `required: true`: then every grant of the plugin, not only `<plugin>:default`, is within its `defaultScope` unless the grant gives its own `allow`, and a scope entry naming no field is a build error. `external-view` says so.
|
|
114
|
+
|
|
115
|
+
**Upgrading.** An app that lists `external-view` opens no view until its `akan.config.ts` names the origins, and needs `evaluate` and `sendKey` only for the calls it makes:
|
|
116
|
+
|
|
117
|
+
```ts
|
|
118
|
+
native: {
|
|
119
|
+
plugins: ["external-view"],
|
|
120
|
+
desktop: {
|
|
121
|
+
externalView: {
|
|
122
|
+
allowOrigins: ["https://board.example"], // every origin a view's allowOrigins names
|
|
123
|
+
evaluate: true, // when it calls evaluate or opens with initScript
|
|
124
|
+
sendKey: true, // when it calls sendKey
|
|
125
|
+
},
|
|
126
|
+
},
|
|
127
|
+
},
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
An app built with the akan-native CLI's own config grants the same in its capabilities: `{ identifier: "external-view:default", allow: [{ origin: "https://board.example" }] }`, `"external-view:allow-evaluate"` and `"external-view:allow-sendKey"`. A grant of `external-view:all` or `external-view:allow-open` opens no origin unless its own `allow` lists them. A page that passed `window` to `open` passes its own window or leaves it out.
|
|
131
|
+
|
|
7
132
|
- 90d740f: `native.ios.hideFormAccessoryBar: true` (or a target's `ios.hideFormAccessoryBar`) leaves out the bar WebKit shows above the keyboard while a page field is focused. The iOS shell already had the switch, but `akan.config.ts` refused the key and the native config never carried it, so every iOS app showed the bar.
|
|
8
133
|
|
|
9
134
|
The key defaults to false, so existing apps are unchanged. The api report lists one new optional `AkanNativeIosConfig` property; no upgrade step is needed.
|
|
@@ -16,15 +141,99 @@
|
|
|
16
141
|
|
|
17
142
|
The key defaults to off, so existing pages are unchanged. The api report lists the new `PageOverlayConfig` type and one new optional property on `PageConfig` and on `CsrState`; no upgrade step is needed.
|
|
18
143
|
|
|
144
|
+
- 9a7a9d5: Every endpoint and page counts its requests and times them, always, with tracing left off.
|
|
145
|
+
|
|
146
|
+
- `akan_endpoint_requests_total{endpoint, status_class}` and `akan_endpoint_request_duration_seconds{endpoint}` count and time each endpoint call over HTTP, websocket and MCP, labelled `<type>:<key>` as a trace names it. `akan_page_requests_total{route, status_class}` and `akan_page_request_duration_seconds{route}` do the same for page documents, a `?csr=true` shell included, and RSC payloads by route id, and a path no route matches counts as `unmatched`. Every series also carries the process `role`. No label carries a URL, a user, an account or a query.
|
|
147
|
+
- `akan_route_cache_lookups_total{cache, outcome, reason}` counts the route caches' lookups: `cache` is `rsc`, counted in the render worker, or `html`, counted in the web server, and `outcome` is a `hit` or `miss` whose `reason` says whether the key took the query as requested or rewritten, or a `bypass` whose `reason` says why the request skipped the cache. The Grafana dashboard shows each cache's hit ratio and its bypasses by reason.
|
|
148
|
+
- A latency histogram has 12 fixed buckets from 1 ms to 10 s. A label takes at most 2,000 values, and the rest count as `other`. A series appears once it is first observed, at about 2 KB of memory for each endpoint called.
|
|
149
|
+
- `/_akan/app/metrics` answers these series as `metricFamilies`. Behind a gateway, each replica reports its own with its start time, and the gateway adds them up: counters and buckets add, and percentiles are never averaged. A replica that restarts counts from zero again, and the gateway keeps its earlier counts in the sum, so the sum never drops. A series the RSC worker registers reaches its server's scrape the same way, and a recycled or restarted worker does not lower it.
|
|
150
|
+
- `/_akan/app/metrics` answers a Prometheus scrape as text, behind the same token. `Accept: application/openmetrics-text`, which Prometheus sends, gets OpenMetrics 1.0, and `text/plain` alone gets the Prometheus 0.0.4 text; `*/*`, `application/json` or no Accept keeps the JSON. Both carry `akan_build_info{akanjs_version, app}`, `process_start_time_seconds` and the RSC worker series: `akan_rsc_workers`, `akan_rsc_workers_ready`, `akan_rsc_renders_pending`, `akan_rsc_sends_queued`, `akan_rsc_worker_resident_memory_bytes`, `akan_rsc_worker_restarts_total` and `akan_rsc_worker_recycles_total`.
|
|
151
|
+
- A metrics sample no longer walks the JSC heap with `heapStats()`, which stopped the event loop for about 46 ms on a 150 MiB heap at every sample. The `jsc…` fields (`jscHeapSizeBytes`, `jscObjectCount` and the rest, and their `rscWorker…` copies) come only while memory is diagnosed, under `AKAN_MEMORY_LOG=1` or `AKAN_MEMORY_GC_ON_REPORT=1`.
|
|
152
|
+
|
|
153
|
+
**Upgrading.** Most readers change nothing. The metrics JSON gains a top-level `metricFamilies`, and each replica's `metrics` gains `startedAt` and `metricFamilies`; a reader that checks the body's exact keys must allow them. Behind a gateway the sums are as fresh as each replica's last report, sent every `AKAN_MEMORY_LOG_INTERVAL_MS` (60 s by default). Set it to your scrape interval for fresher numbers. A reader that sends `Accept: text/plain` alone now gets the text; send `application/json` to keep the JSON. The response carries `Vary: Accept`. A reader of the `jsc…` fields sets `AKAN_MEMORY_LOG=1`; `heapUsedBytes` stays in every sample.
|
|
154
|
+
|
|
155
|
+
- 8d75f2b: The public surface 3.2.0 deprecated is removed. `akanjs` and `@akanjs/devkit` publish only the subpaths their `exports` name, with no wildcard, so a file becomes public only when an entry names it.
|
|
156
|
+
|
|
157
|
+
- **`@akanjs/devkit` has no root aliases and no `./*` or `./*.ts`.** It publishes `@akanjs/devkit` (types only), `biome.base.json`, the facets `akanApp`, `akanConfig`, `artifact`, `cloud`, `codeAgent`, `commandDecorators`, `executors`, `frontendBuild`, `incrementalBuilder`, `mobile`, `pipeline`, `preview`, `transforms` and `workflow`, and the files `app/applicationBuildRunner`, `cloud/cloudApi`, `cloud/cloudUpdates`, `commandDecorators/exitCodeError`, `mobile/desktopRelease`, `mobile/serverBundleSecrets` and `transforms/serverEnvProfile`. `util/fileEditor`, `util/selectModel` and `workspace/getRelatedCnsts` are named too, and deprecated: nothing in akanjs uses them.
|
|
158
|
+
- **`akanjs` drops `akanjs/common/*`, `akanjs/server/*`, `akanjs/ui/*`, `akanjs/webkit/*` and `akanjs/client/native/*`.** Every `akanjs/client/native/<plugin>` path still resolves, now as its own entry, and so does `akanjs/webkit/usePurchase`. The layouts `akan` generates import `akanjs/ui/System/index.tsx`, `akanjs/ui/System/SSR.tsx`, `akanjs/ui/UiOverride/UiOverride.tsx` and `akanjs/webkit/RouteLevelBoundary.tsx`, and the `akan` command's bundled `@akanjs/language` imports `akanjs/common/akanNames.ts`, `akanjs/common/facetBarrel.ts` and `akanjs/common/routeConvention.ts`: these stay as named entries. `@akanjs/language`'s declarations now import their types from `akanjs/common`. Barrel imports in an installed workspace's build now resolve to files on disk instead of package subpaths.
|
|
159
|
+
- **The error-constructor plumbing is gone**: `setErrorConstructor` on `FetchClient`, `HttpClient` and `WsClient`, `HttpClientOptions.ErrorCls`, and `FetchClient.build`'s `Err` option. Every restored error is `akanjs/common`'s `Err`, as it already was. `registerClientRuntime` no longer re-points the shared client at the runtime's `Err`.
|
|
160
|
+
- **Thirteen deprecated exports are deleted, and eleven internals are no longer exported.**
|
|
161
|
+
|
|
162
|
+
**Upgrading.**
|
|
163
|
+
|
|
164
|
+
- `@akanjs/devkit/<name>` and `@akanjs/devkit/<name>.ts`, for 81 root names, and `@akanjs/devkit/executors.ts` (`@akanjs/devkit/executors` stays, as a facet):
|
|
165
|
+
- `applicationBuildRunner` → `@akanjs/devkit/app/applicationBuildRunner`, `fileEditor` → `@akanjs/devkit/util/fileEditor`, `selectModel` → `@akanjs/devkit/util/selectModel` and `getRelatedCnsts` → `@akanjs/devkit/workspace/getRelatedCnsts` (the last three are deprecated).
|
|
166
|
+
- Import the types of `akanContext`, `akanMcpContract`, `applicationBuildReporter`, `applicationTestPreload`, `createTunnel`, `dependencyScanner`, `fileSys`, `maintainabilityContract`, `packageExportsMap`, `prompter`, `qualityScanner`, `recipeScanner`, `scanInfo`, `spinner`, `stripAnsi`, `typeChecker` and `types` from `@akanjs/devkit`. Their values have no public entry.
|
|
167
|
+
- `abstractDoc`, `agentAssets`, `agentsIndex`, `akanMcpToolError`, `apiReference`, `appSelectionMemory`, `bareErrorScanner`, `biomeBase`, `codegenLock`, `commentDensityScanner`, `componentSizeScanner`, `componentWriteChainScanner`, `conventionSet`, `declarationReader`, `deprecatedCommentScanner`, `endpointReach`, `envSeed`, `errorCodeReference`, `errorCodeScan`, `formSetterScanner`, `frameworkGraph`, `gitRevision`, `jsonFormatter`, `kindBranchScanner`, `libSource`, `linter`, `maintainabilityBaseline`, `maintainabilityExceptionScanner`, `maintainabilityLimits`, `maintainabilityReport`, `manifestDependencies`, `moduleFieldNames`, `renderMutationScanner`, `repoIdentity`, `routeJsBudget`, `routeSourceValidator`, `semver`, `serviceLoopCallScanner`, `shellOnlyEnv`, `signalMutationIndex`, `slicePlanner`, `sourceComments`, `sshHostKeys`, `sshTunnel`, `ssrScanner`, `storeAccessScanner`, `storeSource`, `storeWriteScanner`, `structureScanner`, `subspace`, `subspaceClone`, `subspaceConfig`, `subspaceReport`, `testHelpers`, `testOnlyExportScanner`, `workspaceGraph`, `workspaceLayout`, `writePath`, `writePlacementScanner` and `writingActionIndex` have no replacement: they are the `akan` command's internals, which its build inlines.
|
|
168
|
+
- Any other `@akanjs/devkit/<dir>/<file>` that only `./*` reached: import its types from `@akanjs/devkit` where that barrel exports them; it is otherwise internal, with no replacement.
|
|
169
|
+
- `akanjs/<common|server|ui|webkit>/<file>`: import from the barrel, `akanjs/common`, `akanjs/server`, `akanjs/ui` or `akanjs/webkit` (`akanjs/server/machine/machineToken` → `akanjs/server`; `akanjs/ui/Constant/schemaDoc` → `akanjs/ui`), or from a named entry such as `akanjs/server/tunnel` for `akanjs/server/tunnel/index.ts`. A file no barrel re-exports is internal, `SignalResolver` and `akanjs/ui/Agent/RichInput` included, with no replacement: check which routes an endpoint serves with a signal test (`akan test <app>`) rather than through `SignalResolver.resolveEndpoint`. These 28 were public only through a wildcard and are internal now: `isIndexable`; `DEFAULT_HTML_CONTENT_SECURITY_POLICY`, `htmlContentSecurityPolicy`, `DEFAULT_STRICT_TRANSPORT_SECURITY`, `CONTENT_ENCODINGS`, `topologicalStages`, `traceCycle`, `getSystemPageErrorDetails`, `SYSTEM_PAGE_STYLE`, `getSameOriginHref`, `carriesCredentials`, `DEFAULT_ROUTE_CACHE_TTL_SECONDS`, `isAkanRouterStateV1`, `countCommonRouteSegments`, `AKAN_RSC_STATE_VERSION`, `decodeAkanRedirectDigest` and `validateRscSegmentPatch` (server); `getKeyboardAccessorySlots`, `blurActiveElement`, `KEYBOARD_SHOW_ANIMATION_DURATION_MS`, `KEYBOARD_HIDE_ANIMATION_DURATION_MS`, `KEYBOARD_SHOW_ANIMATION_EASING`, `KEYBOARD_HIDE_ANIMATION_EASING` and `clonePageState` (webkit); `DefaultPagination`, `DefaultTable`, `DefaultUnauthorized` and `isPublicEndpoint` (ui).
|
|
170
|
+
- `fetch.setErrorConstructor(Err)` in an older `lib/sig.ts`, and `{ Err: pageProto.Err }` passed to `FetchClient.build` in an older `lib/useClient.ts`: run `akan sync`, which rewrites both. Elsewhere, drop the `setErrorConstructor` call, the `ErrorCls` option and the `Err` option. A `FetchClient` constructed with its own error class still restores its WebSocket, bridge, refusal and abort errors into it, but an HTTP response error is always `Err`.
|
|
171
|
+
- `MAX_INT` → `2 ** 31 - 1`. `isFilterModel(ref)` → `getFilterMeta(ref, { allowEmpty: true }) !== undefined`. `setFilterInfoByKey` → declare the query with `from(model, (filter) => …)`. `getDefaultSchemaOptions()` → `new DocumentSchema()`. `runWithTrace` → `runTraced`, only where the caller owns the trace, since it finalizes it. `traceDbQuery(ms)` → `getCurrentTrace()?.countDbQuery(ms)`. `isSitemapPath(pathname, basePaths)` → `getSitemapBasePath(pathname, basePaths, headerBasePath) !== undefined`. `useRscNavigation` → `navigateRsc`, `clearRscNavigationCache` and `isRscNavigationFromCache`. `getSearchParam` and `getBaseSearchParam` → read `searchParams[key]`, taking the first value of an array. `dictionaryContext`, `groupByOwner` and `ServiceRegistry` have no replacement.
|
|
172
|
+
- No longer exported, with no replacement: `setFilterMeta` and `getFilterArgInfo` (`akanjs/document`), `isDebugHeaderAllowed` (`akanjs/signal`), `parseAkanConsoleQuery`, `createAkanConsoleLogCommands` and `createAkanConsoleContext` (`akanjs/server`), `isResponsiveInset`, `getClientRuntime`, `colorTokens` and `radiusTokens` (`akanjs/client`), and `isStateBuilderMarker` (`akanjs/store`).
|
|
173
|
+
|
|
174
|
+
- d5e60f2: A render worker can run a set number of renders at a time, keep the rest in a first-come, first-served queue, and answer 503 once that queue is full. It does so only when `AKAN_RSC_WORKER_MAX_CONCURRENCY` is set.
|
|
175
|
+
|
|
176
|
+
- `AKAN_RSC_WORKER_MAX_CONCURRENCY=<n>` lets one render worker run `n` renders at once: page documents, `/__rsc` navigations and prefetches, and the error or not-found page rendered in a failed render's place. The rest wait in the order they arrived. A page the worker has stored is replayed without a slot, also when another request stored it while this one waited; a request its client aborted leaves the queue without rendering, and a slot comes back when its render ends, throws or is cancelled. A render that has held its slot as long as the idle timeout gives it back and runs on. The cap is per worker, so per replica behind a gateway, and it bounds the renders admitted, not the ones still running after their slot came back: a page whose client left keeps running until its own `await` settles. MCP page prompts and static app cards are not queued. A value that is not a whole number or `off` is warned about once and ignored.
|
|
177
|
+
- `AKAN_RSC_WORKER_MAX_QUEUE` bounds the queue: by default the cap times the idle timeout's seconds (`AKAN_IDLE_TIMEOUT`, 120), and `0` or `off` for no bound. A render past it, or one that has waited as long as the idle timeout (the default 120 seconds where that timeout is off, as under `akan start`), is answered `503` with `Retry-After: 1` and `Cache-Control: no-store` before any of it renders: for a browser a page that reloads itself once, after a second plus jitter and twice as long after each refusal in a row up to 30 seconds; `base.error.serverUnavailable` JSON for a JSON caller; and text otherwise and for `/__rsc`. The error codes are `renderQueueFull` and `renderQueueTimeout`.
|
|
178
|
+
- `/_akan/app/metrics` gains `akan_rsc_renders_in_flight`, `akan_rsc_render_queue_depth`, `akan_rsc_renders_abandoned` (renders still running after their slot came back), `akan_rsc_render_queue_wait_seconds` and `akan_rsc_render_refusals_total{reason}` (`queue-full`, `wait-timeout`, and `hold-timeout` for a slot taken back). A refused page also counts as a `5xx` of its route in `akan_page_requests_total`. A page that waited carries `queueMs` on its request line and, under `AKAN_TRACE=1`, a `renderQueue` span.
|
|
179
|
+
- The cap is off by default, because a page that awaits data holds its slot while it waits. Measured on the production build of `apps/akan` with 32 requests at once (`pkgs/@akanjs/devkit/integration/renderAdmissionSoak.ts`, the median of three runs): pages that wait 20–200 ms on data served 151 requests a second with no cap, 150 with a cap of 32, 95 with 16, 59 with 8 and 32 with 4. Pages that only use the CPU served 102 to 108 a second at every cap, and their median latency moved by less than a tenth (250 ms at a cap of 4, 264 ms with none): the worker starts and finishes renders in order, but while it stays busy its payloads reach the web server together, once it pauses, so a cap bounds a burst and does not answer the first pages sooner. What a cap of 4 changed for them was the worker's heap growth during a run: 54 to 64 MB, against 82 to 284 MB with none. `pkgs/akanjs/server/SSR_MEMORY_DIAGNOSIS.md` has the table.
|
|
180
|
+
|
|
181
|
+
**Upgrading.** Nothing changes until `AKAN_RSC_WORKER_MAX_CONCURRENCY` is set; three new gauges appear in the metrics scrape. When you set it, start from the number of requests one replica is sized to hold at once, so the cap only bounds a burst past that, and go lower only for pages that render without waiting on data. A capped server answers `503` with `Retry-After` under overload, so let the load balancer pass that status through uncached, and treat it as retryable in an uptime check.
|
|
182
|
+
|
|
183
|
+
- 4225827: Every request has one id: `x-request-id` on its response, `traceId` in the body of a failed call and on every log record written while it is answered.
|
|
184
|
+
|
|
185
|
+
- The server mints the id. A request that arrives with a W3C `traceparent`, or else an `x-request-id` that is a UUID or 32 hex digits, keeps that id as `link` on every record it writes and on its request line; an id of any other shape is not kept at all. `akan logs --trace <id>` matches `link` as well as `traceId` and reads the id the way an inbound one is read, so a caller finds its request by the id it sent.
|
|
186
|
+
- The gateway settles the id once and hands it to the replica over its unix socket, so both write the same `traceId`. It no longer forwards a caller's `x-request-id` as it came.
|
|
187
|
+
- `AKAN_TRACE_ADOPT=trusted-proxies` lets a proxy choose the id: a peer `AKAN_TRUSTED_PROXIES` names by address, by CIDR or with `private`. Loopback and the private ranges count only when the list spells them, and `*` does not. Turn it on only when that proxy overwrites or strips `traceparent` and `x-request-id` on every request.
|
|
188
|
+
- `SignalFailure.answer(error, extra)` builds the response `SignalContext.try` answers with, for a transport that catches a failure itself. The OpenAPI error schema lists `traceId`.
|
|
189
|
+
|
|
190
|
+
**Upgrading.** A trace id is now 32 lower-case hex digits (`0af7651916cd43dd8448eb211c80319c`) in place of `mdx3k2a1-4f9z0q`; a log query, a dashboard or a test that matched the old shape needs the new one. With no setting, the id on a response is always the server's own. A client that sent its own `x-request-id` and read it back from logs now finds it as `link`, stored in lower case without dashes (`0AF76519-16CD-43DD-8448-EB211C80319C` becomes `0af7651916cd43dd8448eb211c80319c`); `akan logs --trace` and `.trace` accept it as it was sent. A proxy in front that should choose the id needs `AKAN_TRACE_ADOPT=trusted-proxies` and its address in `AKAN_TRUSTED_PROXIES`. `AKAN_BENCH_SKIP_REQUEST_ID` is gone.
|
|
191
|
+
|
|
192
|
+
- 4225827: A request's id follows it through every process and call it starts, so one search finds all of it.
|
|
193
|
+
|
|
194
|
+
- A page view is one id in the gateway, the replica and the RSC worker: the render message carries the request's `traceparent`, and the worker's `page:` trace and log records take it.
|
|
195
|
+
- A `fetch` call a server makes, while rendering or inside an endpoint, sends `traceparent` to this app's own server and to the server a `clone({ origin })` or a `FetchPolicy.origin` names. No other header is added, and calls made through `RemoteFetch` send none.
|
|
196
|
+
- Every frame of a websocket runs under the id of its handshake, each as a span of its own, and a refused frame names that id as `traceId`.
|
|
197
|
+
- A queued job runs as a trace of its own and names the call that enqueued it as `link` on its request line. The id travels as `traceLink` in the job's options (`AkanJobOptions.traceLink`), which the framework sets.
|
|
198
|
+
|
|
199
|
+
**Upgrading.** Nothing to change. A server that receives another akan server's calls keeps their `traceparent` as `link` on its own id, unless it runs with `AKAN_TRACE_ADOPT=trusted-proxies` and lists the caller's address in `AKAN_TRUSTED_PROXIES`.
|
|
200
|
+
|
|
201
|
+
- fb5e77e: The route caches key a page on the locale it resolved to, not on the `Accept-Language` it was asked in, and on its query sorted and without tracking parameters.
|
|
202
|
+
|
|
203
|
+
- The RSC and HTML result caches keyed every page on the request's raw `Accept-Language` as well as on the locale the locale proxy resolved from its path, so each set of browser languages kept its own copy of a page that renders the same for all of them. Only the resolved locale is in the key now, and visitors who ask for one locale's page in different languages share its entry. A page that reads the header with `headers()` is still rendered for each request and never stored.
|
|
204
|
+
- The key took the query exactly as requested, so `?b=2&a=1` and `?a=1&b=2`, or a link carrying `utm_source` or `gclid`, each rendered and stored their own copy. The key now takes the query sorted by name, as the URL standard parses it (a repeated name keeps its values in order), without the tracking parameters in `AKAN_ROUTE_CACHE_TRACKING_PARAMS`: by default `utm_*`, `gclid`, `gclsrc`, `dclid`, `gbraid`, `wbraid`, `fbclid`, `msclkid`, `twclid`, `ttclid`, `li_fat_id`, `igshid`, `yclid`, `mc_cid`, `mc_eid`, `_ga` and `_gl`. Set it to comma-separated names (a trailing `*` matches a prefix, `default` adds the built-in list) or to `off`.
|
|
205
|
+
- A page shares an entry across queries only when every level of its route declares what it reads with `.search()`. A page or layout with `.config({ canonicalQuery: false })`, one that declares a tracking parameter, and a legacy default-function page keep one entry per query as requested. A page keyed on the sorted query is rendered with that URL, whether the cache stores it or not: its `.search()` values are the request's, while a guard's `request.path`, `usePathCtx().location` and the router state carry the sorted query until the first client navigation, and `usePageLocation()` carries it until the URL's query moves, so the browser hydrates the query the server rendered. `window.location` keeps every parameter.
|
|
206
|
+
- Each process now counts its route cache lookups: the RSC cache in the render worker and the HTML cache in the web server, as hits and misses by whether the route's key took the query as requested or sorted and without tracking parameters, and as bypasses by why the request skipped the cache (an environment opt-out, the dev default, a zero TTL, an excluded path, a request that is not public, a dev registry or no matching route). The RSC count covers full-page lookups, not partial-commit patches.
|
|
207
|
+
|
|
208
|
+
**Upgrading.** Nothing changes for a page that reads `Accept-Language` with `headers()`. One that reads it through `untrackedHeaders()` or `headers({ trackDynamic: false })`, which skip the tracking that keeps a render out of the caches, now gets another language's stored copy: read it with `headers()` instead. A `page()` or `layout()` whose server render reads the query outside `.search()`, or reads a tracking parameter it does not declare, through `untrackedRequest()` for instance, now gets another query's stored copy: declare the parameter with `.search()` or set `.config({ canonicalQuery: false })` on it.
|
|
209
|
+
|
|
210
|
+
The sorted URL is what such a page renders with in every mode, not only when it is stored: in dev, with `AKAN_RSC_RESULT_CACHE=0` or `AKAN_HTML_RESULT_CACHE=0`, and for a request with cookies that skips the cache. Where a page needs the query as it was asked:
|
|
211
|
+
|
|
212
|
+
- A guard's `request.path` no longer carries tracking parameters or the order they came in, so a redirect such as `/login?next=${request.path}` drops `utm_*` on the way: declare each parameter it must pass on with `.search()`, which keys the route on its query as requested, or set `.config({ canonicalQuery: false })` on the route.
|
|
213
|
+
- On the client, `usePathCtx().location` and the router state keep the sorted query without tracking parameters until the first navigation, and `usePageLocation()` until the URL's query moves: declare the parameter with `.search()` or set `canonicalQuery: false` on the route, or read `window.location` in an effect, after hydration.
|
|
214
|
+
|
|
215
|
+
- 4225827: A trace's spans say where they ran and when, database calls are spans of their own, and a developer can read a call's timing from the response.
|
|
216
|
+
|
|
217
|
+
- `SpanRecord` gains `id`, `parentId`, `startMs` and optional `attrs` beside `name` and `durationMs`. The call's own span is `total`, with the trace's `spanId` as its id and its caller's span as its parent; it is recorded even when the call ran past the 64-span limit.
|
|
218
|
+
- Under `AKAN_TRACE=1` every database call is a span named `db:<model>.<op>` with `attrs: { model, op }`, where `op` is the store operation (`find`, `count`, `updateMany`, ...). No statement and no value is recorded. The metrics document lists them per endpoint with the other spans.
|
|
219
|
+
- A signal's HTTP response carries `Server-Timing` in a local runtime, and anywhere else only for a request whose `x-akan-debug` matches `AKAN_LOG_DEBUG_HEADER`. Such a request also records its spans for that one call, without `AKAN_TRACE`, so the header reads `total;dur=12.4, guards;dur=0.3, handler;dur=11.2, db;desc="memo.find";dur=9.8`.
|
|
220
|
+
|
|
221
|
+
**Upgrading.** Code that builds a `SpanRecord` itself, or compares `trace.spans` with `toEqual`, needs the new fields; reading `name` and `durationMs` is unchanged. `trace.endpoints[].spans` in `/_akan/app/metrics` gains one `db:<model>.<op>` entry per model and operation an endpoint used while `AKAN_TRACE=1`.
|
|
222
|
+
|
|
19
223
|
### Patch Changes
|
|
20
224
|
|
|
21
225
|
- c44d068: A coding agent reads less to build its first app: the `akanjs` README keeps the path to a first app and links the rest on akanjs.com (17 KB to 7 KB), the `akan-page` and `akan-service` skills ship the API reference one section at a time with every entry named in the skill's index (`Link` now lists the anchor attributes it takes and `Link.Back`, `Link.Close` and `Link.Lang`), the `akan-page` skill holds what a first page looks up while `pageRule` keeps the deeper contract, and each rule is stated once across AGENTS.md, the path rules and the skills. Run `akan agent install` in a workspace to pick up the new files.
|
|
22
226
|
- af09c4f: `router.backOrFallback()` and `Link.Back` with a `fallback` close a browser tab the app itself opened instead of replacing to the fallback, when there is nothing to go back to. The tab counts as opened by the app when it holds one history entry and has an opener or a same-origin referrer, so a `window.open(href, "_blank", "noopener")` or `target="_blank"` link qualifies. A tab the person opened (a bookmark, a typed URL), one another site opened, and an iOS, Android or desktop shell keep going to the fallback, as does a tab the browser refuses to close.
|
|
23
227
|
- 24315d1: A page asks for its stylesheet before its client chunks. The preload tags for the chunks a page's first screen imports are written at the end of `<head>` instead of at its top, so the stylesheet link comes first; the bootstrap module, the dictionary and the import map stay at the top. On a throttled mobile connection (Lighthouse's slow 4G applied in the browser, over HTTP/2) a 56-chunk page first paints about 160 ms sooner (1.83 s to 1.67 s), and a page whose largest element is a small image shows it about 140 ms sooner; a large image still shares the connection with the chunks and arrives when it did. Every chunk still starts loading with the document, so the page hydrates when it did.
|
|
24
228
|
- bf582c1: A page stored in the HTML cache is kept as the bytes it streamed, instead of being decoded to text and encoded again before compression. Storing a 600 KB page takes about a fifth of the main-thread time it did, and the stored page and every response from it are unchanged.
|
|
229
|
+
- 8bbe7c8: Every response from `/_akan/image` carries `X-Content-Type-Options: nosniff`, `Referrer-Policy` and a sandboxing `Content-Security-Policy` (`script-src 'none'; frame-src 'none'; sandbox;`), and an image response carries `Content-Disposition: attachment` named after its source file. An SVG an app allows with `dangerouslyAllowSVG` still shows in an `<img>`, and runs no script when its URL is opened on its own.
|
|
230
|
+
|
|
231
|
+
**Upgrading.** Opening an optimized image's URL directly in a browser tab now downloads it instead of showing it; images in pages, CSS and `srcset` are unchanged. A cached passthrough image of type heic, ico, icns, bmp, jxl or tiff is now stored under its own extension instead of `.jpg`, so each one is fetched once more and its old cache file is left behind.
|
|
232
|
+
|
|
25
233
|
- e9598f3: Under an iOS shell that leaves the keyboard to the page, the page box now starts moving with the keys on their first frame. It followed a store update and React's render of the frame, which on a phone started the move about 100 ms after the keys, then jumped to catch up. `Device` now sets `--akan-keyboard-cover`, `--akan-keyboard-duration`, `--akan-keyboard-easing` and `data-akan-keyboard` on the root in the shell's keyboard event itself, and the page box's height and bottom padding follow `--akan-keyboard-cover` in CSS, so the transition starts before any render. `isPageKeyboardAvoidance` and `IOS_KEYBOARD_ANIMATION_EASING` now come from `akanjs/client` too.
|
|
26
234
|
- c10f7cf: A loader sends its store at most 500 distinct keys per query and splits a larger batch into several queries that run together. A `load<Model>Many` or a nested list with more ids than a database takes in one statement now loads instead of failing: Postgres refused more than 65,534 values, and SQLite refused a `byQuery` batch of about 1,000 keys.
|
|
27
235
|
- c10f7cf: A loader asks its store for each key once per batch: loads of the same key in one batch share one lookup, and each caller still gets its own document wherever the loader has `copy`, as every model and declared loader does. A `new DataLoader(...)` without `copy` now hands the callers of a repeated key one result object, where a batch function that built a fresh object per position gave each its own: pass `copy` to keep them apart. A batch function that throws, or resolves to something that is not an array, now rejects its callers instead of leaving them waiting.
|
|
236
|
+
- 10641a0: `agentService.loop` keeps fewer tools in a long run's requests. A compaction closes each toolkit from `toolkits` that the messages it keeps neither opened nor called a tool of, and the model opens it again with `openToolkit` when it needs it. Remotes stay open. `compact.at` now counts the round's tools, instructions and context along with the transcript, so a run with a large tool list compacts before the provider refuses the request, not after. An opened toolkit's tools are listed after every tool already listed, in the order the toolkits were opened, so opening one leaves the start of the tool list unchanged.
|
|
28
237
|
- 045699c: The `create-akan-workspace` README shows how to run it on a host with only Node and npm (`npx -y bun@1.4.4 x create-akan-workspace@latest`) and the `npm run build` / `npm start` scripts it then writes, and `akanjs`, `@akanjs/cli` and `create-akan-workspace` each carry a one-line `description`, so `npm view` says what the package is and how to start.
|
|
29
238
|
- 5c7e083: Every page of a list is read with one SQL text: the page offset is a bound parameter, so paging no longer adds a prepared statement per page to the SQLite statement cache or to each Postgres connection. On Postgres a list of two or more values (`q.oneOf`, `q.notOneOf`, a raw table's `$in` and `$nin`) is bound as one array, so its length adds no prepared statement either, and a list past the 65,534 parameters one statement may bind is now read. An insight is read in one statement instead of one per field, so its counts and sums come from one snapshot and, with six fields, in about a third of the time.
|
|
30
239
|
- aead1aa: A page render no longer sends the whole client manifest to the RSC worker with every request. The worker process receives a manifest once and each render names it by revision, which takes a burst of cached pages from about 38 ms to about 7 ms at the median on the docs app.
|
package/CONTRIBUTING.md
CHANGED
|
@@ -78,8 +78,8 @@ CI fails when the reports no longer match the source, and on a pull request it c
|
|
|
78
78
|
cannot tell it is compatible. Add the `minor` changeset anyway and say that no upgrade step is needed.
|
|
79
79
|
- Mark an export `/** @deprecated <what instead> */` and release that before removing it. The report shows the tag,
|
|
80
80
|
and adding or removing it is not a change.
|
|
81
|
-
-
|
|
82
|
-
|
|
81
|
+
- `exports` names every public subpath and holds no wildcard: a file reachable only through `akanjs/server/*` was
|
|
82
|
+
public without anyone choosing it. Add a named entry for a file a consumer must import.
|
|
83
83
|
|
|
84
84
|
## Coding Style
|
|
85
85
|
|
package/client/clientRuntime.ts
CHANGED
|
@@ -80,13 +80,6 @@ globalWithRuntime[CLIENT_RUNTIME_KEY] = state;
|
|
|
80
80
|
const missingRuntimeError = () =>
|
|
81
81
|
new Error("Akan client runtime is not registered. Import the generated app client first.");
|
|
82
82
|
|
|
83
|
-
const applyRuntimeErrorConstructor = (runtime: ClientRuntime) => {
|
|
84
|
-
const instance = (runtime.fetch as RuntimeFetch | undefined)?.instance as
|
|
85
|
-
| { setErrorConstructor?: (Err: unknown) => void }
|
|
86
|
-
| undefined;
|
|
87
|
-
if (typeof instance?.setErrorConstructor === "function") instance.setErrorConstructor(runtime.Err);
|
|
88
|
-
};
|
|
89
|
-
|
|
90
83
|
export const registerClientRuntime = <Runtime>(
|
|
91
84
|
runtime: Runtime,
|
|
92
85
|
{ scope = "app" }: { scope?: RuntimeScope } = {},
|
|
@@ -94,12 +87,10 @@ export const registerClientRuntime = <Runtime>(
|
|
|
94
87
|
if (state.scope === "app" && scope === "lib") return runtime;
|
|
95
88
|
state.runtime = runtime as ClientRuntime;
|
|
96
89
|
state.scope = scope;
|
|
97
|
-
applyRuntimeErrorConstructor(state.runtime);
|
|
98
90
|
return runtime;
|
|
99
91
|
};
|
|
100
92
|
|
|
101
|
-
|
|
102
|
-
export const getClientRuntime = () => {
|
|
93
|
+
const getClientRuntime = () => {
|
|
103
94
|
if (!state.runtime) throw missingRuntimeError();
|
|
104
95
|
return state.runtime;
|
|
105
96
|
};
|
package/client/cn.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type ClassNameValue, extendTailwindMerge } from "tailwind-merge";
|
|
2
2
|
|
|
3
|
-
/**
|
|
4
|
-
|
|
3
|
+
/** Registered with tailwind-merge so `cn("bg-primary", "bg-open")` resolves to `"bg-open"` instead of keeping both. */
|
|
4
|
+
const colorTokens = [
|
|
5
5
|
"background",
|
|
6
6
|
"foreground",
|
|
7
7
|
"primary",
|
|
@@ -33,8 +33,8 @@ export const colorTokens = [
|
|
|
33
33
|
"ring",
|
|
34
34
|
];
|
|
35
35
|
|
|
36
|
-
/**
|
|
37
|
-
|
|
36
|
+
/** `--radius-box` / `--radius-field`; unregistered, `cn("rounded-field", "rounded-full")` would keep both. */
|
|
37
|
+
const radiusTokens = ["box", "field"];
|
|
38
38
|
|
|
39
39
|
const twMerge = extendTailwindMerge({
|
|
40
40
|
extend: {
|
package/client/csrTypes.ts
CHANGED
|
@@ -55,6 +55,10 @@ export interface PageConfig {
|
|
|
55
55
|
/** `false` answers a `Link` prefetch of the page (on a layout, of every page under it) without rendering it, for a
|
|
56
56
|
* render with a side effect such as counting a view; the click renders it as usual. */
|
|
57
57
|
prefetch?: boolean;
|
|
58
|
+
/** `false` keys the page in the RSC and HTML result caches on its query exactly as requested (on a layout, every
|
|
59
|
+
* page under it), for a page whose output follows parameter order or a tracking parameter it reads without declaring
|
|
60
|
+
* it with `.search()`. By default the key sorts the query and leaves out `AKAN_ROUTE_CACHE_TRACKING_PARAMS`. */
|
|
61
|
+
canonicalQuery?: boolean;
|
|
58
62
|
topSafeAreaColor?: string;
|
|
59
63
|
bottomSafeAreaColor?: string;
|
|
60
64
|
/** Keeps the route (on a `_layout`, its whole directory) out of `akan build` while `akan start` serves it. Write a
|
|
@@ -162,6 +166,8 @@ export interface RouteRender {
|
|
|
162
166
|
getLayoutManifest?: () => PromiseOrObject<WebAppManifest | undefined>;
|
|
163
167
|
/** The `page()` chain behind a page render, when it was declared as one — what a page prompt is read off. */
|
|
164
168
|
getRouteDefinition?: () => PromiseOrObject<RouteDefinition | undefined>;
|
|
169
|
+
/** The query names the level reads; `undefined` for a legacy module, which receives every one. */
|
|
170
|
+
getSearchNames?: () => PromiseOrObject<string[] | undefined>;
|
|
165
171
|
}
|
|
166
172
|
export interface RouteViewport {
|
|
167
173
|
/** `viewport-fit=cover`: the page runs under the notch and home indicator, and `env(safe-area-inset-*)` measures them. */
|
package/client/frameConfig.ts
CHANGED
|
@@ -51,6 +51,7 @@ const pageConfigKeys = new Set<keyof PageConfig>([
|
|
|
51
51
|
"ssr",
|
|
52
52
|
"rscPatchHeadSafe",
|
|
53
53
|
"prefetch",
|
|
54
|
+
"canonicalQuery",
|
|
54
55
|
"topSafeAreaColor",
|
|
55
56
|
"bottomSafeAreaColor",
|
|
56
57
|
]);
|
|
@@ -70,7 +71,7 @@ export const validatePageConfig = (routeKey: string, config?: PageConfig) => {
|
|
|
70
71
|
throw new Error(`[route-convention] unsupported pageConfig option "${key}" in ${routeKey}`);
|
|
71
72
|
}
|
|
72
73
|
}
|
|
73
|
-
for (const key of ["devOnly", "prefetch"] as const) {
|
|
74
|
+
for (const key of ["devOnly", "prefetch", "canonicalQuery"] as const) {
|
|
74
75
|
if (pageConfig[key] !== undefined && typeof pageConfig[key] !== "boolean")
|
|
75
76
|
throw new Error(`[route-convention] pageConfig.${key} in ${routeKey} must be a boolean.`);
|
|
76
77
|
}
|
|
@@ -102,8 +103,7 @@ const isValidInsetValue = (value: unknown): value is NonNullable<PageConfig["top
|
|
|
102
103
|
return Object.entries(value).every(([key, px]) => responsiveInsetKeys.has(key) && isInsetPx(px));
|
|
103
104
|
};
|
|
104
105
|
|
|
105
|
-
|
|
106
|
-
export const isResponsiveInset = (inset: PageConfig["topInset"]): inset is ResponsiveInset => isRecord(inset);
|
|
106
|
+
const isResponsiveInset = (inset: PageConfig["topInset"]): inset is ResponsiveInset => isRecord(inset);
|
|
107
107
|
|
|
108
108
|
/** The inset at each breakpoint, each one the nearest declared value at or below it. */
|
|
109
109
|
export const insetsByBreakpoint = (inset: PageConfig["topInset"]): { [bp in InsetBreakpoint]: number } => {
|
package/client/index.ts
CHANGED
|
@@ -2,14 +2,13 @@ export {
|
|
|
2
2
|
type ClientRuntime,
|
|
3
3
|
Err,
|
|
4
4
|
fetch,
|
|
5
|
-
getClientRuntime,
|
|
6
5
|
isClientRuntimeRegistered,
|
|
7
6
|
msg,
|
|
8
7
|
registerClientRuntime,
|
|
9
8
|
sig,
|
|
10
9
|
usePage,
|
|
11
10
|
} from "./clientRuntime";
|
|
12
|
-
export { cn
|
|
11
|
+
export { cn } from "./cn";
|
|
13
12
|
export {
|
|
14
13
|
authTokenKey,
|
|
15
14
|
cookieJar,
|
|
@@ -136,7 +135,6 @@ export {
|
|
|
136
135
|
insetAt,
|
|
137
136
|
insetBreakpoints,
|
|
138
137
|
insetsByBreakpoint,
|
|
139
|
-
isResponsiveInset,
|
|
140
138
|
mergePageConfigs,
|
|
141
139
|
type ResolvePageStateOptions,
|
|
142
140
|
readCssSafeAreaInsets,
|
|
@@ -146,7 +144,6 @@ export {
|
|
|
146
144
|
validatePageConfig,
|
|
147
145
|
} from "./frameConfig";
|
|
148
146
|
export { Href } from "./href";
|
|
149
|
-
export { dictionaryContext } from "./locale";
|
|
150
147
|
export {
|
|
151
148
|
type ErrPayload,
|
|
152
149
|
makePageProto,
|
|
@@ -220,7 +217,6 @@ export {
|
|
|
220
217
|
type PrefetchPriority,
|
|
221
218
|
prefetchRsc,
|
|
222
219
|
refreshRsc,
|
|
223
|
-
useRscNavigation,
|
|
224
220
|
} from "./rscNavigation";
|
|
225
221
|
export { sharedContext } from "./sharedContext";
|
|
226
222
|
export { secretStorage, storage } from "./storage";
|
package/client/router.ts
CHANGED
|
@@ -102,10 +102,11 @@ export const isRouteControl = (error: unknown) => {
|
|
|
102
102
|
};
|
|
103
103
|
|
|
104
104
|
function getServerRequestContext() {
|
|
105
|
-
const { untrackedHeaders, untrackedRequest } = require("akanjs/fetch");
|
|
106
|
-
return { getRequest: untrackedRequest, headers: untrackedHeaders } as {
|
|
105
|
+
const { untrackedHeaders, untrackedRequest, getRequestRenderSearch } = require("akanjs/fetch");
|
|
106
|
+
return { getRequest: untrackedRequest, headers: untrackedHeaders, renderSearch: getRequestRenderSearch } as {
|
|
107
107
|
getRequest: () => Request | undefined;
|
|
108
108
|
headers: () => Map<string, string>;
|
|
109
|
+
renderSearch: () => string | undefined;
|
|
109
110
|
};
|
|
110
111
|
}
|
|
111
112
|
|
|
@@ -123,7 +124,7 @@ export const getRequestRoutePath = (lang: string): string | undefined => {
|
|
|
123
124
|
const headers = getServerRequestContext().headers();
|
|
124
125
|
const locale = headers.get("x-locale") ?? lang;
|
|
125
126
|
const basePath = getServerBasePath(pathname, locale, headers.get("x-base-path") ?? undefined, "");
|
|
126
|
-
return `${getPathInfo(pathname, locale, basePath).path}${search}`;
|
|
127
|
+
return `${getPathInfo(pathname, locale, basePath).path}${getServerRequestContext().renderSearch() ?? search}`;
|
|
127
128
|
};
|
|
128
129
|
|
|
129
130
|
const shouldExposeBasePath = () => getEnv().operationMode === "local";
|
package/client/rscNavigation.ts
CHANGED
|
@@ -37,10 +37,3 @@ export const prefetchRsc = (href: string, priority?: PrefetchPriority) =>
|
|
|
37
37
|
export const refreshRsc = () => {
|
|
38
38
|
return globalThis.__AKAN_RSC_REFRESH__?.();
|
|
39
39
|
};
|
|
40
|
-
|
|
41
|
-
/** @deprecated Not a hook; import `navigateRsc`, `clearRscNavigationCache` and `isRscNavigationFromCache`. */
|
|
42
|
-
export const useRscNavigation = () => ({
|
|
43
|
-
clearCache: clearRscNavigationCache,
|
|
44
|
-
isFromCache: isRscNavigationFromCache,
|
|
45
|
-
navigate: navigateRsc,
|
|
46
|
-
});
|
package/common/CodeTranscript.ts
CHANGED
|
@@ -23,7 +23,7 @@ export type CodeTranscriptPart =
|
|
|
23
23
|
}
|
|
24
24
|
| { kind: "notice"; id: string; level: "info" | "warning" | "error"; text: string }
|
|
25
25
|
| { kind: "question"; id: string; question: CodeAgentQuestion; rendered?: string }
|
|
26
|
-
| { kind: "approval"; id: string; request: CodeAgentApprovalRequest; approved?: boolean }
|
|
26
|
+
| { kind: "approval"; id: string; request: CodeAgentApprovalRequest; approved?: boolean; remembered?: string[] }
|
|
27
27
|
| { kind: "host"; id: string; hostKind: string; text: string };
|
|
28
28
|
|
|
29
29
|
export class CodeTranscript {
|
|
@@ -168,7 +168,9 @@ export class CodeTranscript {
|
|
|
168
168
|
case "approval_resolved":
|
|
169
169
|
if (this.#approval?.approvalId === event.approvalId) this.#approval = undefined;
|
|
170
170
|
return this.#patch(event.approvalId, (part) => {
|
|
171
|
-
if (part.kind
|
|
171
|
+
if (part.kind !== "approval") return;
|
|
172
|
+
part.approved = event.approved;
|
|
173
|
+
if (event.remembered?.length) part.remembered = event.remembered;
|
|
172
174
|
});
|
|
173
175
|
case "context":
|
|
174
176
|
this.#context = { used: event.used, max: event.max };
|
package/common/Logger.ts
CHANGED
|
@@ -34,6 +34,8 @@ export interface LogRecord {
|
|
|
34
34
|
origin: string | null;
|
|
35
35
|
traceId: string | null;
|
|
36
36
|
endpoint: string | null;
|
|
37
|
+
/** An id the request was handed but did not take as its own: a caller's, or for a job the trace that enqueued it. */
|
|
38
|
+
link?: string;
|
|
37
39
|
attrs?: LogAttrs;
|
|
38
40
|
}
|
|
39
41
|
|
|
@@ -320,6 +322,7 @@ export class Logger {
|
|
|
320
322
|
origin: ctx?.origin ?? null,
|
|
321
323
|
traceId: ctx?.traceId ?? null,
|
|
322
324
|
endpoint: ctx?.endpoint ?? null,
|
|
325
|
+
...(ctx?.link ? { link: ctx.link } : {}),
|
|
323
326
|
...(attrs ? { attrs: Logger.redactAttrs(attrs) } : {}),
|
|
324
327
|
};
|
|
325
328
|
}
|