@akanjs/cli 3.2.0-rc.2 → 3.2.0-rc.20
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/.build-stamp +2 -1
- package/CodeAgent-faqv7t4g.js +11 -0
- package/{CodeTui-zyc7zaq6.js → CodeTui-vqck9tet.js} +822 -666
- package/README.ko.md +26 -1
- package/README.md +26 -1
- package/TunnelShare-bwe3ddv7.js +18 -0
- package/agent.command-p75jvgrd.js +56 -0
- package/akanCode.js +12 -12
- package/appExecutor-020cyesq.js +11 -0
- package/{application.command-vb278qnq.js → application.command-ta2knqxm.js} +72 -34
- package/{applicationBuildRunner-bqbyeg84.js → applicationBuildRunner-gkh82j2b.js} +18 -13
- package/buildBatch.proc.js +26 -11
- package/{cloud.command-ca777ee2.js → cloud.command-v3jhfvm5.js} +31 -28
- package/cloud.script-be9s1432.js +35 -0
- package/{code.command-j08txqcd.js → code.command-mh7dh1st.js} +14 -9
- package/{context.command-2fa6egp9.js → context.command-1ycfjkdd.js} +28 -23
- package/context.runner-333jkz86.js +34 -0
- package/{dependencyScanner-78sq8m4q.js → dependencyScanner-ge10gb52.js} +2 -2
- package/{devTui-w38ch13a.js → devTui-rf374y2w.js} +1 -1
- package/{fileSys-zpvt5gtf.js → fileSys-q22646yc.js} +1 -1
- package/{guideline.command-w6yqpdec.js → guideline.command-w1grfwh7.js} +9 -4
- package/guidelines/agentRule/agentRule.instruction.md +17 -5
- package/guidelines/akanApi/akanApi.instruction.md +3 -1
- package/guidelines/conventions/core.md +23 -5
- package/guidelines/conventions/rules/app.md +4 -1
- package/guidelines/conventions/rules/page.md +5 -0
- package/guidelines/errorCodes/errorCodes.instruction.md +158 -0
- package/guidelines/fieldRule/fieldRule.instruction.md +2 -1
- package/guidelines/mcpRule/mcpRule.instruction.md +74 -2
- package/guidelines/pageRule/pageRule.instruction.md +11 -1
- package/guidelines/runtimeRule/runtimeRule.instruction.md +7 -2
- package/guidelines/transportRule/transportRule.instruction.md +8 -1
- package/incrementalBuilder.proc.js +574 -410
- package/{index-c5ymqb05.js → index-013n6z7m.js} +12 -12
- package/{index-w15mg3km.js → index-0dm25wvf.js} +1 -1
- package/{index-8nbx607g.js → index-0hj82f9w.js} +136 -48
- package/{index-ebwkh7bt.js → index-1c0mjc2b.js} +25 -7
- package/{index-6h775rv3.js → index-1jk52ffq.js} +53 -12
- package/{index-hj6w4ka1.js → index-1p81ecbz.js} +1 -1
- package/{index-ygrdw6jw.js → index-1pjwsh2g.js} +65 -8
- package/{index-cbcwxp5v.js → index-22g3jq43.js} +9 -7
- package/{index-466z5931.js → index-2d9nm03s.js} +580 -364
- package/{index-0fj9ra3q.js → index-2k6mve6a.js} +18 -11
- package/{index-qd7xn2bk.js → index-2ny1e95c.js} +2 -2
- package/{index-j7p0jgaq.js → index-52w4jb87.js} +6 -6
- package/{index-e22zedc2.js → index-5h888r6j.js} +3 -3
- package/{index-7kmbqp0b.js → index-6pxmcaq8.js} +1 -1
- package/{index-xa0289eg.js → index-6zb17wcm.js} +16 -9
- package/{index-qgazn58x.js → index-7a07tdap.js} +50 -38
- package/{index-m5sg5spm.js → index-7ehdht84.js} +565 -187
- package/{index-y725zb1a.js → index-7v7tvgt7.js} +196 -168
- package/{index-pq5rjkch.js → index-88s746ns.js} +7 -2
- package/{index-r0a604h4.js → index-99kjwyma.js} +1 -1
- package/{index-2mrn1mrg.js → index-9f3reh2y.js} +1 -1
- package/{index-386canwe.js → index-9rv2zt48.js} +186 -121
- package/{index-wr9magsr.js → index-9zswcze5.js} +3 -3
- package/{index-xq97me1h.js → index-a41vv4cy.js} +811 -697
- package/{index-yf9wc28h.js → index-bejy9zyc.js} +1 -1
- package/{index-bdmgqzb5.js → index-bket1068.js} +58 -29
- package/{index-bns3wcpc.js → index-by2tvsq6.js} +1 -1
- package/{index-1cb9apzn.js → index-czf94w8c.js} +2 -2
- package/{index-65b6ms4c.js → index-d3178asw.js} +15 -11
- package/index-dss3ds74.js +127 -0
- package/{index-annxfpgz.js → index-eyfty8kk.js} +9 -9
- package/{index-ny2k80mv.js → index-ffa52fwf.js} +1 -1
- package/{index-8jpc5fqv.js → index-g7jgd4xs.js} +2 -2
- package/{index-abfbf01s.js → index-gwsesvqc.js} +2 -2
- package/{index-kcpk2d20.js → index-h1w4wqgd.js} +1474 -1139
- package/{index-j1hjb477.js → index-hp2c7xc2.js} +1 -1
- package/index-j4yvgfhr.js +70 -0
- package/{index-84c2pgak.js → index-jx2jcw1r.js} +89 -78
- package/{index-j6eeh5d7.js → index-knpm8sdm.js} +5 -5
- package/{index-2gees180.js → index-mpp4aas6.js} +62 -33
- package/index-na8r4a27.js +30 -0
- package/{index-0mqga3h9.js → index-nmxszh6x.js} +525 -440
- package/{index-35j83zkd.js → index-p5zh7pmc.js} +2 -2
- package/{index-20wvskt8.js → index-pt0agdck.js} +1 -1
- package/{index-htxck0pn.js → index-q444k260.js} +15 -10
- package/{index-wfmpxke3.js → index-qssq2d41.js} +2775 -3677
- package/{index-23860fej.js → index-rwgqba9p.js} +24 -9
- package/{index-v50xjbbe.js → index-t4d0ckde.js} +1 -1
- package/index-va90m8nd.js +25 -0
- package/index-vjbne22r.js +80 -0
- package/{index-djc5nxpy.js → index-w23tf30e.js} +6 -6
- package/{index-mvwvxgtd.js → index-wa01phm9.js} +289 -210
- package/{index-h7hehkw6.js → index-xczjdng6.js} +3 -1
- package/{index-vbhx60x5.js → index-xwe7y0gf.js} +2140 -2165
- package/index-ze48c0vd.js +788 -0
- package/{index-dk4g0x0d.js → index-zttyg7tg.js} +27 -16
- package/{index-ygdbn9jn.js → index-zyb0ebm4.js} +1 -1
- package/index.js +29 -24
- package/libExecutor-tq994592.js +10 -0
- package/{library.command-8d03a0pq.js → library.command-x219mhcx.js} +9 -4
- package/{localRegistry.command-vyv5k6t0.js → localRegistry.command-4p17wa9t.js} +30 -24
- package/{module.command-vy3kg965.js → module.command-tjthnvvr.js} +17 -8
- package/{package.command-qjh13rs9.js → package.command-c6df2hxx.js} +13 -8
- package/package.json +2 -2
- package/{page.command-t0nx1jat.js → page.command-gf06paq2.js} +9 -4
- package/{pipeline.command-2yjeas7m.js → pipeline.command-y07dgj9b.js} +14 -8
- package/pkgExecutor-stde3yc3.js +10 -0
- package/{primitive.command-8vm49279.js → primitive.command-0enfygxn.js} +13 -8
- package/{projectTypecheck-s9hhe5sa.js → projectTypecheck-mk8wefvd.js} +2 -1
- package/{prompter-qrwx1p17.js → prompter-qyggfhqd.js} +2 -2
- package/{quality.command-v76fev72.js → quality.command-dkbdztad.js} +23 -16
- package/{recipeScanner-4b69ybe0.js → recipeScanner-rrx69awy.js} +1 -1
- package/{repair.command-fp4m3w03.js → repair.command-g5vd95ax.js} +13 -8
- package/{routeSourceValidator-4h947v7c.js → routeSourceValidator-8n6j1vn7.js} +4 -2
- package/{scalar.command-hxe6try8.js → scalar.command-7909pg0d.js} +11 -6
- package/skills/akan-debug/SKILL.md +10 -3
- package/skills/akan-err/SKILL.md +7 -0
- package/skills/akan-mcp/SKILL.md +10 -1
- package/skills/akan-scaffold/SKILL.md +2 -2
- package/skills/akan-transport/SKILL.md +2 -0
- package/skills/akan-validate/SKILL.md +1 -0
- package/{subspace.command-q42n1844.js → subspace.command-at4jt1fb.js} +29 -23
- package/templates/biomeForm.ts +1 -1
- package/templates/env/_env.server.type.ts +1 -1
- package/templates/facetIndex/index.ts +2 -37
- package/templates/lib/sig.ts +0 -4
- package/templates/lib/useClient.ts +1 -1
- package/templates/workspaceRoot/AGENTS.md.template +2 -1
- package/{tunnel.command-22g11n0x.js → tunnel.command-91h92dwr.js} +17 -12
- package/{typeChecker-s640r6c0.js → typeChecker-bfrd1n9n.js} +1 -1
- package/typecheck.proc.js +6 -3
- package/{verify.command-rx43bha1.js → verify.command-pzky05ts.js} +26 -20
- package/{workflow.command-yg0d8mmq.js → workflow.command-mqqe4n12.js} +37 -19
- package/{workspace.command-fcfztvn5.js → workspace.command-y4rznvhx.js} +64 -53
- package/CodeAgent-6cpjtj25.js +0 -11
- package/TunnelShare-zkfkrw8w.js +0 -14
- package/agent.command-kf1g3nh4.js +0 -51
- package/cloud.script-agpxzq6j.js +0 -30
- package/context.runner-ftv8373t.js +0 -29
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
# Akan.js error codes
|
|
2
|
+
|
|
3
|
+
Generated from the akanjs sources of this release: every code a framework error carries, so a caller branches on
|
|
4
|
+
`error.code`, or the `code` of the JSON it was answered with, rather than on the message.
|
|
5
|
+
|
|
6
|
+
- A **forwarded** error answers with its own JSON. Any other `AkanError` answers with its code and status, and in
|
|
7
|
+
production with the status's reason in place of its message, which can name a table, a file or what a provider
|
|
8
|
+
said (`akan start` and `AKAN_ERROR_DETAIL=1` keep the message).
|
|
9
|
+
- **Code on the wire** says whether that JSON carries `code`. A forwarded error whose JSON leaves it out is told
|
|
10
|
+
apart by its `error` key and status.
|
|
11
|
+
- An app's own failure is a dictionary `Err`, which carries its key in `error` instead of one of these codes.
|
|
12
|
+
- In code, `AkanError.is(error, "<code>")` tests any framework error for a code, and `<Class>.is(error)` one class.
|
|
13
|
+
|
|
14
|
+
## Codes
|
|
15
|
+
|
|
16
|
+
| Code | Status | Error | Forwarded | Code on the wire | Source |
|
|
17
|
+
|---|---|---|---|---|---|
|
|
18
|
+
| `alreadyApplied` | 500 | `MigrationError` | no | yes | `server/migration/migrationError.ts` |
|
|
19
|
+
| `alreadyInitialized` | 500 | `AkanError` | no | yes | `base/akanError.ts` |
|
|
20
|
+
| `artifactMissing` | 500 | `AkanError` | no | yes | `base/akanError.ts` |
|
|
21
|
+
| `authRequired` | 401 | `McpAuthRequiredError` | no | yes | `server/mcp/McpDispatcher.ts` |
|
|
22
|
+
| `badGateway` | 502 | `ImageOptimizerError` | no | yes | `server/imageOptimizerError.ts` |
|
|
23
|
+
| `badRequest` | 400 | `Exception.BadRequest` | yes | no | `signal/exception.ts` |
|
|
24
|
+
| `badRequest` | 400 | `ImageOptimizerError` | no | yes | `server/imageOptimizerError.ts` |
|
|
25
|
+
| `baseMismatch` | 500 | `SignalDeclarationError` | no | yes | `signal/signalDeclarationError.ts` |
|
|
26
|
+
| `buildFailed` | 500 | `AkanError` | no | yes | `base/akanError.ts` |
|
|
27
|
+
| `builderUnavailable` | 503 | `AkanError` | no | yes | `base/akanError.ts` |
|
|
28
|
+
| `bytesThroughAny` | 500 | `SignalContractError` | no | yes | `signal/signalContractError.ts` |
|
|
29
|
+
| `circularDependency` | 500 | `AkanError` | no | yes | `base/akanError.ts` |
|
|
30
|
+
| `clientComponentOnServer` | 500 | `AkanError` | no | yes | `base/akanError.ts` |
|
|
31
|
+
| `compressorNotInitialized` | 500 | `AkanError` | no | yes | `base/akanError.ts` |
|
|
32
|
+
| `conflict` | 409 | `Exception.Conflict` | yes | no | `signal/exception.ts` |
|
|
33
|
+
| `consoleDisabled` | 500 | `AkanError` | no | yes | `base/akanError.ts` |
|
|
34
|
+
| `databaseLocked` | 500 | `AkanError` | no | yes | `base/akanError.ts` |
|
|
35
|
+
| `desktopAppRequired` | 500 | `AkanError` | no | yes | `base/akanError.ts` |
|
|
36
|
+
| `documentNotFound` | 404 | `NoDocumentError` | yes | no | `document/noDocumentError.ts` |
|
|
37
|
+
| `duplicateRegistration` | 500 | `AkanError` | no | yes | `base/akanError.ts` |
|
|
38
|
+
| `failed` | 500 | `MigrationError` | no | yes | `server/migration/migrationError.ts` |
|
|
39
|
+
| `fileGrantRefused` | 403 | `AkanError` | no | yes | `base/akanError.ts` |
|
|
40
|
+
| `fileGrantUnavailable` | 503 | `AkanError` | no | yes | `base/akanError.ts` |
|
|
41
|
+
| `forbidden` | 403 | `Exception.Forbidden` | yes | no | `signal/exception.ts` |
|
|
42
|
+
| `gatewayTimeout` | 504 | `Exception` | yes | no | `signal/exception.ts` |
|
|
43
|
+
| `handlerAlreadySet` | 500 | `SignalDeclarationError` | no | yes | `signal/signalDeclarationError.ts` |
|
|
44
|
+
| `inlineFailed` | 502 | `PromptError` | no | yes | `signal/mcp/promptError.ts` |
|
|
45
|
+
| `insightTimeout` | 504 | `InsightQueryError` | yes | yes | `service/insightQueryError.ts` |
|
|
46
|
+
| `insightUnavailable` | 500 | `InsightQueryError` | no | yes | `service/insightQueryError.ts` |
|
|
47
|
+
| `internalError` | 500 | `Exception.Error` | yes | no | `signal/exception.ts` |
|
|
48
|
+
| `invalidArgType` | 500 | `SignalDeclarationError` | no | yes | `signal/signalDeclarationError.ts` |
|
|
49
|
+
| `invalidArgument` | 400 | `McpArgumentError` | no | yes | `server/mcp/McpExecutionContext.ts` |
|
|
50
|
+
| `invalidArtifact` | 500 | `AkanError` | no | yes | `base/akanError.ts` |
|
|
51
|
+
| `invalidCascade` | 500 | `AkanError` | no | yes | `base/akanError.ts` |
|
|
52
|
+
| `invalidConfig` | 500 | `AkanError` | no | yes | `base/akanError.ts` |
|
|
53
|
+
| `invalidDocument` | 500 | `DocumentStoreError` | no | yes | `service/documentStoreError.ts` |
|
|
54
|
+
| `invalidErrors` | 500 | `SignalDeclarationError` | no | yes | `signal/signalDeclarationError.ts` |
|
|
55
|
+
| `invalidFileGrant` | 400 | `AkanError` | no | yes | `base/akanError.ts` |
|
|
56
|
+
| `invalidFilter` | 400 | `FilterQueryError` | no | yes | `document/filterMeta.ts` |
|
|
57
|
+
| `invalidIdentity` | 500 | `AkanError` | no | yes | `base/akanError.ts` |
|
|
58
|
+
| `invalidInject` | 500 | `InjectError` | no | yes | `service/injectError.ts` |
|
|
59
|
+
| `invalidInput` | 400 | `InvalidInputError` | no | yes | `constant/invalidInputError.ts` |
|
|
60
|
+
| `invalidInsightQuery` | 400 | `InsightQueryError` | yes | yes | `service/insightQueryError.ts` |
|
|
61
|
+
| `invalidKey` | 500 | `AkanError` | no | yes | `base/akanError.ts` |
|
|
62
|
+
| `invalidMessage` | 400 | `AkanError` | no | yes | `base/akanError.ts` |
|
|
63
|
+
| `invalidParam` | 500 | `MigrationError` | no | yes | `server/migration/migrationError.ts` |
|
|
64
|
+
| `invalidPrompt` | 500 | `PromptError` | no | yes | `signal/mcp/promptError.ts` |
|
|
65
|
+
| `invalidQuery` | 500 | `DocumentStoreError` | no | yes | `service/documentStoreError.ts` |
|
|
66
|
+
| `invalidRoute` | 500 | `AkanError` | no | yes | `base/akanError.ts` |
|
|
67
|
+
| `invalidRscResponse` | 500 | `AkanError` | no | yes | `base/akanError.ts` |
|
|
68
|
+
| `invalidSchema` | 500 | `DocumentStoreError` | no | yes | `service/documentStoreError.ts` |
|
|
69
|
+
| `invalidSignal` | 500 | `AkanError` | no | yes | `base/akanError.ts` |
|
|
70
|
+
| `invalidStorageKey` | 400 | `AkanError` | no | yes | `base/akanError.ts` |
|
|
71
|
+
| `ipcRequired` | 500 | `AkanError` | no | yes | `base/akanError.ts` |
|
|
72
|
+
| `jobStalled` | 500 | `AkanError` | no | yes | `base/akanError.ts` |
|
|
73
|
+
| `listFailed` | 500 | `AkanError` | no | yes | `base/akanError.ts` |
|
|
74
|
+
| `liveAlreadySet` | 500 | `SignalDeclarationError` | no | yes | `signal/signalDeclarationError.ts` |
|
|
75
|
+
| `livePaused` | 409 | `AkanError` | no | yes | `base/akanError.ts` |
|
|
76
|
+
| `liveRoomTaken` | 500 | `AkanError` | no | yes | `base/akanError.ts` |
|
|
77
|
+
| `locked` | 500 | `MigrationError` | no | yes | `server/migration/migrationError.ts` |
|
|
78
|
+
| `logControlUnavailable` | 503 | `LogControlUnavailableError` | no | yes | `server/logging/logTailClient.ts` |
|
|
79
|
+
| `missingFilterQuery` | 500 | `AkanError` | no | yes | `base/akanError.ts` |
|
|
80
|
+
| `missingInput` | 400 | `InvalidInputError` | no | yes | `constant/invalidInputError.ts` |
|
|
81
|
+
| `missingModel` | 500 | `SignalDeclarationError` | no | yes | `signal/signalDeclarationError.ts` |
|
|
82
|
+
| `missingSlice` | 500 | `SignalDeclarationError` | no | yes | `signal/signalDeclarationError.ts` |
|
|
83
|
+
| `noHandler` | 500 | `SignalContractError` | no | yes | `signal/signalContractError.ts` |
|
|
84
|
+
| `notApplied` | 500 | `MigrationError` | no | yes | `server/migration/migrationError.ts` |
|
|
85
|
+
| `notFound` | 404 | `Exception.NotFound` | yes | no | `signal/exception.ts` |
|
|
86
|
+
| `notFound` | 404 | `ImageOptimizerError` | no | yes | `server/imageOptimizerError.ts` |
|
|
87
|
+
| `notFound` | 500 | `MigrationError` | no | yes | `server/migration/migrationError.ts` |
|
|
88
|
+
| `notInitialized` | 500 | `AkanError` | no | yes | `base/akanError.ts` |
|
|
89
|
+
| `notInitialized` | 500 | `InjectError` | no | yes | `service/injectError.ts` |
|
|
90
|
+
| `notRegistered` | 500 | `AkanError` | no | yes | `base/akanError.ts` |
|
|
91
|
+
| `notRegistered` | 500 | `InjectError` | no | yes | `service/injectError.ts` |
|
|
92
|
+
| `notRegistered` | 500 | `SignalContractError` | no | yes | `signal/signalContractError.ts` |
|
|
93
|
+
| `nullableLastArg` | 500 | `SignalDeclarationError` | no | yes | `signal/signalDeclarationError.ts` |
|
|
94
|
+
| `payloadTooLarge` | 413 | `AkanError` | no | yes | `base/akanError.ts` |
|
|
95
|
+
| `payloadTooLarge` | 413 | `ImageOptimizerError` | no | yes | `server/imageOptimizerError.ts` |
|
|
96
|
+
| `planChanged` | 500 | `MigrationError` | no | yes | `server/migration/migrationError.ts` |
|
|
97
|
+
| `redisUriMissing` | 500 | `AkanError` | no | yes | `base/akanError.ts` |
|
|
98
|
+
| `renderAborted` | 499 | `AkanError` | no | yes | `base/akanError.ts` |
|
|
99
|
+
| `routeConflict` | 500 | `AkanError` | no | yes | `base/akanError.ts` |
|
|
100
|
+
| `routeNotFound` | 404 | `AkanError` | no | yes | `base/akanError.ts` |
|
|
101
|
+
| `routeNotFound` | 404 | `RscRouteNotFound` | no | yes | `server/rscClient.tsx` |
|
|
102
|
+
| `routerNotReady` | 500 | `AkanError` | no | yes | `base/akanError.ts` |
|
|
103
|
+
| `rpcDisposed` | 500 | `AkanError` | no | yes | `base/akanError.ts` |
|
|
104
|
+
| `rscFetchFailed` | 502 | `AkanError` | no | yes | `base/akanError.ts` |
|
|
105
|
+
| `rscQueueOverflow` | 500 | `AkanError` | no | yes | `base/akanError.ts` |
|
|
106
|
+
| `rscRedirectStarted` | 303 | `RscRedirectNavigationStarted` | no | yes | `server/rscClient.tsx` |
|
|
107
|
+
| `rscWorkerFailed` | 500 | `AkanError` | no | yes | `base/akanError.ts` |
|
|
108
|
+
| `rscWorkerStopped` | 500 | `AkanError` | no | yes | `base/akanError.ts` |
|
|
109
|
+
| `searchMisconfigured` | 500 | `DocumentStoreError` | no | yes | `service/documentStoreError.ts` |
|
|
110
|
+
| `searchUnavailable` | 500 | `DocumentStoreError` | no | yes | `service/documentStoreError.ts` |
|
|
111
|
+
| `secretRefused` | 500 | `AkanError` | no | yes | `base/akanError.ts` |
|
|
112
|
+
| `secretStoreUnavailable` | 503 | `AkanError` | no | yes | `base/akanError.ts` |
|
|
113
|
+
| `serviceUnavailable` | 503 | `ImageOptimizerError` | no | yes | `server/imageOptimizerError.ts` |
|
|
114
|
+
| `shutdownTimeout` | 500 | `AkanError` | no | yes | `base/akanError.ts` |
|
|
115
|
+
| `stageFailed` | 500 | `AkanError` | no | yes | `base/akanError.ts` |
|
|
116
|
+
| `storageNotShared` | 500 | `AkanError` | no | yes | `base/akanError.ts` |
|
|
117
|
+
| `tableMissing` | 500 | `DocumentStoreError` | no | yes | `service/documentStoreError.ts` |
|
|
118
|
+
| `tooManyRequests` | 429 | `Exception` | yes | no | `signal/exception.ts` |
|
|
119
|
+
| `transferUnsupported` | 500 | `AkanError` | no | yes | `base/akanError.ts` |
|
|
120
|
+
| `unauthorized` | 401 | `Exception.Unauthorized` | yes | no | `signal/exception.ts` |
|
|
121
|
+
| `undefinedReturn` | 500 | `SignalContractError` | no | yes | `signal/signalContractError.ts` |
|
|
122
|
+
| `unencodableValue` | 500 | `AkanError` | no | yes | `base/akanError.ts` |
|
|
123
|
+
| `unguardedEndpoint` | 500 | `AkanError` | no | yes | `base/akanError.ts` |
|
|
124
|
+
| `unmaskedResource` | 500 | `PromptError` | no | yes | `signal/mcp/promptError.ts` |
|
|
125
|
+
| `unroutableLiveQuery` | 500 | `AkanError` | no | yes | `base/akanError.ts` |
|
|
126
|
+
| `unstorableValue` | 400 | `DocumentStoreError` | no | yes | `service/documentStoreError.ts` |
|
|
127
|
+
| `unsupportedMediaType` | 415 | `Exception.UnsupportedMediaType` | yes | no | `signal/exception.ts` |
|
|
128
|
+
| `usage` | 500 | `MigrationError` | no | yes | `server/migration/migrationError.ts` |
|
|
129
|
+
| `verifyFailed` | 500 | `MigrationError` | no | yes | `server/migration/migrationError.ts` |
|
|
130
|
+
| `wrongTransport` | 500 | `SignalContractError` | no | yes | `signal/signalContractError.ts` |
|
|
131
|
+
| set when thrown | set when thrown | `Err` | yes | yes | `common/err.ts` |
|
|
132
|
+
| set when thrown | set when thrown | `Err.BadRequest` | yes | yes | `common/err.ts` |
|
|
133
|
+
| set when thrown | set when thrown | `Err.Conflict` | yes | yes | `common/err.ts` |
|
|
134
|
+
| set when thrown | set when thrown | `Err.Forbidden` | yes | yes | `common/err.ts` |
|
|
135
|
+
| set when thrown | set when thrown | `Err.NotFound` | yes | yes | `common/err.ts` |
|
|
136
|
+
| set when thrown | set when thrown | `Err.Unauthorized` | yes | yes | `common/err.ts` |
|
|
137
|
+
|
|
138
|
+
## Codes by status
|
|
139
|
+
|
|
140
|
+
An error coded by its status, such as an `Exception`, takes its code from `AkanError.codeOfStatus`:
|
|
141
|
+
|
|
142
|
+
| Status | Code | Reason |
|
|
143
|
+
|---|---|---|
|
|
144
|
+
| 400 | `badRequest` | Bad Request |
|
|
145
|
+
| 401 | `unauthorized` | Unauthorized |
|
|
146
|
+
| 403 | `forbidden` | Forbidden |
|
|
147
|
+
| 404 | `notFound` | Not Found |
|
|
148
|
+
| 409 | `conflict` | Conflict |
|
|
149
|
+
| 413 | `payloadTooLarge` | Payload Too Large |
|
|
150
|
+
| 415 | `unsupportedMediaType` | Unsupported Media Type |
|
|
151
|
+
| 429 | `tooManyRequests` | Too Many Requests |
|
|
152
|
+
| 500 | `internalError` | Internal Server Error |
|
|
153
|
+
| 502 | `badGateway` | Bad Gateway |
|
|
154
|
+
| 503 | `serviceUnavailable` | Service Unavailable |
|
|
155
|
+
| 504 | `gatewayTimeout` | Gateway Timeout |
|
|
156
|
+
|
|
157
|
+
Any other status is coded `http<status>`, with the reason `Internal Server Error` from 500 and `Request Failed`
|
|
158
|
+
below it.
|
|
@@ -63,7 +63,8 @@ Use this whenever generating constants or scalar constants. It defines the curre
|
|
|
63
63
|
- **Do not declare `Upload` as a model field.** `Upload` is a signal-body-only primitive. Declare an image/file
|
|
64
64
|
field as a relation to `File`: `image: field(File).optional()` for one, `images: field([File])` for many.
|
|
65
65
|
- The store then auto-generates an `upload<Field>On<Model>(fileList)` action that calls the framework upload
|
|
66
|
-
mutation and polls file status until it leaves `"uploading"` (`
|
|
66
|
+
mutation and polls file status until it leaves `"uploading"` (`uploadSetterOf` in
|
|
67
|
+
`pkgs/akanjs/store/formFieldSetters.ts`).
|
|
67
68
|
- **An upload is scoped to the form that started it.** `Field.Img` / `Imgs` / `File` / `Files` handed the generated
|
|
68
69
|
`set<Field>On<Model>` upload through `upload<Field>On<Model>` (any other `onChange` keeps the plain slice upload).
|
|
69
70
|
While the request runs, `<model>FormUploading` holds a ticket under the field's name (`{}` when idle);
|
|
@@ -205,8 +205,11 @@ export default page()
|
|
|
205
205
|
alike: the caller reads `You are not permitted to perform this action.`, because either sentence names your
|
|
206
206
|
authorization structure to the one caller barred from it. A domain `Err` at any other status resolves through
|
|
207
207
|
the dictionary and keeps its own words, placeholders filled.
|
|
208
|
-
- The `readOnly` / `destructive` / `idempotent` hints a client renders are derived from the endpoint type and key
|
|
209
|
-
|
|
208
|
+
- The `readOnly` / `destructive` / `idempotent` hints a client renders are derived from the endpoint type and key.
|
|
209
|
+
A mutation named `remove`, `delete`, `purge`, `destroy`, `erase`, `wipe`, `drop`, `cancel`, `bulkRemove` or
|
|
210
|
+
`bulkDelete` is destructive; `destructive: true` or `false` on the endpoint overrides that, for an `archiveOrder`
|
|
211
|
+
no verb gives away. Clients are told to distrust hints; they are never a gate. `agentService.loop` does read this
|
|
212
|
+
one: it refuses a destructive tool unless `approve` allows it.
|
|
210
213
|
- **`AKAN_MCP_READONLY=true` is the read-only-deployment valve, not the exposure switch.** It drops every mutation
|
|
211
214
|
whatever it declared, and reports each one in the boot log like any other refusal. It also drops each `.prompt()`
|
|
212
215
|
page's text tool, whose run renders the whole page; the prompts, the `.app()` tools and their views stay.
|
|
@@ -250,6 +253,17 @@ export default page()
|
|
|
250
253
|
`base.error.documentNotFound`, so a tool reads its dictionary sentence (`The requested item does not exist.`) and an
|
|
251
254
|
MCP App view receives that `Err`; a prompt whose page reads it is `No screen exists for these arguments.`
|
|
252
255
|
Only a real failure logs a stack; an agent can drive the rest at will.
|
|
256
|
+
- **Every failed call carries a code** beside the text, which reads as it always did. A tool error holds
|
|
257
|
+
`_meta["akanjs/failure"]: { code, statusCode }` — in `_meta`, because a client checks `structuredContent` against
|
|
258
|
+
the tool's `outputSchema` even on a failure — and a JSON-RPC error holds `data.code`, which tells apart what
|
|
259
|
+
`-32602` files together: `unknownTool`, `invalidArgument`, `unknownPrompt`, `unknownResource` and a screen's
|
|
260
|
+
refusal, beside `tooManyRequests` and `internalError`. The code is the one an HTTP caller gets: a domain `Err`'s
|
|
261
|
+
dictionary key (what `Err.is` matches), else the `AkanError`'s own code; a guard's 401 or 403 by its status alone
|
|
262
|
+
(`unauthorized`, `forbidden`), since a guard's own code names its rule as its message does; a crash, or a 5xx whose
|
|
263
|
+
answer names no bounded code, by its status (`internalError`). A 5xx's text is redacted but its code token is not,
|
|
264
|
+
and it comes from the error's own JSON when that carries one, which can be a third-party library's. A code is a
|
|
265
|
+
bounded key or camelCase token, never prose. No host hands `_meta` to the model, so what the model must act on
|
|
266
|
+
belongs in the dictionary sentence.
|
|
253
267
|
- **Three revisions are spoken**: the modern `2026-07-28` and the legacy `2025-11-25` / `2025-06-18`, which are
|
|
254
268
|
wire-identical over the POST-only surface this implements — a client whose proposal is not listed is told to
|
|
255
269
|
disconnect. An unknown proposal is answered at whichever end of that list it is closer to, and an unimplemented
|
|
@@ -486,6 +500,64 @@ frames down included, and is a no-op when nobody is streaming — so the same co
|
|
|
486
500
|
websocket, and in tests. `McpProgress.streaming` says whether anyone is reading, for a report whose message
|
|
487
501
|
costs something to assemble.
|
|
488
502
|
|
|
503
|
+
## Calling The Catalogue In-Process — `AgentToolsRole`
|
|
504
|
+
|
|
505
|
+
A server-side agent loop or a queue job reaches the same catalogue with no token and no loopback request:
|
|
506
|
+
`plug(AgentToolsRole)` in a service, then `listAs(account, { allow })` for the tools a model is offered and
|
|
507
|
+
`callAs(account, { id, name, args })` to run one. Everything above still holds — `mcp: false`, the exclusions,
|
|
508
|
+
`readOnly`, `Person`, the account guards, masking and the refusal text — and the call's `origin` is `"mcp"`, so
|
|
509
|
+
`isAgentCall` and `.with(AgentCall)` treat it as an agent's. `allow` only narrows. It is built from the DI
|
|
510
|
+
registry, so a batch server, which mounts no `/mcp`, has it too; the per-caller `/mcp` budget does not apply, an
|
|
511
|
+
endpoint's own `rateLimit` does. A tool's failure never throws: it comes back as the result's `error` and `code`.
|
|
512
|
+
An adaptor may plug the role too. Neither method works before the server has built its endpoints, so a call from an
|
|
513
|
+
`onInit` throws `InjectError` `notInitialized`; call from a request, a job or a schedule. A page's `page().app()` tools
|
|
514
|
+
are left out: `/mcp` `tools/list` shows them, `listAs` does not, and `callAs` answers `Unknown tool`.
|
|
515
|
+
|
|
516
|
+
- **The account is trusted as given.** It is put on the call after the middleware chain, so pass one the server
|
|
517
|
+
resolved, never client input, and resolve a stored one again before reusing it: a revoked session is not noticed.
|
|
518
|
+
Its `machine` field is removed, since only a verified machine token may set one.
|
|
519
|
+
- **`headers` are forwarded without `authorization`, `cookie` and `origin`**; `ip` is what `getClientIp()` and an
|
|
520
|
+
ip-scoped `rateLimit` read, unknown by default.
|
|
521
|
+
|
|
522
|
+
## A Server Agent Loop — `agentService.loop`
|
|
523
|
+
|
|
524
|
+
`this.agentService.loop(request)` runs a model over that catalogue until it answers, with no browser — a queued
|
|
525
|
+
task, a scheduled run, a reply to a mention. It is an async iterable of `text`, `toolCall`, `toolResult`, `usage`,
|
|
526
|
+
`compacted` and `awaiting` events that ends in exactly one `done { stop }` or `error`, and it waits for the consumer
|
|
527
|
+
at every event.
|
|
528
|
+
|
|
529
|
+
- **Who it acts as.** `account` is a snapshot the server resolved; `principal` is a stored id that
|
|
530
|
+
`option.setAgentAccountResolver((principal) => account | null)` resolves at the start and before every round, so
|
|
531
|
+
a revoked one ends the run as `"unauthorized"`, as does a missing or falsy `account`: there is no anonymous run.
|
|
532
|
+
Neither is ever client input. The model is offered `allow` ∩ what
|
|
533
|
+
the account sees on `/mcp`, and a call to a name that round did not list is answered as an unknown tool, neither
|
|
534
|
+
asked about nor run. A request with no `allow` array is an `error`.
|
|
535
|
+
- **Writes after untrusted input.** `untrusted(result)` marks a result third parties wrote, and every later call
|
|
536
|
+
reaches `approve(call, { tainted, tool })` with `tainted` set. A batch is judged before it runs, since the model
|
|
537
|
+
wrote it before reading its results. Without `approve`, a `needsConfirm` tool — on this catalogue, a mutation
|
|
538
|
+
with the `destructive` hint above — is refused, and so is every write once tainted. `"defer"` holds the whole batch, emits
|
|
539
|
+
`awaiting` and ends the run as `"awaiting"`.
|
|
540
|
+
- **Resuming.** Store each message `onMessage` hands over — it is awaited, and a retried run may hand one over twice —
|
|
541
|
+
and call `loop` again with them. Trailing calls nothing answered go to `approve` again before any model call, and
|
|
542
|
+
the taint is rebuilt from the `tainted` marks on stored messages and by re-applying `untrusted`, which sees a result
|
|
543
|
+
whole during the run and clipped on a resume. Store every message whole, marks included. `compacted` says the first
|
|
544
|
+
`replaced` messages are now `summary`; its `tainted` marker stands in for the results it replaced, and a summary
|
|
545
|
+
with no marker counts as tainted to a run with `untrusted`. A batch's results
|
|
546
|
+
reach `onMessage` even when the consumer stops reading or a later call throws, so a resume runs only calls that
|
|
547
|
+
never started.
|
|
548
|
+
- **Metering.** Each model call, compactions included, is its own turn for the request policy, the quota and the
|
|
549
|
+
usage hook. It gets a fresh `id`, `loop { id, round }`, a copy of the request's `meta` — server-set, so it may key
|
|
550
|
+
billing — empty headers and no ip. The relay's default size caps skip loop rounds; a refused quota ends the run as
|
|
551
|
+
`"quota"`.
|
|
552
|
+
- **Limits.** `maxRounds` (12), `budget { tokens, toolCalls, wallMs }` (`"budget"`), `signal` (`"aborted"`) and a
|
|
553
|
+
provider cut (`"length"`). A limit that is not a valid number is an `error` before any model call. `wallMs` and
|
|
554
|
+
`signal` also end a run waiting on a tool or on `approve`. `callAs` cannot cancel a call, so the run stops waiting
|
|
555
|
+
and answers it with an error saying it may still finish; a resume does not run it again, and the endpoint runs on
|
|
556
|
+
with its outcome unreported. There is no preamble unless `preamble` gives one; with no `instructions` either, a
|
|
557
|
+
short neutral prompt stands in, as each adaptor's own fallback is about a screen. `compact { at, keep }` summarizes
|
|
558
|
+
the head, and a tool result is capped at 20,000 characters as the browser caps it. Its calls carry no ip, so an
|
|
559
|
+
ip-scoped `rateLimit` counts them under one unknown address.
|
|
560
|
+
|
|
489
561
|
## Rolling MCP Out To An App
|
|
490
562
|
|
|
491
563
|
The goal of exposing a service over MCP is that a person uses it through an agent instead of through the page:
|
|
@@ -48,6 +48,11 @@ body shape — this is the full contract behind them. Before changing route beha
|
|
|
48
48
|
that is harmless to repeat and safe for anyone to trigger (a warm-up) passes `{ duringRender: true }` as the option
|
|
49
49
|
after the endpoint's own arguments (`fetch.updateX(id, data, { duringRender: true })`). `akan quality` flags the call,
|
|
50
50
|
same-file helpers included, as `akan.ssr.render-mutation`.
|
|
51
|
+
- **A `Link` renders its page ahead of the click** — on hover, on keyboard focus, or as it shows with
|
|
52
|
+
`prefetch="viewport"` (production only). A page whose render has an effect one visit should cause once — a view
|
|
53
|
+
counted through `duringRender`, an expensive report — refuses with `.config({ prefetch: false })`; on a `_layout.tsx`
|
|
54
|
+
it covers every page below, and a page there opts back in with `prefetch: true`. Its guards still run for the
|
|
55
|
+
prefetch, so a redirect answers as one, and the click renders the page as usual.
|
|
51
56
|
|
|
52
57
|
## Route Guards — `.guard()`
|
|
53
58
|
|
|
@@ -55,7 +60,12 @@ body shape — this is the full contract behind them. Before changing route beha
|
|
|
55
60
|
`.guard()` throws when the module loads. `fn` receives the route's typed arguments and `lang` (a layout's gets no
|
|
56
61
|
`children`) and may be `async`. It refuses by moving the router — `router.redirect(href)`, `router.notFound()` — or
|
|
57
62
|
with `getSelf({ unauthorize })`; `signedIn()` from `@libs/shared/webkit` is that last one, called inside an arrow
|
|
58
|
-
(`.guard(() => signedIn())`), because `.guard(signedIn)` would
|
|
63
|
+
(`.guard(() => signedIn())`), because `.guard(signedIn)` would take the route's arguments as its option.
|
|
64
|
+
- **A guard's second argument `{ path }` is where the visitor was going** — the in-app path with its search, as
|
|
65
|
+
`router.push` takes it (`undefined` while MCP lists the screen): `.guard((_, { path }) => signedIn({ path }))`
|
|
66
|
+
sends a refused visitor to `/signin?redirect=<path>`. Build a redirect target from it, never an admission rule —
|
|
67
|
+
CSR asks a guard again only when the route or an argument it declared moves. Hand it only to `router.push` or
|
|
68
|
+
`router.redirect`: it can be a raw `//host`, which `window.location` would follow off the site.
|
|
59
69
|
- **On the server every guard of the chain runs before any layout body starts**, root layout first and before the
|
|
60
70
|
route's arguments are checked, so a redirect is a real 307 even after an awaited query, and a not-found is a 404 —
|
|
61
71
|
where a `getSelf({ unauthorize })` inside a layout body under a `.loading()` redirects late after I/O, inside the
|
|
@@ -391,7 +391,8 @@ const config: AppConfig = {
|
|
|
391
391
|
was opened for while its frames load web content from anywhere, with an init script that runs in the top document
|
|
392
392
|
only, `evaluate`, a trusted `sendKey`, `capture`, and `loadFailed` / `gone` (it reloads, or is rebuilt, by itself;
|
|
393
393
|
the reason is `terminated` on macOS, and `rebuildFailed` when a rebuild failed and the view is closed, to be opened
|
|
394
|
-
again) / `consoleMessage` events. Every method on Windows
|
|
394
|
+
again) / `consoleMessage` events. Every method on Windows and Linux, where a visible view also holds the keyboard
|
|
395
|
+
focus and no `consoleMessage` is sent; macOS 14+ lacks `sendKey`, `setMuted` and `capture`.
|
|
395
396
|
|
|
396
397
|
## A Desktop App's Server — `bin` And `trustedDependencies`
|
|
397
398
|
|
|
@@ -536,6 +537,10 @@ page API is
|
|
|
536
537
|
`akanjs/client/native/<id>` (`akanjs/client/native/window`, `…/screen`, `…/global-shortcut`), imported in a `webkit/`
|
|
537
538
|
hook; `volume` and `filePicker` also come from `akanjs/client/native` itself. A capability the shell
|
|
538
539
|
lacks is added there: an app's own plugin runs as Bun code in the plugin host and cannot add a native shell op.
|
|
540
|
+
`isNativeApp()`, `isNativeShell()`, `nativePlatform()` and `desktopPlatform()` come from `akanjs/client`, which starts
|
|
541
|
+
the native runtime only inside a shell. A static import of `akanjs/client/native` loads `@akanjs/native/core` on every
|
|
542
|
+
web page that reaches the file, so an app's store, or its own hook a web page also renders, loads the plugin on first
|
|
543
|
+
use behind the check: `if (isNativeApp()) await (await import("akanjs/client/native/push")).push.register()`.
|
|
539
544
|
|
|
540
545
|
**A plugin the app or lib owns lives in `native/<id>/`**, the folder named after the plugin id: `native-plugin.json`
|
|
541
546
|
beside its page API (`src/index.ts`, `definePlugin` from `akanjs/client/native`), its desktop part (`src/desktop.ts`,
|
|
@@ -555,7 +560,7 @@ uses `getCookie` / `setCookie` / `removeCookie`, `storage`, and `secretStorage`
|
|
|
555
560
|
names — pass `sameSite: "none"` only for a cookie a cross-site POST must carry back. `getCookie` reads a name sent
|
|
556
561
|
twice as unset, since a sibling subdomain can plant a second copy; server code reads `cookieJar()` from
|
|
557
562
|
`akanjs/fetch`, or `CookieJar.parse(req.headers.get("cookie"))`, never `req.cookies`. Browser APIs an app WebView lacks
|
|
558
|
-
stay in a `webkit/` hook that branches on `isNativeApp()` from `akanjs/client
|
|
563
|
+
stay in a `webkit/` hook that branches on `isNativeApp()` from `akanjs/client`, which is where the app side goes
|
|
559
564
|
too (`no-web-only-api-outside-webkit`, a warning): `navigator.share` / `canShare` (Android's WebView has none),
|
|
560
565
|
`navigator.serviceWorker` and `Notification.requestPermission` / `.permission` (no app page has them),
|
|
561
566
|
`navigator.geolocation` (use `useGeoLocation` from `akanjs/webkit`) and `navigator.vibrate` (iOS has none; use
|
|
@@ -57,7 +57,9 @@ HTTP verb a mutation is mounted under. `conventions` carries the invariants —
|
|
|
57
57
|
each room delivers (`seq`); a client drops a repeat, and a hole — a frame dropped under backpressure — calls the
|
|
58
58
|
room's `onResync`. A resubscribe names its last frame (`since`): a server that saw every publish (a solo process)
|
|
59
59
|
replays what followed it ahead of the ack, and otherwise answers a gap, which calls `onResync` as before. Binary
|
|
60
|
-
rooms are not numbered.
|
|
60
|
+
rooms are not numbered. A server on Redis whose link to the app's other servers drops and returns sends each room a
|
|
61
|
+
`resync` frame once Redis hands it the room's events again, which calls `onResync` too (a live room refetches
|
|
62
|
+
instead), since what other servers published meanwhile never reached it.
|
|
61
63
|
- **A cleanup registered with `ws.on("disconnect" | "unsubscribe", fn)` is scoped to the call that registered it.**
|
|
62
64
|
From a `pubsub` subscribe it belongs to that room — `unsubscribe` runs when the client leaves it or a credential
|
|
63
65
|
change revokes it, `disconnect` when the socket closes while still subscribed — so a room already left runs
|
|
@@ -66,6 +68,11 @@ HTTP verb a mutation is mounted under. `conventions` carries the invariants —
|
|
|
66
68
|
- **A subscribe the client leaves before it finishes joins nothing.** When an `unsubscribe` for the room, or the
|
|
67
69
|
socket's close, arrives while the subscribe is still running, the subscribe answers `subscribe: false` and runs its
|
|
68
70
|
`unsubscribe` cleanup (and its `disconnect` one when the socket closed) instead of joining the room.
|
|
71
|
+
- **A send from the browser drops the reads it may have made stale.** A mutation, an upload or a `message` sent
|
|
72
|
+
through `fetch` ends the sharing of queries already in flight and drops the pages a `Link` prefetched, so the next
|
|
73
|
+
read asks again; only this tab's own sends count. A send that changes nothing anyone reads back — typing status, a
|
|
74
|
+
cursor move — passes `{ keepsReads: true }` after its arguments (`fetch.typing(chatId, { keepsReads: true })`), or
|
|
75
|
+
a chatty endpoint keeps every prefetch from surviving. A read receipt changes an unread count and passes nothing.
|
|
69
76
|
|
|
70
77
|
## Writing A Guard
|
|
71
78
|
|