@happyvertical/smrt-template-sveltekit 0.60.18 → 0.61.1

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 (80) hide show
  1. package/AGENTS.md +68 -51
  2. package/README.md +25 -10
  3. package/agents/cookbook-design-runs.md +164 -0
  4. package/agents/cookbook-host.md +724 -0
  5. package/agents/onboarding.md +116 -0
  6. package/agents/plugin-mode.md +152 -0
  7. package/cookbook-template/.pnpmfile.cjs +5 -0
  8. package/cookbook-template/src/hooks.server.ts +3 -0
  9. package/cookbook-template/src/lib/server/cookbook.ts +21 -0
  10. package/cookbook-template/src/lib/server/smrt.ts +11 -0
  11. package/cookbook-template/src/routes/+layout.server.ts +24 -0
  12. package/cookbook-template/src/routes/+layout.svelte +47 -0
  13. package/cookbook-template/src/routes/+page.server.ts +15 -0
  14. package/cookbook-template/src/routes/+page.svelte +12 -0
  15. package/cookbook-template/src/routes/api/_runtime/owner-link/+server.ts +2 -0
  16. package/cookbook-template/src/routes/api/assistant/[...path]/+server.ts +2 -0
  17. package/cookbook-template/src/routes/api/connect-ai/+server.ts +2 -0
  18. package/cookbook-template/src/routes/api/cookbook/prebuilt/+server.ts +3 -0
  19. package/cookbook-template/src/routes/api/cookbook/preferences/+server.ts +45 -0
  20. package/cookbook-template/src/routes/api/onboarding/+server.ts +3 -0
  21. package/cookbook-template/src/routes/m/[pkg]/[model]/[[key]]/+page.server.ts +1 -0
  22. package/cookbook-template/src/routes/m/[pkg]/[model]/[[key]]/+page.svelte +7 -0
  23. package/cookbook-template/src/routes/mcp/+server.ts +2 -0
  24. package/cookbook-template/src/routes/onboarding/+page.server.ts +13 -0
  25. package/cookbook-template/src/routes/onboarding/+page.svelte +28 -0
  26. package/cookbook-template/src/routes/s/[slug]/+page.server.ts +10 -0
  27. package/cookbook-template/src/routes/s/[slug]/+page.svelte +6 -0
  28. package/cookbook-template/src/routes/settings/+page.server.ts +22 -0
  29. package/cookbook-template/src/routes/settings/+page.svelte +49 -0
  30. package/cookbook-template/src/routes/settings/inference/+page.server.ts +6 -0
  31. package/cookbook-template/src/routes/settings/inference/+page.svelte +14 -0
  32. package/cookbook-template/vite.config.ts +4 -0
  33. package/dist/host/client.d.ts +8 -0
  34. package/dist/host/client.js +66 -0
  35. package/dist/host/design-runs.d.ts +72 -0
  36. package/dist/host/design-runs.js +763 -0
  37. package/dist/host/generate.d.ts +49 -0
  38. package/dist/host/generate.js +266 -0
  39. package/dist/host/onboarding.d.ts +26 -0
  40. package/dist/host/onboarding.js +247 -0
  41. package/dist/host/plugin-mode.d.ts +55 -0
  42. package/dist/host/plugin-mode.js +184 -0
  43. package/dist/host/preferences.d.ts +40 -0
  44. package/dist/host/preferences.js +163 -0
  45. package/dist/host/server.d.ts +283 -0
  46. package/dist/host/server.js +2400 -0
  47. package/dist/host/settings.d.ts +57 -0
  48. package/dist/host/settings.js +130 -0
  49. package/dist/host/state.d.ts +26 -0
  50. package/dist/host/state.js +149 -0
  51. package/dist/host/sveltekit-client.d.ts +22 -0
  52. package/dist/host/sveltekit-client.js +53 -0
  53. package/dist/smrt-knowledge.okf.md +105 -0
  54. package/examples/notes/src/routes/notes/+page.svelte +145 -0
  55. package/host/CookbookModelPage.svelte +78 -0
  56. package/host/InferenceSettingsPage.svelte +103 -0
  57. package/mcp-apps-template/package.dependencies.json +2 -2
  58. package/package.json +102 -24
  59. package/template/README.md +24 -11
  60. package/template/package.json +17 -12
  61. package/template/smrt.config.ts +4 -0
  62. package/template/src/hooks.server.ts +5 -0
  63. package/template/src/lib/objects/index.ts +7 -3
  64. package/template/src/lib/server/settings-registry.ts +29 -0
  65. package/template/src/lib/server/settings.ts +91 -0
  66. package/template/src/lib/server/smrt.ts +1 -0
  67. package/template/src/lib/settings-client.ts +1 -0
  68. package/template/src/lib/sign-out.ts +1 -19
  69. package/template/src/params/settingsSection.ts +4 -0
  70. package/template/src/routes/+layout.svelte +1 -2
  71. package/template/src/routes/+page.svelte +20 -128
  72. package/template/src/routes/settings/+page.svelte +16 -3
  73. package/template/src/routes/settings/[section=settingsSection]/+page.svelte +19 -0
  74. package/template/src/routes/settings/inference/+page.server.ts +3 -0
  75. package/template/src/routes/settings/inference/+page.svelte +6 -0
  76. package/template/src/routes/settings/prompts/+page.server.ts +50 -0
  77. package/template/src/routes/settings/prompts/+page.svelte +28 -0
  78. package/template.config.js +17 -12
  79. /package/{template → examples/notes}/src/lib/objects/Note.ts +0 -0
  80. /package/{template/src/routes → examples/notes/src/routes/notes}/+page.server.ts +0 -0
@@ -0,0 +1,724 @@
1
+ # Local cookbook host
2
+
3
+ The real-HTTP CLI fixture in `__tests__/cookbookHost.test.ts` models a compatible
4
+ app-tool host for both stream protocols: it accepts the secured flags, preflights
5
+ successfully, and calls the app MCP endpoint. Claude has built-ins absent; native
6
+ Codex 0.162.1 now enables its necessary code-mode host and confines incidental
7
+ patch/command items in disposable workspaces (inference's engine contract). The introduction assertion
8
+ uses the test's current cookbook (renamed Members plus enabled Memos), rather than
9
+ the earlier Customers-only snapshot. It still requires configured readiness and
10
+ the same full create/hold/decision/revocation behavior for both compatible stubs.
11
+
12
+ The host supports one app model registry per process. Disposable host tests
13
+ snapshot and restore it through core's public `testing` API, after streamed turns
14
+ settle and the host shuts down. Applied runtime subclasses must not leak into the
15
+ next fixture's catalog. Native CLI approval tests await the actual streamed hold;
16
+ revocation tests gate the real persisted MCP response before delivering it to the
17
+ stub. They do not depend on CLI startup completing within a polling interval.
18
+
19
+ Cookbook/app workflow results return both text content and the same object as
20
+ `structuredContent`, matching the bridge's declared object `outputSchema`.
21
+ Current Claude Code and Codex clients reject text-only successful results when
22
+ an output schema is declared. This preserves the existing recipe service result
23
+ and its policy; it adds no execution or authorization path.
24
+
25
+ Host TypeScript entry points compile from `host/` to `dist/host/`; smrt-vitest's
26
+ workspace alias table maps public TypeScript host entry points back to their authored
27
+ sources. `host/InferenceSettingsPage.svelte` is a runtime component with an
28
+ effective `svelte` export condition. Only copied scaffold files under
29
+ `./template/*` are classified as `smrt.resourceExports`; runtime components must
30
+ remain subject to the packed runtime import and Svelte-condition checks.
31
+
32
+ `@happyvertical/smrt-template-sveltekit/host/server` exports
33
+ `createCookbookHost({ runtime, root?, title?, app?, assistant?, cli?, chatgpt? })`.
34
+ Construct it beside `createSmrtSvelteKitRuntime()` before startup. It registers
35
+ inference preferences/permissions before owner seeding. Export `host.handle` and
36
+ `host.init` from the app hooks. Mount `host.load` in the layout and these handlers:
37
+
38
+ | Route | Mount |
39
+ | --- | --- |
40
+ | `/api/_runtime/owner-link` | `GET = host.ownerLink` (auto-claim, launch-secret protected) |
41
+ | `/api/assistant/[...path]` | `GET`, `POST` from `host.assistant` |
42
+ | `/mcp` | `POST = host.mcp` |
43
+ | `/api/connect-ai` | `GET`, `POST` from `host.connectAi` |
44
+ | `/api/cookbook/prebuilt` | `GET`, `POST = host.prebuilt` |
45
+
46
+ This composition supports the **local single-owner SQLite profile**. It refuses
47
+ other profiles at startup; it does not claim PostgreSQL, hosted credentials or
48
+ cross-process engine sessions. Ordinary app model migrations remain the runtime's
49
+ responsibility. Host system tables store versioned cookbook engine state, per-user
50
+ engine selection and audit. Cookbook CAS and its change audit commit in one
51
+ transaction before publishing an engine. Each authenticated request re-reads
52
+ persisted state and the existing tenant pre-built-components preference. An
53
+ unreadable store closes the live gate. Template application conservatively always
54
+ requires approval: there is no heuristic claiming a database is empty.
55
+
56
+ The composition installs core's live exposure gate and cookbook tool service.
57
+ Generated REST uses the installed gate. Assistant offerings use chat's manifest
58
+ catalog and cookbook extra tools, with the normal principal dispatcher, tool
59
+ summaries and durable runtime owner approvals. MCP projects the **actual generated
60
+ MCP descriptors**, preserving package MCP restrictions and aliases, through the
61
+ existing app-MCP principal workflow seam. Tokens are verified by app-runtime;
62
+ each call rechecks scopes and live exposure. This endpoint is stateless HTTP:
63
+ clients re-list to observe changes; it does not advertise a notification channel.
64
+ The host opts into core's `qualifyCollidingNames` over the full installed model
65
+ scope. Unrelated same-name models cannot poison the catalog or trade aliases
66
+ when recipes change; unique model aliases and qualified dispatch stay intact.
67
+ It also selects core's `snakeCaseNames` mode so protocol-valid punctuation and
68
+ qualified aliases satisfy the existing workflow adapter's stricter grammar.
69
+
70
+ Inference owns saved-key resolution, ChatGPT-plan connections, CLI detection and
71
+ subprocesses. The host supplies per-user selection and private runtime storage.
72
+ CLI credentials are scoped to the offered operation/permission intersection,
73
+ last 15 minutes and are revoked at turn completion. A bound CLI delete, when the model declares MCP delete, creates a
74
+ hold in the same chat thread; the existing assistant owner-decision route executes
75
+ the original operation once under its saved ceiling. External MCP deletes use the
76
+ shared non-thread continuation authority; pending results name their approval id
77
+ and `owner_approval_outcome`. The original caller can read the terminal result.
78
+ Settings can mount the existing AssistantApprovalCard without a thread id.
79
+
80
+ `host.inferenceSettings` is the existing inference settings controller. The app
81
+ mounts its own thin page load/actions using the signed-in session; it never adds
82
+ another key store. `host.cookbookApp(tenantId)` projects navigation through the
83
+ same gate. Only pass the trusted session tenant. Direct model URLs must resolve
84
+ an entry from that projection before rendering.
85
+
86
+ Browser layout:
87
+
88
+ ```svelte
89
+ <script lang="ts">
90
+ import { CookbookApp } from '@happyvertical/smrt-svelte/cookbook';
91
+ import { createCookbookAssistant } from '@happyvertical/smrt-template-sveltekit/host/client';
92
+ const assistantBase = createCookbookAssistant();
93
+ let { data, children } = $props();
94
+ const assistant = $derived({ ...assistantBase, introduction: data.assistantIntroduction });
95
+ </script>
96
+ <CookbookApp {...data.cookbookApp} assistant={data.session.authenticated ? assistant : undefined} embed={false} phoneTabBar>
97
+ {@render children()}
98
+ </CookbookApp>
99
+ ```
100
+
101
+ The shell owns sidebar, assistant panel, content and phone opener. The supplied
102
+ registry is also its Provider's registry; `embed` omits the assistant component
103
+ entirely. Host-selected labels remain supported.
104
+
105
+ ## Test design
106
+
107
+ All persistence cases are Node 26/in-process SQLite; external providers and
108
+ containers are excluded. Fake models and CLI fixtures are the external executors.
109
+
110
+ | Invariant / reachable trigger | Positive | Negative/failure | Actor/context and executor | Contract / level / command |
111
+ | --- | --- | --- | --- | --- |
112
+ | Gate on request | Enabled REST/MCP/nav visible | Disabled or preference off denies | Session owner/tenant, runtime-bound SQLite | HTTP and layout / integration / template test |
113
+ | Recipe activation | Assistant tool enables installed recipe, nav appears | Unknown/stale revision refused | Owner, one CAS + audit transaction before publication | Principal tool / integration / template test |
114
+ | Business records | Stub reads Customers and creates Profile + Customer | No Bot discriminator | Owner, existing manifest dispatcher/SQLite | Assistant stream / integration / template test |
115
+ | Durable delete | Pending hold, decision executes once | Deny, repeat, foreign owner/tenant, closure refuses | Captured actor/ceiling, runtime approval store and dispatcher | Decision HTTP / integration / template test |
116
+ | State restart/concurrency | Saved engine reloaded; one CAS succeeds | Failed audit rolls back cookbook; stale CAS refused | Two host state instances, same SQLite transaction | Persistence / integration / template test |
117
+ | Dock | Receives transport/registry, toggle changes visibility, phone opener | Embed mounts no assistant | Browser/jsdom, no SQL (presentation only) | CookbookApp / component / smrt-svelte test |
118
+ | Engine selection | Stored user's configured engine | Unknown/unready engine fails before authoring | Authenticated owner, inference fakes/subprocess fixture | Connect AI/chat / integration / template test |
119
+
120
+ Run each touched package's filtered dependency build, full `pnpm test` and
121
+ `pnpm typecheck`; root lint, format-check and strict knowledge check. App smoke
122
+ must additionally build, boot on a free port above 4900, owner-sign-in, make a
123
+ REST request and complete a stub turn.
124
+
125
+ ## Reuse check
126
+
127
+ MCP `review_smrt_project` inspected template-sveltekit and smrt-svelte;
128
+ `build_context` searched SvelteKit host/template composition, cookbook runtime,
129
+ MCP and assistant. The configured server has context and model inventory tools,
130
+ not separate component/recipe/intent search endpoints. Read the intent index and
131
+ searched smrt-ui, smrt-svelte, chat, core, runtime, inference, preferences and
132
+ template by names and purpose: host/composition, mountAssistantRoutes,
133
+ AssistantDock/transport/registry, cookbook state/store, engine selection,
134
+ approval/hold, MCP workflow and subclass generation.
135
+
136
+ | New production file | Reused capability / reason |
137
+ | --- | --- |
138
+ | `host/client.ts` | Existing AssistantDock, HTTP transport and data-surface registry; supplies CookbookApp's new optional composition prop. No new chat UI or transport. |
139
+ | `host/server.ts` | Existing SvelteKit runtime, core engine/gate/recipe tools, generated MCP descriptors, app-MCP route, chat mount/dispatcher/approvals/summaries, inference adapters/connection/controller and ConnectAi mount. No existing template API composed these services. |
140
+ | `host/state.ts` | Existing cookbook engine's versioned state plus SDK SQLite transactions; the template owns host lifecycle and publication. Existing browser cookbook storage is a planner draft and preferences store UI deltas, neither provides cookbook-state CAS plus audit. No domain model or parallel recipe tool. |
141
+
142
+ Test-only fixtures reuse the package Vitest harness and existing SQLite/users
143
+ collections. `assistant-fixture.svelte` only observes injected dock props.
144
+
145
+ | Additional new production file | Search and reuse |
146
+ | --- | --- |
147
+ | `host/generate.ts` | MCP host/subclass context and `rg` same-name/app-subclass/generate in core, CLI and template. Uses installed catalog, cookbook validation and the existing replacement contract; no existing cookbook command generated these customization points. |
148
+ | `host/preferences.ts` | MCP package reviews; `rg` cookbook persistence/overview/shell settings across preferences, core, template and smrt-svelte. Composes existing preference kinds, overview store, shell adapter and recipe registry. |
149
+ | `host/settings.ts` | `rg` inference settings page/controller/saveKey in template and inference. Extracts the existing template actions, preserving permission checks before reading keys. |
150
+ | `host/sveltekit-client.ts` | `rg` signOut/postSetting/logout in template, smrt-svelte and users. Publishes the existing template helpers. |
151
+ | `host/InferenceSettingsPage.svelte` | MCP template review; `rg` InferenceSettingsPanel/settings page in template and inference. Moves the existing template page to a reusable data-prop component backed by the same panel. |
152
+
153
+ `cookbookSubclasses.test.ts` is a filesystem fixture proving regeneration preserves
154
+ app edits and refuses path escapes. `cookbookHost.test.ts` reuses the inference stub
155
+ CLI, runtime principal branding, users collections and SQLite.
156
+
157
+ ## SQLite lazy host and live model publication
158
+
159
+ `createCookbookApplication({packageName, application?, lazyActivation: {manifest,
160
+ loaders, scope, alwaysOn?}, ...hostOptions})` creates the normal runtime and host.
161
+ Export its `runtime` from the app server module. Feed generated
162
+ `activationManifest`/`activationLoaders` from `smrt-register`, and opt into
163
+ `smrt({lazyActivation:true})` during generation. Its runtime preparation disables
164
+ eager full-registry schema creation and awaits the existing activation coordinator.
165
+ Boot reads the latest editor journal document for every checkpointed tenant,
166
+ falling back to that checkpoint/default only without history. It excludes only
167
+ declared custom-list identities from the fixed graph; pending journal recipes
168
+ are activated before editor replay. Host auth/chat/preferences/inference/approval models are
169
+ always on; the caller can supply an explicit always-on set. The ready gate is
170
+ composed with the cookbook/preference gate; recipe enables pass the coordinator
171
+ to the existing service before publication.
172
+
173
+ Before serving authenticated tenant data, the host opens `createAppModelEditor`
174
+ and awaits replay/publication. `host.modelEditor(trustedTenant)` is the server seam;
175
+ `modelEditorFor` supplies the landed `app.*` tools from the same service. Its
176
+ native holds own consumption; chat policy delegates those control tools instead
177
+ of creating a second hold. Publication
178
+ updates the normal cookbook engine and catalog, and supplies dynamic definitions
179
+ in layout data. The host handles those registered collection URLs with the existing
180
+ APIGenerator under session identity/permissions. Model screens merge these data
181
+ with AOT definitions, then apply the same enabled-model filter. Direct URLs retain
182
+ the gate. The core service imports recipe writes through the editor journal,
183
+ which is the durable authority. Host engine persistence is a derived checkpoint
184
+ with a monotonic revision. Custom lists and `app.*` tools remain available when
185
+ pre-built components are off; the preference still gates provider models/recipes.
186
+
187
+ Pass the projected raw cookbook to CookbookApp: it owns raw policy resolution and
188
+ uses the generated installed-recipe surface resolver. Hosts need no export map or
189
+ resolved field-policy copy. `cookbookModelCatalog` (core app-models) and
190
+ `coveredModels` (core cookbook/engine) expose existing engine projection helpers;
191
+ they do not introduce competing model-selection rules.
192
+
193
+ Non-thread native holds use the shared app-runtime continuation adapter with
194
+ executor-owned consumption. Cookbook context fingerprints remain unchanged.
195
+ Chat's existing owner list/decision routes and card handle these holds; generic
196
+ MCP deletes use continuation-owned consumption. Already executing calls do not
197
+ replay after a crash; generic external effects cannot claim transactional
198
+ exactly-once guarantees. No live provider account was used.
199
+
200
+ Follow-up reuse check repeated MCP reviews and name/purpose searches across
201
+ smrt-ui/smrt-svelte/chat/core/runtime/approvals. Existing host/server.ts and state.ts
202
+ compose activation, editor, migration tracker, engine projection and APIGenerator;
203
+ no new production file/model/component was added. The app removes its manual
204
+ surface resolver and reuses the existing owner approval card/transport.
205
+
206
+ The Profile fixture is now an empty same-name app subclass. The real customer
207
+ turn asserts exact upstream registration is absent, effective lookup returns the
208
+ app constructor, persisted create uses that app Profile discriminator (never Bot),
209
+ and Customer's JSON projects the linked Profile displayLabel. Published dynamic
210
+ definitions are cached only for editor-managed lists/fields; unchanged collections
211
+ retain their ordinary generated routes and are not duplicated in layout data.
212
+ CookbookToolError uses the existing workflow mapError contract, preserving authored
213
+ activation errors while unexpected exception details remain redacted.
214
+
215
+ The second rebase onto fcf069448e adopts C6's native journal publication path,
216
+ removing the host's former duplicate editor-import wrapper. New host tests hold
217
+ app.removeField from an assistant turn (one native hold), approve it, hold
218
+ app.removeList over MCP and recreate the host before decision. Template apply also
219
+ survives host/preview-cache recreation. An owner request resumes an approved but
220
+ unconsumed continuation after restart; executing calls remain explicit unknown
221
+ outcomes. Repeated outcome reads never replay an already completed call. MCP
222
+ control aliases reuse core's public toSnakeCase helper and preserve canonical slugs.
223
+
224
+ Publication reuses users' seedNewCatalogPermissions inside the existing embedded
225
+ transaction helper, so newly registered list operations get owner grants without
226
+ re-granting removed permissions. It runs before checkpoint publication. The host
227
+ fixture resolves permissions from the real SQLite role mappings instead of
228
+ injecting new-list scopes, and proves an old customers.create revocation stays
229
+ removed. Reuse search: MCP users package review plus rg seedNew/catalog/created
230
+ across users/runtime/core/host found this existing users upgrade API; no parallel
231
+ permission algorithm or helper is added.
232
+
233
+ ## Rebased D1 verification (Node 26.8.1)
234
+
235
+ Base: `fcf069448e6144578bee8b5bfe01165cb56ff670`. Generated knowledge was
236
+ rebuilt with the full build, OKF and graph commands, not hand-merged. Dependency
237
+ builds passed for all six changed packages (48 tasks); the full root build passed
238
+ 85 tasks. Full suites and each package typecheck passed:
239
+
240
+ | Package | Passed | Skipped |
241
+ | --- | ---: | ---: |
242
+ | core | 7016 | 513 (+4 existing todos) |
243
+ | smrt-svelte | 2052 Vitest + 5 Node + 4 conformance | 0 |
244
+ | template-sveltekit | 118 | 16 |
245
+ | chat | 1119 | 16 |
246
+ | app-runtime | 917 | 17 |
247
+ | content | 1276 | 3 |
248
+
249
+ Root lint, format-check, strict knowledge and all 87 instruction chains pass.
250
+ Knowledge retains seven existing ingestion static-surface warnings; Svelte
251
+ typecheck retains 29 warnings. Provider behavior uses fakes/stub CLIs only.
252
+ The SQLite disk-reopen continuation cases and live publication/permission tests
253
+ run in process. No container, desktop packaging or real account verification.
254
+
255
+ ## Second integration rebase
256
+
257
+ Base `437a68c806191603fe1c00032e8b1fd0f3417f81` already contains the first
258
+ eleven D1 commits. The remaining six are replayed. Conflicts preserve both legacy
259
+ and continuation approval documentation, the card's presentation/detail props
260
+ and its optional thread transport. Generated pages are rebuilt, not hand-merged.
261
+ The authority audit retains legacy TTL/input options and settled waits.
262
+
263
+ Host interaction tests parameterize the Customer/Profile assistant scenario with
264
+ omitted and explicit `createType` selecting the same-name app Profile. MCP creates
265
+ that effective app base and refuses a gated Bot or unrelated model before writes.
266
+ These extend the existing gate, STI/display-name, recipe activation, reference
267
+ picker/publication and durable approval coverage; no host-side create dispatcher
268
+ is introduced. Reuse: public ObjectRegistry create-target APIs and the existing
269
+ MCP/assistant dispatchers, found through generators.md and name/purpose searches.
270
+ All new execution cases use in-process SQLite, fake providers and existing CLI
271
+ fixtures. Tricia's suites are run unchanged as downstream compatibility evidence.
272
+
273
+ First-run onboarding: [composition and test contract](onboarding.md).
274
+ ## Apply-owned generation (D2)
275
+
276
+ `host/generate` adds `prepareCookbookHost({root?,objectsDir?,collectionAliases?})`
277
+ and `cookbookHostVite(options)`. The first composes the existing subclass,
278
+ installed-manifest, consumer aggregation, STI separation and snapshot APIs;
279
+ it writes immutable `.smrt/host-snapshots/<digest>.json` and `.smrt/host-options.json`. The second returns the normal
280
+ core preset configured with that snapshot, the installed recipe exposure
281
+ superset and `lazyActivation:true`. All provider models remain in the activation
282
+ graph; only recipe models and explicit cookbook features are hosted as routes.
283
+ User-owned feature identities do not get a second subclass.
284
+
285
+ Core's `aliasHostedCollections(manifest, aliases?, hosted?)` resolves collection
286
+ collisions in stable qualified-owner order; later owners receive a provider
287
+ prefix. Explicit model-to-collection aliases override that policy. Collection
288
+ classes follow their model. The original permission collection and storage table
289
+ stay attached. Unsafe alias segments are refused. This is host URL policy;
290
+ provider manifests are not mutated.
291
+
292
+ Mount `loadCookbookModelPage` as the model route's load and
293
+ `host/CookbookModelPage.svelte` with `data` and generated `collectionDefinitions`.
294
+ The loader composes the session, enabled cookbook entry and effective identity;
295
+ the component composes the existing RecipeScreens, entry source and reference
296
+ adapters. Dynamic definitions are merged through the same live screen gate.
297
+
298
+ The CLI's `cookbook-template/` overlay contains only ordinary app routes and
299
+ presentation plus calls to these public services. Generic profile-capable
300
+ `template/` remains the base. Local sign-in and settings use their original
301
+ runtime/controllers. No new assistant, persistence model or record CRUD exists.
302
+
303
+ D2 reuse: MCP package reviews covered CLI, core, template, profiles, commerce
304
+ and content. `build_context` searched snapshot/namespace, recipe prerequisites,
305
+ serializer defaults, source checkout and model-page composition; the intent
306
+ index and owning sources (including UI, Svelte, chat and core) were searched by
307
+ name and purpose. The configured MCP offers context/inventory tools, not
308
+ standalone component/recipe/intent search endpoints.
309
+
310
+ | New production paths | Existing implementation reused |
311
+ | --- | --- |
312
+ | `host/CookbookModelPage.svelte` | Extracted the existing product route's composition of RecipeScreens, createRecipeScreenEntry and createRecipeScreenReferences. No replacement screens or data source. |
313
+ | `cookbook-template/src/**` (route and server mounts) | Existing D1 product mounts, createCookbookApplication, preference/settings controllers, CookbookApp/SectionPage, ConnectAi and approval card. The model route mounts the extracted component/loader. |
314
+ | `cookbook-template/vite.config.ts` | New public cookbookHostVite over the existing core preset. |
315
+ | `cookbook-template/.pnpmfile.cjs` | The CLI-owned checkout hook; returns config unchanged for published installation. |
316
+ | `cli/scripts/source-checkout.cjs` | Moved the existing product checkout integration intact except enabling the published-config path. `rg SMRT_ROOT/local checkout/npm_execpath` found no existing source-link service; build forwarding reuses createPackageManagerRunner. |
317
+
318
+ New test `template-sveltekit/__tests__/cookbookApply.test.ts` uses the existing
319
+ apply engine and actual adapter Server with offline packages; it is not a new
320
+ runtime or domain helper. ProfileIdentityRecipe extends SmrtRecipe in the
321
+ existing profiles recipe file and reuses Profile/ProfileType; CustomersRecipe
322
+ requires it without importing foreign models into commerce's recipe models.
323
+
324
+ ### D2 prerequisite visibility and rebase interactions
325
+
326
+ An identity prerequisite has models and an empty `nav`; keep it in the cookbook
327
+ for activation, migrations and framework tools. Do not add its classes as
328
+ `features`: that is explicit navigation placement. The model-page loader accepts
329
+ only shell entries, so unplaced identity URLs return 404 and reference pickers
330
+ retain lookup access without linking to an invented page. Core's `app.describe`
331
+ uses the same placement boundary for assistant-facing list names.
332
+
333
+ The four applied-host proofs check active Profile/ProfileType HTTP collections,
334
+ refused identity pages, refused installed-but-disabled Leases, every list screen's
335
+ cookbook title, and sidebar/shortcut paths. Their labels must come from selected
336
+ recipe menus or cookbook layout overrides. The in-process host regression combines
337
+ same-name Profile replacement, dependency-only exposure, reference-page mapping,
338
+ durable business removal across restart and refusal of approval replay.
339
+
340
+ The integration rebase keeps its compiled-host Vitest aliases; D2's package-root
341
+ fallback was dropped. Inference settings retains integration's Svelte runtime
342
+ export alongside the new cookbook page export. Generated knowledge is rebuilt.
343
+ Reuse search: MCP review/core architecture context, the intent index, and name
344
+ and purpose searches for prerequisite/nav/features/describeApp in core, Svelte,
345
+ chat and UI found these existing projections; this follow-up adds no production
346
+ component, model, route or file. The packed-consumer fixture extends its existing
347
+ external-version map with parent-qualified selectors; its isolated pnpm regression
348
+ verifies CLI's MCP SDK 2.3.1 and app-mcp's 2.4.0 coexist without global pinning.
349
+
350
+ Packed providers retain `importPath`/version provenance when authored source files
351
+ are not shipped. Host preparation removes foreign absolute `filePath` metadata that is missing or
352
+ outside the actual installed owning package (even if a publisher checkout exists) before computing the source-root boundary; app source and existing linked
353
+ provider files still require matching digests. The subclass/snapshot fixture proves
354
+ missing or existing out-of-package publisher source is omitted, changed app source
355
+ is refused, and missing
356
+ app source is never discarded. No fallback import or verification bypass is added.
357
+
358
+ The installed-package boundary reuses core consumer-plugin's existing
359
+ `findInstalledPackageJson` resolver, now public; it follows real workspace links
360
+ without assuming published package source exists beside its compiled exports.
361
+
362
+
363
+ ## D2 onboarding integration rebase
364
+
365
+ The apply overlay opts into `onboarding: true`, mounts the existing host endpoint
366
+ and `FirstRunOnboarding`, forwards `assistantIntroduction`, hides shell chrome on
367
+ first-run screens, and exposes the existing Settings restart confirmation. Fresh
368
+ renders the shared empty state. No second onboarding authority or component exists.
369
+
370
+ The four real generated hosts exercise welcome → skip AI → Fresh → owner approval
371
+ → empty app, then Settings-style restart → their template → approval → populated
372
+ sections. Each creates a named Customer using the declared inline name/email/phone
373
+ inputs, reads the projected name, and checks readable Customer table headers rendered from its
374
+ actual generated effective web definition. Identity routes stay active while identity
375
+ navigation/screens remain absent. Existing host tests retain restart-safe holds,
376
+ live exposure, explicit/omitted STI create dispatch and reference label controls.
377
+
378
+ Reuse check: repeated MCP `review_smrt_project` and `build_context` for first-run
379
+ composition, writeThrough and display.list; read the intent index and searched
380
+ FirstRunOnboarding/createOnboardingClient/first-run/typed Customer/default columns
381
+ across UI, Svelte, chat, core and template. New scaffold files
382
+ `src/routes/onboarding/{+page.server.ts,+page.svelte}` and
383
+ `src/routes/api/onboarding/+server.ts` reuse the landed product's thin mounts of
384
+ host.onboarding and FirstRunOnboarding. They contain no new workflow/helper/model.
385
+ The existing Fresh, settings and layout mounts are extended. The packed CLI route
386
+ test includes onboarding so pnpm cannot silently omit it. Integration's authored
387
+ source aliases remain the sole Vitest host-resolution mechanism.
388
+
389
+ ## Onboarding write-through regression
390
+
391
+ `__tests__/onboardingWriteThrough.test.ts` starts with an empty cookbook and a
392
+ fresh local state root, claims an owner, completes onboarding/template approval,
393
+ and uses deferred activation with same-name app contact replacements. Each
394
+ bundled template exercises generated REST and the assistant create dispatcher
395
+ with a typed name/email and an untouched blank phone. It uses real SQLite,
396
+ sessions, permissions, approval and migration paths; only the external AI reply
397
+ and SvelteKit response helpers are substituted.
398
+
399
+ Reuse check: MCP review, the intent index and `rg` searches for onboarding, lazy
400
+ activation, cookbookHost, runtimeProfileReference, create-targets and inline
401
+ contact writes found existing host and generated-route fixtures, but none
402
+ combined fresh lazy activation with template approval and inline contact
403
+ creation. The new test composes the existing host, activation/route generators,
404
+ manifest catalog, real runtime writer lease and assistant stream reader. Its
405
+ empty Customer/Profile/ProfileType fixture subclasses reproduce the generated
406
+ app replacements; they add no production model or parallel write path.
407
+
408
+
409
+ The Q1 onboarding regression additionally starts each bundled template's contact
410
+ with name only, reads it through the generated item route, edits all contact
411
+ fields, reads projected list/detail values, clears email and phone, then checks
412
+ the refreshed list. It uses the same real owner session, template approval and
413
+ lazy activation path; it does not pre-apply a cookbook or replace REST handlers.
414
+
415
+ The CLI bridge mints scopes from its actual canonical MCP name map, intersected
416
+ with the original permission ceiling. The API catalog is larger than the package
417
+ MCP surface and must not inflate the token request (local tokens keep their
418
+ 64-scope bound). No extra scope is minted for an operation that cannot be called.
419
+ The host stub regression asserts API-only deletes are absent from that bridge;
420
+ package MCP restrictions remain in force.
421
+
422
+ Yoga Studio's Customer omits public MCP delete; the bridge never widens it.
423
+ CLI turn tokens and tool lists use the selected cookbook's existing shell
424
+ placements, so dependency-only identity models remain available to framework
425
+ lookups without being offered as model-facing lists. Same-name app replacements
426
+ are matched through the registry's qualified identity. Inline Customer contact
427
+ inputs come from the existing write-through schema and ordinary save path.
428
+
429
+ The CLI path now captures thread-bound destructive MCP calls through the same
430
+ OwnerApprovalContinuations adapter as non-thread MCP. The existing chat owner
431
+ decision route resumes them with the original argument/permission ceiling, and
432
+ the executor rechecks the live MCP offer as well as permissions before effects.
433
+ No raw delete, new dispatch authority, route or approval store is added. The
434
+ driver observes the persisted outcome; a second decision cannot execute again.
435
+ The host publishes a persisted pending hold synchronously before returning its
436
+ MCP response; only terminal states are polled. This fixes a fast-response race
437
+ that reached chat's protected-result guard before the 100 ms poll. Observers are
438
+ bound to a random turn holder as well as the original thread/user/tenant, so an
439
+ unrelated hold cannot satisfy the wait. Approval ids from model output remain
440
+ unauthoritative. The extended CLI cases failed at that guard before this fix.
441
+
442
+ The per-turn `describeTool` callback reuses chat's existing label mechanism with
443
+ the shell's selected noun/label; successful inline create therefore says
444
+ “Added member Test Person” without exposing internal Profile identities. The
445
+ introduction reports only operations common to its offered lists, and model
446
+ guidance limits claims/alternatives to each live tool schema. It cannot promise
447
+ deletion for every list merely because one exposed list supports it.
448
+
449
+ Both stub CLI host cases check inline name/email/phone creation, inherited
450
+ contact-name projection, hidden prerequisite offerings, the canonical alias
451
+ mapping, recipe vocabulary, thread-bound continuation context, foreign-owner
452
+ refusal and one delete after approval with a refused repeat. Existing explicit
453
+ STI/replacement, reference-picker and restart/permission-revocation cases remain
454
+ intact; no separate model/reference dispatcher is introduced.
455
+
456
+ Local harness setup and Settings: [plugin mode](plugin-mode.md).
457
+
458
+ ### Compiled cookbook catalog
459
+
460
+ `cookbookHostVite()` also provides `virtual:smrt-cookbook-app` (`app`). Pass that
461
+ value through the existing `createCookbookApplication({ app, ... })` seam to use
462
+ the validated build document and a slim installed catalog. The projection uses
463
+ `catalogFromManifests(manifests, true)`: recipe search/help is retained, model
464
+ schemas/methods are not. Model details still arrive through activation's deferred
465
+ data modules. Default file-based hosts remain supported. Rebuild after changing
466
+ installed recipes or the initial cookbook, as for the existing activation graph.
467
+ The preset's generated type directory receives `cookbook-host.d.ts`.
468
+
469
+ The generated module parses once and freezes its JSON records bottom-up. Both
470
+ activation preparation and host initialization share those immutable records.
471
+ Host initialization forks only its writable catalog envelope; app-model editing
472
+ continues to replace its own models array. Request/session/tenant state is not
473
+ shared through the catalog. Editable cookbook documents still use the engine's
474
+ existing independent copies, and registry schema copies remain independent.
475
+
476
+ | Behavior/invariant | Positive / negative case | Actor/context/executor/runtime/edge | Evidence |
477
+ | --- | --- | --- | --- |
478
+ | Slim catalog preserves features and recipe help | Existing catalog model selection plus optional rich projection; no object schemas in payload | Build-only installed metadata; no DB or provider requests; Node 26 + Vite public virtual module | Catalog unit suite, host generation suite and real Yoga/all-recipes harness |
479
+ | Immutable sharing preserves edits | Frozen model/array refuses direct mutation; host owns writable envelope | Separate per-tenant engine and model editor, existing transactions and permission checks unchanged | Host generation freeze test, full host model/history/approval tests |
480
+ | Unrelated modules remain untouched | Virtual resolve/load returns null for unrelated ids | Vite build/dev; no external contract | Host generation suite |
481
+
482
+ Reuse: MCP reviews for template-sveltekit/smrt-svelte and product app, the intent
483
+ index and searches by installed manifest, recipe catalog, virtual modules and
484
+ immutable metadata found `catalogFromManifests`, the host's `app` injection seam,
485
+ `prepareCookbookHost`, and the preset's generated type directory. No parallel
486
+ catalog, runtime route or provider implementation is added.
487
+
488
+ The same virtual module exports `initialApp` for the no-principal preferences
489
+ fallback. It uses `narrowCatalog` over the shared records, so resolving the initial
490
+ shell does not re-read every installed manifest. It contains only the initial
491
+ build document and no personal/request data. Person-specific preferences still
492
+ resolve `host.cookbookApp(principal.tenantId)` through the existing principal seam.
493
+
494
+ The host Vite plugin externalizes the Node-only `smrt-app-mcp` and `smrt-app-cli`
495
+ server seams. Plugin setup/config imports the CLI only inside its existing async
496
+ read/setup/connect operations, after the unchanged local-owner policy checks. This
497
+ keeps the published package responsible for resolving its SDK dependency and
498
+ preserves its deferred transport imports. Bundling a workspace-linked copy can
499
+ otherwise hoist the SDK into a shared host chunk despite dynamic imports. This
500
+ is a host packaging boundary, not an application-supplied external/alias list;
501
+ Node cookbook hosts already retain installed runtime packages. The generated
502
+ initial preferences data also preserves cookbook validation warnings.
503
+
504
+ The published-host startup test refuses CLI and MCP SDK resolution, then checks
505
+ the plugin's first-use read rejects with the original CLI import error. It fails
506
+ against the eager build. The existing real-token/SQLite/stdio plugin test still
507
+ covers setup, live tools, writes, owner decisions, revocation and secret refusal;
508
+ no auth, persistence, retry or protocol implementation is duplicated. Reuse searches
509
+ for CLI setup/config and bridge imports found `generateLocalMcpSetup`,
510
+ `saveCliConfig`, and the existing async plugin operations; no new helper is added.
511
+
512
+ ## Assistant work profiles
513
+
514
+ The host resolves owner work-profile preferences in inference for each request.
515
+ Normal owner work defaults to assist; actual assistant calls while durable
516
+ onboarding is unfinished or rerunning use design. Deterministic Fresh/template
517
+ preview and apply remain the canonical onboarding operations. An assist design
518
+ tool attempt is intercepted before execution and admitted as a durable design
519
+ job; authenticated CLI MCP calls run the same check before side effects. Each
520
+ CLI binding also checks app-tool count and pass wall time before execution.
521
+
522
+ `createInferenceSettingsPage(host.inferenceSettings,host.workProfiles)` composes
523
+ the owner quality editor into the existing settings route. Missing engine/model
524
+ catalogs leave editing/reset usable. The preferences facade preserves live owner
525
+ checks, `inference.customize` and revisions. CLI fallback memos reuse host state,
526
+ keyed by owner, engine, requested model, CLI version, connection selection
527
+ generation and work-profile preference revision. Selection changes invalidate
528
+ old memos; an external CLI account change cannot currently be detected by its
529
+ sanitized status API. ChatGPT fallback requires a verified catalog rank, which
530
+ the current SDK projection does not provide.
531
+
532
+ [Durable design runs](cookbook-design-runs.md) use inference checkpoints and the
533
+ existing TaskRunner. The host installs its executor before starting one default
534
+ queue runner; `host.shutdown()` drains the runner and disposes its executor.
535
+ Internal passes reuse authenticated assistant adapters with a private server
536
+ profile binding, original permission ceiling intersected with live permissions,
537
+ read-only tools, full schema validation, and a detached job cancellation signal.
538
+ Technical prompts and raw reasoning stay server-side. V4 and newer proposals require
539
+ separate `summary` and bounded `personSummary` fields; neither model field is
540
+ trusted as public prose. The host explicitly projects progress to short fixed
541
+ person-facing notes, including errors, repairs and reloaded state. Raw outputs
542
+ remain unchanged in durable checkpoints. Pinned v3 schemas and deterministic
543
+ Apply/recovery remain supported; the historical v2 adapter still upgrades only
544
+ to its exact v3 schema. Ready durable proposals enter a deterministic final check using
545
+ core's stable design-action identity and exact result recovery. Preview uses the
546
+ existing native thread approval UI; preview-off applies additive changes directly
547
+ with change history, while destructive changes retain approval. Completing an
548
+ approval resumes that check without another model turn. Explicit owner Resume
549
+ can safely migrate a validated ready v2 `app.addField` proposal against its
550
+ frozen historical argument schema; v1 never applies. The owner-scoped
551
+ `history(event)` read handler projects the normal `app.history` result into
552
+ browser-safe, undated entries for the existing Change history component.
553
+
554
+ The existing assistant endpoint additionally handles owner-scoped design-run
555
+ status by thread and same-origin Stop/Resume. `createCookbookAssistant` enables
556
+ this transport so tab closure leaves the job alive and reopening restores its
557
+ progress. No profile grants authority, disables owner approval, or enables CLI
558
+ built-ins. Native CLI per-call output-token limits are unavailable; their token
559
+ settings are advisory while reported usage bounds subsequent passes.
560
+
561
+ Explicit Resume adopts current owner design aggregate token/time settings while
562
+ retaining consumed usage and the pinned engine, model and pass definition. A
563
+ lowered cap may pause the same run immediately; it never resets its allowance.
564
+
565
+ The owner layout's `assistantToolCatalog` and plugin settings use one live,
566
+ principal-filtered host projection. Native cookbook definitions supply their
567
+ annotations, including `workProfile: design`; MCP preserves that presentation
568
+ hint in `_meta.workProfile`. Provider function schemas remain unchanged. This
569
+ metadata cannot select a profile or grant authority: tool arguments retain their
570
+ closed schemas, and delegated plugin tokens cannot write owner work profiles or
571
+ start host design runs. Native decisions use `OwnerApprovalContinuations` and
572
+ its canonical adapters; the design runner only schedules its deterministic
573
+ checkpoint after the recorded native outcome.
574
+
575
+ Adapter-node emits `sveltekit:shutdown` after closing HTTP connections. The host
576
+ registers one listener for that lifecycle event and drains its existing TaskRunner
577
+ through the same idempotent `shutdown()` used by tests. Shutdown waits for any
578
+ in-flight initialization, stops polling and liveness via TaskRunner's normal stop
579
+ path, and disposes the design executor. `dispose()` removes the listener with its
580
+ other synchronous registrations; callers embedding the host must await
581
+ `shutdown()` before closing their database. In-flight work can still read the
582
+ initialized host while it drains; shutdown never starts a new runner, and the
583
+ stopped host refuses subsequent startup.
584
+ If initialization failed after creating resources, shutdown still stops the
585
+ partially-started runner and removes the retained design executor. The original
586
+ initialization caller owns its error; only cleanup failures reject shutdown.
587
+ No signal handler, forced process exit, detached runner or timer unref workaround
588
+ is added. Tests use the actual runner for idle and initialization-race shutdown,
589
+ reject first initialization after the shutdown event, and clean a runner that
590
+ started before initialization failed without a second failure or exit-code change.
591
+
592
+
593
+ C4 follow-up: `/favicon.ico` redirects with public caching to the shipped
594
+ `/favicon.svg` before runtime authorization/initialization (browser requests need
595
+ no owner session). Cookbook host regression checks this conventional icon path.
596
+ OpenAI work profiles reuse inference's reviewed rankings and single-step fallback;
597
+ ChatGPT catalogs stay account-bound, and fallback memos include catalog, connection
598
+ generation and preference revision. Codex gets the same fallback-store seam as
599
+ Claude. No app-local engine, token or approval implementation is introduced.
600
+
601
+ Drive-by validation repair: onboardingWriteThrough's test fixture uses core's public
602
+ `resolveManifestPath` rather than assuming every package emits dist/manifest.json.
603
+ Products exports dist/lib/manifest.json; dropping it made all four template
604
+ activation cases fail with ContractLineItem -> Product unresolved. All original
605
+ REST/assistant write and linked-contact assertions remain. No production registry
606
+ or exposure behavior changes.
607
+
608
+ `onboardingWriteThrough.test.ts` retains the generated contact route coverage for
609
+ every bundled template. Mechanic additionally adds a field through the existing
610
+ host MCP HTTP workflow and through a three-pass design run with the native owner
611
+ approval POST. There is currently no structural field-editor UI in this product;
612
+ the MCP case exercises its existing HTTP mutation seam rather than claiming a
613
+ browser editor. Both cases start with the real generated REST fallback, then
614
+ exercise the edited dynamic URL and reopen the host over the same on-disk SQLite
615
+ app after restoring compiled registrations. This is a same-process host replay
616
+ with the existing runtime and public activation coordinator's stable scope;
617
+ the fresh host/editor/job worker retains the composed activation gate. The
618
+ runtime-owned database handles stay alive until both hosts have drained and are
619
+ closed once in final teardown. Separate-process restart belongs to the built
620
+ product browser gate. These cases preserve the same-name configured app
621
+ Customer's curated columns, API metadata, cookbook policy/exposure, original rows
622
+ and custom value. No template-host route workaround is added for a core registry
623
+ or exposure defect.
624
+
625
+ The host opts chat and its client into generic public tool presentation. Trusted
626
+ internal pass SSE retains its structured handoff; public events and thread reads
627
+ exclude internal pass rows and render legacy unmarked tool rows generically.
628
+ Approval captions come separately from bounded core editor command summaries or
629
+ the existing manifest's business noun and trusted local-client label; unsafe
630
+ identity labels, tool/package syntax and implementation captions use the fixed
631
+ review fallback. This presentation does not change the stored hold or execution
632
+ authority, and safe business previews persist after completion. Change history
633
+ retains its count/order and stable technical DTO keys, but displays human command
634
+ captions with a safe fallback and no revision labels, raw edits or invented dates.
635
+
636
+ V5 design runs begin by proposing. Without an explicit raw owner pass-count
637
+ override, checked scalar/choice/money field additions, field rename/hide and
638
+ list-label rename on one existing list can complete after one real pass. Exact
639
+ canonical descriptor identities/aliases come from normal `app.describe`; uncertain
640
+ or complex work expands to the configured maximum. Explicit pass counts remain
641
+ fixed. Private classification metadata grants no authority, and the actual proposal
642
+ index survives native holds, Stop and replacement-worker recovery without padded
643
+ outputs or reset usage. See [design runs](cookbook-design-runs.md) for boundaries.
644
+
645
+ Settings at `/settings/inference` is titled Assistant. Resolved profiles keep the
646
+ requested model; their derived `modelSelection` may show the existing remembered
647
+ downgrade. Settings and native execution share the same memo connection key:
648
+ CLI version, owner engine generation and raw work-profile revision, scoped by
649
+ tenant, owner, engine and requested model. Reading this projection neither probes
650
+ a provider nor writes a fallback, and a remembered model never becomes the key
651
+ for another fallback. Unknown model strength stays configured.
652
+
653
+ Canonical approval captions describe pending, approved and executing changes in
654
+ prospective language; successful captions and history describe completed changes.
655
+ The bounded human-caption validator preserves business labels and rejects unsafe
656
+ implementation/identity labels. Recipe and template captions reuse their canonical
657
+ catalog labels. Whole remove grammar changes to “Remove … and keep its data”;
658
+ Undo is “Reverse the last structure change” and completed history is “Reversed
659
+ the last structure change”, without promising record restoration. Stored approval
660
+ summaries, operation bindings, receipts and history commands are unchanged. Tests
661
+ cover delayed real execution through these statuses and its actual Undo/history,
662
+ as well as Settings-to-native memo selection and scope/key invalidation.
663
+
664
+ The browser assistant observes canonical approval responses through its existing
665
+ transport. Once it has seen a pending, approved or executing hold, a later
666
+ `succeeded` response refreshes application data once for that hold. A decision
667
+ response still has its existing immediate refresh; when that response is only
668
+ approved, its later completion causes a separate refresh after the effect. An
669
+ immediate succeeded decision is not refreshed again by subsequent card polls.
670
+ First-seen historical success, including after transport recreation, is inert;
671
+ terminal refusals never count as successful completion. No design-run/approval
672
+ correlation metadata, additional poller or authority is introduced. This covers
673
+ approval completion, not arbitrary preview-off run completion.
674
+
675
+ The cookbook Settings composition connects OwnerApprovalsSettings's optional
676
+ `onsettled` callback to the existing `invalidateAll`, separately from `ondecided`.
677
+ Its observer owns approval discovery and canonical status polling; whole-page
678
+ timed invalidation is unnecessary. The vanilla template Settings page remains
679
+ the section menu and has no approval composition. Client tests cover delayed
680
+ approved/executing/succeeded observations, stale responses, historical success,
681
+ transport recreation, refusal states and unchanged send/resume/decision behavior.
682
+
683
+ Native approval presentation follows the same offering source as its saved
684
+ continuation executor: plugin and thread holds use the app manifest with the
685
+ saved permission ceiling; external non-thread MCP holds use generated MCP
686
+ definitions. An app-native delete may legitimately be offered while that model's
687
+ generated MCP delete is excluded, so MCP eligibility cannot be a prerequisite
688
+ for its person-facing preview. The exact saved tool must still belong to the
689
+ continuation's allow-list. Safe business vocabulary comes from the registered
690
+ current placement/layout, and the client label from the canonical continuation;
691
+ raw stored summaries never become a native preview fallback. The plugin fixture
692
+ retains its original MCP-enabled case and separately covers API-only native delete
693
+ through a real delegated token, pending and succeeded owner-list captions, one
694
+ actual deletion and unchanged ledger summary.
695
+
696
+ One private same-file placement resolver supplies registered identity matching
697
+ and layout/noun precedence to the manifest, generated MCP and native approval
698
+ presentation paths. An unknown qualified identity returns no placement before
699
+ entry matching, so two missing registrations cannot match through undefined
700
+ values. A retained hold for an unavailable model stays a generic review caption;
701
+ the owning plugin fixture checks this without executing or approving that hold.
702
+
703
+ ## S1 assistant safety composition
704
+
705
+ The existing work-profile facade stores per-app owner safety choices. Reads report editability only for a verified owner session; writes/reset require that session, live owner membership and revision checks, and protection-off requires explicit confirmation. No tool exposes these settings. Both the built-in chat policy and native/model MCP dispatch read the same removal preference. Only a short-lived token bound to this host's actual thread may opt out; outside MCP/plugin/local tokens always hold. Purges stay held. Only canonical single-record deletes from placed app-data lists receive trusted `recordDeletion` metadata; chat refuses that waiver for security/control identities and sensitive models. Native cookbook services always hold structure removals, undo and recipe disable, independently of both owner settings; design preview remains independent for non-removal changes. There is no host-side structural waiver or duplicate downstream check. Existing CRUD/audit execution is retained. CLI protection reaches turn specs and the same mode-specific readiness preflight; it never alters credential or cancellation boundaries.
706
+
707
+ Reuse check: smrt-dev-mcp reviews and purpose/name searches covered app-runtime, chat, core, inference, preferences, smrt-svelte, template-sveltekit and app-shell, plus `docs/knowledge/intents/index.md`. No new production files/components/helpers were introduced. Extended the existing work-profile types/facade, approval policy/authority, CLI specs/parsers/preflight, failure reporter/redactor, runtime cookie, ConnectAi route/client and UI primitives.
708
+
709
+ In-flight removal settings: the MCP boundary honors both the current owner preference and the running turn's existing `requiresApproval` gate. Tightening can add a hold immediately; relaxing never waives a hold already bound to that request. This prevents an effect from running and then being rejected by result authoring. CLI host tests flip the preference just before MCP execution and still require the original owner decision exactly once.
710
+
711
+ The browser gate accepts `SMRT_BROWSER_TEST_PORT` to reserve an assigned loopback port. Installed Chrome is supported through `PLAYWRIGHT_CHROMIUM_EXECUTABLE_PATH`; this worker used port 4969.
712
+
713
+ The shared prepack script verifies and reuses prepared CI artifacts without
714
+ building dependency closures. Outside CI it builds and verifies the host itself;
715
+ its dependencies must already be built. The real CLI/template tarball tests build
716
+ both closures in `test.before`. Release shards restore `dist` without `.turbo`;
717
+ packing preserves the prepared exports and all dependency artifacts.
718
+
719
+ The bundled-template integration fixtures declare commerce, inventory and events
720
+ as test dependencies, so a template-only dependency build includes their real
721
+ recipe manifests. The lazy onboarding fixture links only this declared runtime
722
+ closure, using the desktop build script's existing `readWorkspacePackages` /
723
+ `workspaceClosure` functions. It must not link every workspace package: doing
724
+ so makes unrelated, unbuilt activation imports a prerequisite for M5.