@akanjs/cli 3.0.0-alpha.7 → 3.0.0-alpha.70

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (119) hide show
  1. package/.build-stamp +1 -1
  2. package/README.ko.md +1 -1
  3. package/README.md +1 -1
  4. package/{abstractCompactor-e5yq60qz.js → abstractCompactor-20e0cwbs.js} +2 -2
  5. package/{agent.command-pggr92jj.js → agent.command-964bf8qg.js} +9 -7
  6. package/{application.command-692yap1d.js → application.command-n45n18sc.js} +8 -6
  7. package/{applicationBuildRunner-ha3y8ew8.js → applicationBuildRunner-af0wtspv.js} +19 -14
  8. package/{applicationReleasePackager-gg8ccbeh.js → applicationReleasePackager-93nzdfsy.js} +1 -1
  9. package/buildBatch.proc.js +7 -5
  10. package/{capacitorApp-p0z5yab2.js → capacitorApp-vnvnvdhf.js} +29 -27
  11. package/{cloud.command-wqfsyzv2.js → cloud.command-kx1bh5yq.js} +12 -10
  12. package/{context.command-9bxtdn0w.js → context.command-g1a65x6j.js} +17 -15
  13. package/{dependencyScanner-f6grrep3.js → dependencyScanner-rbs2407b.js} +1 -1
  14. package/getDirname-ka11hm7e.js +8 -0
  15. package/{guideline.command-nfqahxex.js → guideline.command-xphyhvwh.js} +8 -6
  16. package/guidelines/agentRule/agentRule.generate.json +31 -0
  17. package/guidelines/agentRule/agentRule.instruction.md +525 -0
  18. package/guidelines/conventions/conventions.generate.json +25 -0
  19. package/guidelines/conventions/conventions.instruction.md +1020 -0
  20. package/guidelines/cssRule/cssRule.instruction.md +7 -0
  21. package/guidelines/framework/framework.instruction.md +1 -0
  22. package/guidelines/mcpRule/mcpRule.generate.json +25 -0
  23. package/guidelines/mcpRule/mcpRule.instruction.md +220 -0
  24. package/guidelines/workspaceOnboarding/workspaceOnboarding.generate.json +24 -0
  25. package/guidelines/workspaceOnboarding/workspaceOnboarding.instruction.md +638 -0
  26. package/incrementalBuilder.proc.js +8 -6
  27. package/{index-azv0xjb5.js → index-0ngvvgry.js} +8 -4
  28. package/index-1577bej2.js +7 -0
  29. package/{index-p3f4q532.js → index-4rw4qhe6.js} +14 -13
  30. package/{index-bjpxzr6s.js → index-5vy2jzar.js} +1 -1
  31. package/{index-js368gk9.js → index-8gybxemv.js} +6 -6
  32. package/{index-qb61h0k7.js → index-abyjt72y.js} +333 -540
  33. package/{index-4hek879p.js → index-bqqts262.js} +1 -1
  34. package/{index-6rhabeev.js → index-e31ghfp5.js} +5 -3
  35. package/index-f39512t6.js +255 -0
  36. package/{index-5pmx7bkg.js → index-fahkq20v.js} +3 -3
  37. package/{index-xhgtkekh.js → index-hee7egtm.js} +1 -1
  38. package/{index-7myvn0f0.js → index-j37qq1f2.js} +1 -1
  39. package/{index-5dw57f0d.js → index-mkn5qagt.js} +14 -14
  40. package/{index-ztpw544k.js → index-nj3w0r34.js} +3 -3
  41. package/{index-vg0sj9nc.js → index-nkwmnqwn.js} +257 -97
  42. package/{index-a1e0j63x.js → index-p681w089.js} +15 -7
  43. package/{index-j9cxndc0.js → index-qnv0aqmm.js} +9 -6
  44. package/{index-w6wbb612.js → index-qt4nfr0n.js} +13 -13
  45. package/{index-bz2sfzzt.js → index-rb65xnw9.js} +4 -4
  46. package/{index-gex7c8kd.js → index-rbnpe8cp.js} +37 -6
  47. package/{index-0cj2zxbm.js → index-sh01r3pm.js} +1 -1
  48. package/{index-gmy45vz2.js → index-v5fdxdre.js} +4 -4
  49. package/{index-mssqn2sq.js → index-va15r8h5.js} +54 -15
  50. package/{index-vtj3zps1.js → index-yg3hxk2k.js} +8 -8
  51. package/{index-2c3e2xh8.js → index-ytaqtc04.js} +1 -1
  52. package/index.js +21 -19
  53. package/{library.command-md9715jz.js → library.command-rfpd27yv.js} +6 -4
  54. package/{localRegistry.command-exkbamyj.js → localRegistry.command-pyxfe0fs.js} +11 -9
  55. package/{module.command-w5aaddxk.js → module.command-qhaxad0p.js} +10 -8
  56. package/{package.command-yfkrcy0z.js → package.command-2k22q9nt.js} +6 -4
  57. package/package.json +4 -5
  58. package/{page.command-echbavp4.js → page.command-ymk9dqh4.js} +6 -4
  59. package/{primitive.command-9fbhspw2.js → primitive.command-9k45zpc1.js} +11 -9
  60. package/{quality.command-3pnt9yep.js → quality.command-bf6vkxe5.js} +192 -97
  61. package/{recipeScanner-tghkzrrt.js → recipeScanner-zrzev25x.js} +3 -3
  62. package/{repair.command-carj4vax.js → repair.command-egvvm6xf.js} +8 -6
  63. package/{routeSourceValidator-e4jmbfcx.js → routeSourceValidator-7fycdqyv.js} +1 -1
  64. package/{scalar.command-51ryzypc.js → scalar.command-bt1facyj.js} +9 -7
  65. package/templates/app/env/env.client.debug.ts.template +1 -5
  66. package/templates/app/env/env.client.develop.ts.template +1 -5
  67. package/templates/app/env/env.client.local.ts.template +1 -5
  68. package/templates/app/env/env.client.main.ts.template +1 -5
  69. package/templates/app/env/env.client.testing.ts.template +1 -5
  70. package/templates/app/env/env.client.type.ts +2 -6
  71. package/templates/app/env/env.server.debug.ts.template +1 -5
  72. package/templates/app/env/env.server.develop.ts.template +1 -5
  73. package/templates/app/env/env.server.local.ts.template +1 -5
  74. package/templates/app/env/env.server.main.ts.template +1 -5
  75. package/templates/app/main.ts +3 -1
  76. package/templates/app/page/styles.css.template +3 -3
  77. package/templates/appSample/srvkit/AuthGuard.ts +9 -5
  78. package/templates/appSample/srvkit/SessionInternalArg.ts +4 -3
  79. package/templates/crudPages/[__model__Id]/edit/page.tsx +1 -1
  80. package/templates/crudPages/new/page.tsx +1 -1
  81. package/templates/crudSinglePage/page.tsx +1 -1
  82. package/templates/env/_env.server.type.ts +7 -5
  83. package/templates/lib/db.ts +1 -1
  84. package/templates/lib/dict.ts +1 -1
  85. package/templates/lib/sig.ts +1 -1
  86. package/templates/lib/srv.ts +6 -2
  87. package/templates/module/__Model__.Util.tsx +1 -1
  88. package/templates/module/__Model__.Zone.tsx +3 -5
  89. package/templates/workspaceRoot/AGENTS.md.template +0 -972
  90. package/templates/workspaceRoot/CLAUDE.md.template +19 -0
  91. package/templates/workspaceRoot/biome.json.template +4 -244
  92. package/templates/workspaceRoot/docs/AI-DEVELOPMENT.md.template +10 -14
  93. package/templates/workspaceRoot/docs/GENERATED.md.template +12 -10
  94. package/templates/workspaceRoot/package.json.template +1 -1
  95. package/{typeChecker-kravn7ns.js → typeChecker-g6bh0xfv.js} +1 -1
  96. package/typecheck.proc.js +1 -1
  97. package/{workflow.command-91wmvm8k.js → workflow.command-v1n3wg7v.js} +16 -14
  98. package/{workspace.command-wa10mfd9.js → workspace.command-yvvqvhzz.js} +71 -52
  99. package/templates/workspaceRoot/.cursor/rules/akan-page-routing.mdc.template +0 -43
  100. package/templates/workspaceRoot/.cursor/rules/akan-sync-conventions.mdc.template +0 -34
  101. package/templates/workspaceRoot/.cursor/rules/application-test-commands.mdc.template +0 -16
  102. package/templates/workspaceRoot/.cursor/rules/change-scope.mdc.template +0 -12
  103. package/templates/workspaceRoot/.cursor/rules/client-server-boundaries.mdc.template +0 -18
  104. package/templates/workspaceRoot/.cursor/rules/coding-comments.mdc.template +0 -25
  105. package/templates/workspaceRoot/.cursor/rules/coding-style.mdc.template +0 -44
  106. package/templates/workspaceRoot/.cursor/rules/domain-module-conventions.mdc.template +0 -17
  107. package/templates/workspaceRoot/.cursor/rules/format-lint.mdc.template +0 -12
  108. package/templates/workspaceRoot/.cursor/rules/lint-enforced-rules.mdc.template +0 -19
  109. package/templates/workspaceRoot/.cursor/rules/module-file-playbook.mdc.template +0 -62
  110. package/templates/workspaceRoot/.cursor/rules/naming-conventions.mdc.template +0 -15
  111. package/templates/workspaceRoot/.cursor/rules/react-component-style.mdc.template +0 -21
  112. package/templates/workspaceRoot/.cursor/rules/repo-overview.mdc.template +0 -17
  113. package/templates/workspaceRoot/.cursor/rules/scalar-modeling.mdc.template +0 -99
  114. package/templates/workspaceRoot/.cursor/rules/secrets-and-env.mdc.template +0 -13
  115. package/templates/workspaceRoot/.cursor/rules/service-signal-conventions.mdc.template +0 -83
  116. package/templates/workspaceRoot/.cursor/rules/srvkit-adapters-and-guards.mdc.template +0 -50
  117. package/templates/workspaceRoot/.cursor/rules/ssr-first.mdc.template +0 -59
  118. package/templates/workspaceRoot/.cursor/rules/typescript-imports.mdc.template +0 -16
  119. /package/{index-r24hmh0q.js → index-yb2wsc7f.js} +0 -0
@@ -55,6 +55,13 @@ Screen code is invariant — a plain `<Button variant="primary">` never changes.
55
55
  - Switching themes is toggling the `data-theme` attribute. Keep every token defined in both the dark and light blocks.
56
56
  - Radius uses `rounded-box` (cards/modals), `rounded-field` (buttons/inputs), `rounded-selector` (toggles/checkboxes).
57
57
 
58
+ ## Lib-Owned Tokens (`libs/<lib>/ui/tokens.css`)
59
+ - A lib that needs colors of its own — vendor brand colors pinned by someone else's guide (Kakao `#fee500`, Naver `#1ec800`), fixed in-game surfaces — declares them **once** in `libs/<lib>/ui/tokens.css`. Never copy the block into each app's stylesheet.
60
+ - The file is collected automatically: every app whose page graph reaches that lib compiles it, ordered **ahead of** the app's own stylesheets, so the app wins on any variable both declare. There is nothing to import and no sync step to remember; two libs both declaring one variable resolve in lib-name order, so do not rely on that.
61
+ - Declare plain custom properties under `:root`, not a Tailwind `@theme` extension: the color vocabulary is closed per stylesheet, so `bg-kakao` would generate no CSS. Reference them as `bg-[var(--kakao)]` / `text-[var(--kakao-foreground)]`, which `no-arbitrary-color` allows by design (a `var()` reference is not an arbitrary color literal).
62
+ - Theme-following colors still belong to the app: a lib token is for a color that must **not** change with `data-theme`.
63
+ - An `@import` the CSS pipeline cannot resolve fails the build; it is never dropped. A stylesheet under `page/` that no route imports is compiled by nothing and warns at build time.
64
+
58
65
  ## Codegen Rules
59
66
  - Do not hardcode hex or raw-palette colors (`bg-red-500`, `#ff0000`); use semantic tokens.
60
67
  - Do not put inline color literals in `style={{ }}`; use token classes.
@@ -26,6 +26,7 @@ Use this as the compact framework context for AI codegen. It should explain how
26
26
  When a request implies a distinct look and feel, do not stop at colors — customize both the theme and, when needed, the components.
27
27
 
28
28
  - **Theme (`apps/<app>/page/styles.css`).** The app imports Tailwind and `akanjs/ui/styles.css`, then overrides semantic token *values* per theme under `:root, [data-theme="dark"]` and `[data-theme="light"]` (`--background`, `--foreground`, `--primary`, `--muted`, `--border`, … each with a `-foreground` pair for text). The framework maps them to Tailwind color names, so `bg-primary` / `text-foreground` follow the `data-theme` attribute; corner rounding uses `--radius-box` / `--radius-field`. Fetch `get_guideline` with `cssRule` for the full token set before a deep theme pass.
29
+ - **Lib tokens (`libs/<lib>/ui/tokens.css`).** Colors a lib's own components pin — a vendor brand color, a fixed surface — are declared once there as plain `:root` custom properties and compiled into every app that reaches the lib, ahead of the app's stylesheets. Reference them as `bg-[var(--kakao)]`; never copy the block into each app.
29
30
  - **Components (`page/**/_overrides.tsx`).** When a default `akanjs/ui` component (Button, Modal, Table, Input, Select, …) is too restrictive for the design, re-skin it per route instead of forking, wrapping, or fighting it with utility classes. Write a drop-in replacement in `apps/<app>/ui/` typed against the slot contract (`AkanModalComponent`, or `AkanUiOverrides["<Slot>"]`), composing the framework's headless parts, then bind it in a `page/**/_overrides.tsx` manifest with a single `export default override({ Slot: BrandComponent })`. Overrides cascade down the route tree like layouts (closest ancestor wins). Fetch `get_guideline` with `componentRule` and read the `references/ui/customize` docs page for the slot list and patterns.
30
31
 
31
32
  ## Review Checklist
@@ -0,0 +1,25 @@
1
+ {
2
+ "title": "MCP Exposure Rule",
3
+ "description": "How Akan signals reach AI agents over MCP — guard-derived exposure, refusals, prompts, and resources",
4
+ "group": "core",
5
+ "codegenPriority": 4,
6
+ "deprecated": false,
7
+ "scans": [
8
+ {
9
+ "type": "example",
10
+ "description": "Signal files whose slices and endpoints declare the guards MCP exposure is derived from",
11
+ "path": "{apps,libs}/*/lib/*/*.signal.ts",
12
+ "sample": 4
13
+ }
14
+ ],
15
+ "update": {
16
+ "filePath": "./mcpRule.instruction.md",
17
+ "contents": ["exposure rule", "configuration", "declaring endpoints", "refusals and wire behaviour", "prompts"],
18
+ "rules": [
19
+ "Use current Akan APIs only",
20
+ "State the rule before the reason, and keep the reason to one clause",
21
+ "Name the env spelling beside every option field",
22
+ "Keep it workspace-neutral — no app or repo names"
23
+ ]
24
+ }
25
+ }
@@ -0,0 +1,220 @@
1
+ # Akan MCP Exposure Guideline
2
+
3
+ ## Purpose
4
+ Use this when writing a `*.signal.ts`, configuring `option.setMcp(...)`, or debugging a tool an agent cannot see.
5
+ The always-loaded convention set carries the short version; this is the full contract.
6
+
7
+ ## Exposure Rule
8
+
9
+ Every signal is served to AI agents as an MCP server on `POST /mcp`. **`/mcp` is mounted by default and exposure
10
+ follows an endpoint's guards — there is no per-endpoint opt-in, and nothing to write in a signal file.** An endpoint
11
+ that declares a real guard is published; one that declares none is refused, and so is a mutation whose only guard is
12
+ `Public`. `AKAN_MCP=false` takes the whole surface off. The reasoning is that the guards are already the
13
+ authorization decision and `filterForAccount` re-reads them per caller on every listing, so a second per-endpoint
14
+ switch says nothing the guards do not — while guaranteeing that every endpoint added later is invisible to agents
15
+ until somebody remembers it.
16
+
17
+ ## Keeping An Endpoint Off The Shelf — `mcp: false`
18
+
19
+ Guards answer "may an agent call this". They do not answer "does this belong on a shelf", and those are different
20
+ questions: a step of a UI-driven state machine (`requestPhoneCodeForSignin`, `setPasswordInPrepareUser`) is
21
+ perfectly guarded, perfectly callable, and a model would only ever call it by mistake. **`mcp: false` is that
22
+ second answer, and it is an opt-*out*: everything still publishes by default, so an endpoint added later is
23
+ visible without anyone remembering it.**
24
+
25
+ ```ts
26
+ requestPhoneCodeForSignin: mutation(Boolean, { guards: [Every], mcp: false }),
27
+ inTodo: init({ guards: [SignedIn], mcp: false }), // the slice's list and insight together
28
+ export class FileSlice extends slice(srv.file, {
29
+ guards: { root: Admin, get: SignedIn, cru: SignedIn },
30
+ mcp: { cru: false }, // reads yes, generated writes no
31
+ }) {}
32
+ ```
33
+
34
+ - **It is curation, not authorization.** HTTP serves the endpoint exactly as before and the guards are still the
35
+ only thing deciding who may call it. Never write `mcp: false` where you meant a guard.
36
+ - **The `mcp` map on `slice()` mirrors the `guards` map above it** — same keys (`root`, `get`, `cru`, `create`,
37
+ `update`, `remove`), same fallbacks (`create`/`update`/`remove` inherit `cru`), and the same scope: it narrows
38
+ the root slice and the generated CRUD, and never reaches a named slice or a custom endpoint. Those declare
39
+ their own `mcp` beside their own `guards`. The bare `mcp: false` is every key at once, still within that scope.
40
+ - **`mcp: true` is the default and is a no-op**; write it only to say out loud that an entry is deliberately on
41
+ the shelf. It does not override a shape refusal (an `Any` return stays refused) and it cannot publish something
42
+ the guard rules keep out.
43
+ - **Reach for it by cost, not by taste.** Every entry inlines the schema of every model it mentions, so a plain
44
+ 21-field model with one named slice costs 12.6KB across its eight entries. `mcp: { cru: false }` on that model
45
+ takes it to 4.7KB — the write entries carry both the input *and* the full model, and are 63% of it.
46
+
47
+ ## Configuration
48
+ Settings live in the app's `lib/option.ts` — `option.setMcp({ … })`, taking `enabled`, `readOnly`, `path`,
49
+ `version`, `instructions`, `allowedOrigins`, `pageSize`, `language`, `legacyTextBlock`, and `auth`. **Not `main.ts`**: the gateway
50
+ there only spawns children, and `option.ts` is the app-authored file `server.ts` already hands to the process that
51
+ mounts `/mcp`. Every lib's option is read in mount order with the app's last, so an app tightens what a library
52
+ declared without restating it. Each field also has an env spelling (`AKAN_MCP`, `AKAN_MCP_READONLY`,
53
+ `AKAN_MCP_PATH`, `AKAN_MCP_VERSION`, `AKAN_MCP_INSTRUCTIONS`, `AKAN_MCP_ALLOWED_ORIGINS`, `AKAN_MCP_PAGE_SIZE`,
54
+ `AKAN_MCP_LANGUAGE`, `AKAN_MCP_LEGACY_TEXT`, `AKAN_MCP_AUTH_SERVERS`, `AKAN_MCP_SCOPES`, `AKAN_MCP_RESOURCE`) for a
55
+ deployment that configures what the source does not, which the option overrides.
56
+ The two booleans answer to `AKAN_PUBLIC_MCP` / `AKAN_PUBLIC_MCP_READONLY` too, the same pairing `AKAN_OPENAPI`
57
+ has, and a value written in code wins over the env of the same name — an explicit `undefined` is not a value.
58
+ `AKAN_MCP_PATH` is normalized to a leading `/`, because the route key and the OAuth metadata path are both built by
59
+ concatenation.
60
+
61
+ ## Declaring Endpoints
62
+ ```typescript
63
+ // apps/<app>/lib/option.ts
64
+ export const option = new AkanOption<ModulesOptions>().setMcp({
65
+ instructions: "Domain tools for this app. Start from taskInTodo.",
66
+ language: "en",
67
+ });
68
+ ```
69
+
70
+ ```typescript
71
+ // <model>.signal.ts — every one of these is an MCP tool or prompt, with no `mcp:` option anywhere
72
+ export class TaskSlice extends slice(
73
+ srv.task,
74
+ { guards: { root: Admin, get: SignedIn, cru: SignedIn } },
75
+ (init) => ({
76
+ // its own guards: the map above reaches base CRUD and the root slice, never a named slice — so a named slice
77
+ // that names none is refused rather than published, which is the one shape to watch for.
78
+ inTodo: init({ guards: [SignedIn] }).exec(function () {
79
+ return this.taskService.queryByStatuses(["todo"]);
80
+ }),
81
+ }),
82
+ ) {}
83
+
84
+ export class TaskEndpoint extends endpoint(srv.task, ({ mutation, prompt }) => ({
85
+ startTask: mutation(cnst.Task, { guards: [SignedIn] })
86
+ .param("taskId", ID)
87
+ .exec(async function (taskId) {
88
+ return await this.taskService.startTask(taskId);
89
+ }),
90
+ reviewTask: prompt({ guards: [SignedIn] })
91
+ .param("taskId", ID)
92
+ .exec(async function (taskId) {
93
+ const task = await this.taskService.getTask(taskId);
94
+ return [Msg.user(`Review this task and suggest next steps.`), Msg.resource(`akan://task/${taskId}`, task)];
95
+ }),
96
+ })) {}
97
+ ```
98
+
99
+ ## Refusals And Wire Behaviour
100
+ - **`mcp: false` is read first**, because it is the one answer nobody had to derive — somebody stated it. Its
101
+ reason says "HTTP still serves it", because that is the sentence that stops the next reader treating it as a lock.
102
+ - **The refusals are fail-closed**: **an endpoint that declares no `guards` at all** (nobody decided who may reach
103
+ it), **a mutation with no real `guards`** (`[Public]` is having none, spelled out — it answers true
104
+ unconditionally), `pubsub` and `message` (their internal args read a socket an MCP request does not have), an
105
+ `Any` or `Upload` return, a file upload, **an argument typed `Any` that must be filled**, and the generated
106
+ **`light<Model>` read** — it returns the same document as `<Model>` under the same guards, in a shape trimmed
107
+ for a page's payload, so publishing both put two entries per model in a listing an agent pays for every turn
108
+ and gave it nothing but the word "light" to choose between them.
109
+ A `prompt` refuses two more, because its `arguments` is one string per name with no schema beside it: a **list
110
+ argument**, which could never carry a second value, and **any `Any` argument** — a tool leaves that out of its
111
+ schema, and a prompt has no schema to leave it out of.
112
+ - **The boot log sizes the catalogue and says which signals it went to** — `MCP catalogue: tools=48 … · listing
113
+ 214KB` and `MCP catalogue cost: user 27/71KB · file 6/22KB · …`, heaviest first. Read it before narrowing
114
+ anything: the number is nobody's intuition, because MCP has no shared component section and forbids a `$ref`
115
+ across entries, so **every entry inlines the full schema of every model it mentions** and a listing is re-sent
116
+ whole to every agent that connects, before its first turn. Past 100KB it says so as a `warn`.
117
+ - **Every refusal is named in the boot log**: one `warn` per endpoint plus a `MCP catalogue: tools=… prompts=…`
118
+ count. Read that line first when a tool you expected is missing — and it is the *only* place the answer exists,
119
+ because there is no absent opt-in to notice. The API explorer badges the same rule per endpoint (`MCP` /
120
+ `MCP refused`), from the same shared implementation the catalogue runs.
121
+ - **An `Any` argument is left out of the published schema** rather than described as `{}` — it tells a model
122
+ nothing — and a value sent for one is refused by name, so the endpoint reads it as omitted. That is what happens
123
+ to the root list's raw `query` descriptor: read as sent, it would be an arbitrary filter over every model you
124
+ publish. Declare a named filter slice when an agent should narrow a list.
125
+ - **A nullable model return publishes no `outputSchema`**, and its empty answer ships as the text `null` with no
126
+ `structuredContent`. That field is an object by definition, so `null` cannot ride in it any more than an array
127
+ can — a list is wrapped as `{ items: … }` for the same reason — and a declared schema obliges every result to
128
+ match it, so a client SDK throws on the first call that finds nothing. A nullable *list* keeps its schema, and a
129
+ scalar return has no structured half at all: it ships as the value itself, not as JSON.
130
+ - **An `outputSchema` names no `hidden`, `secret`, or `visual` field.** Every response has the first two stripped,
131
+ so publishing them promises a property no answer can carry — and on a model like `user` the names are the leak.
132
+ Your *input* schema keeps all three: they are legal to send, and the same model describes a request body.
133
+ - **A `field.visual` is stripped from every MCP result.** It is the marker for a field the page renders and no
134
+ question is answered from — a blur placeholder, a rendered HTML body — and it is cost rather than secrecy, so
135
+ nothing is refused over one. The strip happens in the MCP dispatcher rather than in `resolveReturn`, which every
136
+ ordinary HTTP response also passes through: the whole point is that a browser still receives it. That is also why
137
+ the readable schema drops it — a non-optional visual field would otherwise be listed `required` and a validating
138
+ client would refuse a result that correctly omits it.
139
+ - **A structured result ships twice by default**, once as `structuredContent` and once as the same JSON in the text
140
+ block, which is what the spec asks of a server for clients predating the structured field. It is also a flat
141
+ doubling of what every model-returning tool costs a model. `option.setMcp({ legacyTextBlock: false })` — or
142
+ `AKAN_MCP_LEGACY_TEXT=false` — leaves a one-line pointer in the text block instead, for a deployment whose
143
+ clients read the structured half. A scalar return is unaffected: it has no structured half to point at, so it
144
+ ships as the value itself either way.
145
+ - A refused endpoint answers the *same* "unknown tool" as one that does not exist. Never make that
146
+ message more helpful — the difference is what enumerates your private surface. A guard's refusal is generalized
147
+ the same way: the caller reads `You are not permitted to perform this action.`, never `Access denied by guard:
148
+ Admin`, which names your authorization structure to the one caller barred from it. A domain `Err` resolves
149
+ through the dictionary first and keeps its own words.
150
+ - The `readOnly` / `destructive` / `idempotent` hints a client renders are derived from the endpoint type and key
151
+ and are not configurable. Clients are told to distrust hints; they are never a gate.
152
+ - **`AKAN_MCP_READONLY=true` is the read-only-deployment valve, not the exposure switch.** It drops every mutation
153
+ whatever it declared, and reports each one in the boot log like any other refusal.
154
+ - **RFC 9728 metadata is published only once `AKAN_MCP_AUTH_SERVERS` names an issuer.** An unprotected resource
155
+ that still advertises `bearer_methods_supported` is treated by Cursor (and similar clients) as an OAuth
156
+ mandate, so the well-known document is absent until there is somewhere to obtain a token. When it is served,
157
+ it lives at `/.well-known/oauth-protected-resource` (and at that path plus the mount path, the spelling most
158
+ clients try first). `AKAN_MCP_SCOPES` and `AKAN_MCP_RESOURCE` configure the document when it exists;
159
+ `insufficient_scope` is enforced only once `AKAN_MCP_SCOPES` is set. A token carrying no `aud` at all is
160
+ refused once an issuer is named — that issuer mints tokens for its other resources too — and accepted while
161
+ none is named, because a first-party Akan token is bound by app and environment.
162
+ - **The boot log names every published entry with no dictionary `.desc()`.** An agent picks a tool by its
163
+ description, so a missing one is a broken tool. What the framework generates has no text of its own and borrows
164
+ the model's: the generated list reads the `.of()` label, and the base CRUD tools append the model's `.desc()` to
165
+ their generated `Get X`. Write that model `.desc()` — it is the only text those entries can carry. There is no
166
+ `akan quality scan` rule for this any more: a source scanner found the exposure only as an `mcp:` literal, and
167
+ with exposure derived from the guards the resolved catalogue is the only place that can answer.
168
+ - A browser-hosted client needs `allowedOrigins` **and** the CORS answer the server sends back for those origins.
169
+ Every other MCP client sends no `Origin` at all, and the one that does is matched against the forwarded host so
170
+ a proxy does not turn each call into a 403 — which is only as trustworthy as an edge that *overwrites* that
171
+ header. `AKAN_MCP_RESOURCE` pins the resource identifier where you cannot guarantee it.
172
+ - **A `resources/read` uri that does not decode** — a stray `%` — is `Unknown resource`, not a server failure.
173
+ - **A caller's own mistake is reported as one** and never as a server failure: an argument that is missing,
174
+ unparseable or **undeclared** comes back as `isError` naming it — `additionalProperties: false` travels in the
175
+ published schema and nothing on the wire enforces it — and so does a document that is not there, as
176
+ `No <model> found for the arguments given.` A `prompt`, having no `isError` to carry a refusal, answers `-32602`.
177
+ Only a real failure logs a stack; an agent can drive the rest at will.
178
+ - **Three revisions are spoken**: the modern `2026-07-28` and the legacy `2025-11-25` / `2025-06-18`, which are
179
+ wire-identical over the POST-only surface this implements — a client whose proposal is not listed is told to
180
+ disconnect. An unknown proposal is answered at whichever end of that list it is closer to, and an unimplemented
181
+ method answers `404` to a modern client but `200` to a legacy one, whose era spends `404` on "your session is
182
+ gone".
183
+ - **A modern-era request mirrors `MCP-Protocol-Version` and `Mcp-Method` into headers** (plus `Mcp-Name` when the
184
+ body names one), and one that leaves a mirror out is refused just like one that contradicts the body: a gateway
185
+ rule keyed on a header never fires for the request that omitted it. Legacy requests are not checked. Capabilities
186
+ are derived from the catalogue, so a server with no prompts does not advertise `prompts`.
187
+ - **An expired or wrongly-audienced bearer token is refused up front**, so an agent is told to authenticate rather
188
+ than that the tool does not exist. Its **signature is not checked** — that needs your app's own secret — so a
189
+ token signed wrong, like an opaque one, still degrades to an anonymous caller.
190
+ - **Resource URIs**: `akan://<model>/{id}`, `akan://<model>/list` for the model's own list, and
191
+ `akan://<model>/list/<sliceKey>` for a slice's. The root list takes no third segment on purpose — any token
192
+ there is one a slice could also be named. **Those three are the whole set**, so only the generated reads that
193
+ publish are addressable: a custom endpoint keeps its tool and gets no resource template, and the refused
194
+ `light<Model>` read has no address either.
195
+ - **The catalogue is one language**, `en` unless `language` says otherwise: it is built once at boot and cached by
196
+ clients, so there is no `Accept-Language` negotiation.
197
+
198
+ ## `prompt()`
199
+ **`prompt()`** is invoked by the *user* — a client renders it as a slash command — not chosen by the model. `exec`
200
+ returns `PromptMessage[]`, or a bare string that is wrapped into one user message; build them with `Msg.user` /
201
+ `Msg.assistant` / `Msg.link` / `Msg.resource` / `Msg.image` / `Msg.imageOf`. It takes `.param()` and `.search()`
202
+ only, because `prompts/get` sends a flat string map. **An embedded payload is masked by the model you name** —
203
+ `Msg.resource(uri, task, { model: cnst.LightTask })`, or `Msg.mask(cnst.LightTask, task)` for one piece of an
204
+ assembly. Taking the model as an argument is what makes a `{ ...doc }` spread maskable, since that and `toJSON()`
205
+ arrive with the class already gone; a value with no model named whose `hidden`/`secret` fields are populated is
206
+ **refused**, one level into a plain object too. **A `prompt` is also mounted as a
207
+ plain HTTP `GET` whether or not you enabled MCP**, because that route is what lets a web UI preview one — and it
208
+ is in your OpenAPI document like any other `GET`, answering the one fixed `PromptMessage[]` shape. MCP exposure
209
+ gates the catalogue, not the surface, so guard it
210
+ like any other read — and a prompt declaring no
211
+ `guards` at all is named in the boot log, while an explicit `[Public]` is a decision and stays quiet. Every `Msg` builder takes
212
+ optional `annotations` last (`audience`, `priority` 0..1, `lastModified`) — give the instruction a high `priority`
213
+ and its attachments a low one, or a client with a full window drops blocks by position and keeps the attachment
214
+ over the ask.
215
+
216
+ ## Progress Reporting
217
+ **`McpProgress.report(n, { total, message })`** reports progress from anywhere inside a call, a service or adapter
218
+ frames down included, and is a no-op when nobody is streaming — so the same code runs unchanged over HTTP, a
219
+ websocket, and in tests. `McpProgress.streaming` says whether anyone is reading, for a report whose message
220
+ costs something to assemble.
@@ -0,0 +1,24 @@
1
+ {
2
+ "title": "Workspace Onboarding",
3
+ "description": "Product-workspace orientation — layout, decision matrix, workflow recipes, and query gotchas",
4
+ "group": "core",
5
+ "codegenPriority": 2,
6
+ "deprecated": false,
7
+ "scans": [],
8
+ "update": {
9
+ "filePath": "./workspaceOnboarding.instruction.md",
10
+ "contents": [
11
+ "workspace layout and generated files",
12
+ "agent workflow and common commands",
13
+ "where-do-I-put-this decision matrix",
14
+ "workflow recipes",
15
+ "modeling and query gotchas"
16
+ ],
17
+ "rules": [
18
+ "Use current Akan APIs only",
19
+ "Write for someone building a product on Akan, not for someone changing Akan",
20
+ "Refer to the app as <%= appName %>; the renderer substitutes the workspace's first app",
21
+ "Do not repeat a rule that the conventions guideline already states"
22
+ ]
23
+ }
24
+ }