@happyvertical/smrt-svelte 0.60.18 → 0.61.0

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 (211) hide show
  1. package/AGENTS.md +6 -0
  2. package/agents/components.md +15 -0
  3. package/agents/connect-ai.md +180 -0
  4. package/agents/cookbook-shell.md +173 -6
  5. package/agents/import-export.md +10 -0
  6. package/agents/screens.md +233 -12
  7. package/agents/settings.md +84 -0
  8. package/agents/testing.md +6 -0
  9. package/agents/workspace.md +64 -1
  10. package/dist/components/app/AppShell.svelte +220 -7
  11. package/dist/components/app/AppShell.svelte.d.ts +49 -3
  12. package/dist/components/app/AppShell.svelte.d.ts.map +1 -1
  13. package/dist/components/app/OwnerSetupForm.svelte +5 -3
  14. package/dist/components/app/OwnerSetupForm.svelte.d.ts.map +1 -1
  15. package/dist/components/app/PhoneTabBar.svelte +28 -1
  16. package/dist/components/app/PhoneTabBar.svelte.d.ts +10 -0
  17. package/dist/components/app/PhoneTabBar.svelte.d.ts.map +1 -1
  18. package/dist/components/app/ShellAccountMenu.svelte +46 -0
  19. package/dist/components/app/ShellAccountMenu.svelte.d.ts +13 -0
  20. package/dist/components/app/ShellAccountMenu.svelte.d.ts.map +1 -0
  21. package/dist/components/app/ShellSettingsPage.svelte +119 -4
  22. package/dist/components/app/ShellSettingsPage.svelte.d.ts +18 -0
  23. package/dist/components/app/ShellSettingsPage.svelte.d.ts.map +1 -1
  24. package/dist/components/app/index.d.ts +3 -2
  25. package/dist/components/app/index.d.ts.map +1 -1
  26. package/dist/components/app/index.js +1 -1
  27. package/dist/components/app/owner-setup-types.d.ts +1 -0
  28. package/dist/components/app/owner-setup-types.d.ts.map +1 -1
  29. package/dist/components/app/settings-menu-item.d.ts +8 -0
  30. package/dist/components/app/settings-menu-item.d.ts.map +1 -0
  31. package/dist/components/app/settings-menu-item.js +1 -0
  32. package/dist/components/app/slot-item.d.ts +53 -0
  33. package/dist/components/app/slot-item.d.ts.map +1 -1
  34. package/dist/components/audit/RecordHistory.svelte +30 -22
  35. package/dist/components/audit/RecordHistory.svelte.d.ts +31 -10
  36. package/dist/components/audit/RecordHistory.svelte.d.ts.map +1 -1
  37. package/dist/components/audit/index.d.ts +1 -1
  38. package/dist/components/audit/index.d.ts.map +1 -1
  39. package/dist/components/audit/types.d.ts +12 -6
  40. package/dist/components/audit/types.d.ts.map +1 -1
  41. package/dist/components/connect-ai/ConnectAi.svelte +584 -0
  42. package/dist/components/connect-ai/ConnectAi.svelte.d.ts +23 -0
  43. package/dist/components/connect-ai/ConnectAi.svelte.d.ts.map +1 -0
  44. package/dist/components/connect-ai/client.d.ts +68 -0
  45. package/dist/components/connect-ai/client.d.ts.map +1 -0
  46. package/dist/components/connect-ai/client.js +121 -0
  47. package/dist/components/connect-ai/index.d.ts +4 -0
  48. package/dist/components/connect-ai/index.d.ts.map +1 -0
  49. package/dist/components/connect-ai/index.js +2 -0
  50. package/dist/components/connect-ai/server.d.ts +33 -0
  51. package/dist/components/connect-ai/server.d.ts.map +1 -0
  52. package/dist/components/connect-ai/server.js +190 -0
  53. package/dist/components/connect-ai/types.d.ts +48 -0
  54. package/dist/components/connect-ai/types.d.ts.map +1 -0
  55. package/dist/components/connect-ai/types.js +1 -0
  56. package/dist/components/cookbook/CookbookApp.svelte +84 -5
  57. package/dist/components/cookbook/CookbookApp.svelte.d.ts +1 -1
  58. package/dist/components/cookbook/CookbookApp.svelte.d.ts.map +1 -1
  59. package/dist/components/cookbook/app-props.d.ts +65 -0
  60. package/dist/components/cookbook/app-props.d.ts.map +1 -0
  61. package/dist/components/cookbook/app-props.js +1 -0
  62. package/dist/components/cookbook/build.d.ts +3 -0
  63. package/dist/components/cookbook/build.d.ts.map +1 -1
  64. package/dist/components/cookbook/build.js +92 -8
  65. package/dist/components/cookbook/catalog.d.ts +2 -1
  66. package/dist/components/cookbook/catalog.d.ts.map +1 -1
  67. package/dist/components/cookbook/catalog.js +5 -2
  68. package/dist/components/cookbook/context.d.ts +6 -0
  69. package/dist/components/cookbook/context.d.ts.map +1 -1
  70. package/dist/components/cookbook/index.d.ts +2 -1
  71. package/dist/components/cookbook/index.d.ts.map +1 -1
  72. package/dist/components/cookbook/index.js +1 -1
  73. package/dist/components/cookbook/registry.d.ts +3 -0
  74. package/dist/components/cookbook/registry.d.ts.map +1 -1
  75. package/dist/components/cookbook/registry.js +5 -0
  76. package/dist/components/cookbook/server.d.ts +1 -0
  77. package/dist/components/cookbook/server.d.ts.map +1 -1
  78. package/dist/components/cookbook/surfaces.d.ts +14 -0
  79. package/dist/components/cookbook/surfaces.d.ts.map +1 -0
  80. package/dist/components/cookbook/surfaces.js +6 -0
  81. package/dist/components/cookbook/types.d.ts +0 -28
  82. package/dist/components/cookbook/types.d.ts.map +1 -1
  83. package/dist/components/import-export/ImportExport.svelte +21 -2
  84. package/dist/components/import-export/ImportExport.svelte.d.ts.map +1 -1
  85. package/dist/components/import-export/fields.d.ts +1 -0
  86. package/dist/components/import-export/fields.d.ts.map +1 -1
  87. package/dist/components/import-export/fields.js +8 -3
  88. package/dist/components/import-export/props.d.ts +5 -1
  89. package/dist/components/import-export/props.d.ts.map +1 -1
  90. package/dist/components/onboarding/FirstRunOnboarding.svelte +249 -0
  91. package/dist/components/onboarding/FirstRunOnboarding.svelte.d.ts +21 -0
  92. package/dist/components/onboarding/FirstRunOnboarding.svelte.d.ts.map +1 -0
  93. package/dist/components/onboarding/OnboardingAssistant.svelte +82 -0
  94. package/dist/components/onboarding/OnboardingAssistant.svelte.d.ts +19 -0
  95. package/dist/components/onboarding/OnboardingAssistant.svelte.d.ts.map +1 -0
  96. package/dist/components/onboarding/client.d.ts +7 -0
  97. package/dist/components/onboarding/client.d.ts.map +1 -0
  98. package/dist/components/onboarding/client.js +26 -0
  99. package/dist/components/onboarding/index.d.ts +5 -0
  100. package/dist/components/onboarding/index.d.ts.map +1 -0
  101. package/dist/components/onboarding/index.js +3 -0
  102. package/dist/components/onboarding/types.d.ts +38 -0
  103. package/dist/components/onboarding/types.d.ts.map +1 -0
  104. package/dist/components/onboarding/types.js +1 -0
  105. package/dist/components/overview/recipe-widgets.d.ts +2 -18
  106. package/dist/components/overview/recipe-widgets.d.ts.map +1 -1
  107. package/dist/components/overview/recipe-widgets.js +14 -14
  108. package/dist/components/screens/DetailScreen.svelte +40 -16
  109. package/dist/components/screens/DetailScreen.svelte.d.ts.map +1 -1
  110. package/dist/components/screens/EditForm.svelte +83 -18
  111. package/dist/components/screens/EditForm.svelte.d.ts.map +1 -1
  112. package/dist/components/screens/ListScreen.svelte +35 -9
  113. package/dist/components/screens/ListScreen.svelte.d.ts.map +1 -1
  114. package/dist/components/screens/RecipeScreens.svelte +78 -6
  115. package/dist/components/screens/RecipeScreens.svelte.d.ts +2 -1
  116. package/dist/components/screens/RecipeScreens.svelte.d.ts.map +1 -1
  117. package/dist/components/screens/RecordHeader.svelte +18 -4
  118. package/dist/components/screens/RecordHeader.svelte.d.ts +2 -1
  119. package/dist/components/screens/RecordHeader.svelte.d.ts.map +1 -1
  120. package/dist/components/screens/RecordScreen.svelte +22 -3
  121. package/dist/components/screens/RecordScreen.svelte.d.ts.map +1 -1
  122. package/dist/components/screens/ReferencePicker.svelte +103 -0
  123. package/dist/components/screens/ReferencePicker.svelte.d.ts +12 -0
  124. package/dist/components/screens/ReferencePicker.svelte.d.ts.map +1 -0
  125. package/dist/components/screens/fields.d.ts +6 -14
  126. package/dist/components/screens/fields.d.ts.map +1 -1
  127. package/dist/components/screens/fields.js +67 -10
  128. package/dist/components/screens/index.d.ts +3 -1
  129. package/dist/components/screens/index.d.ts.map +1 -1
  130. package/dist/components/screens/index.js +2 -0
  131. package/dist/components/screens/reference-labels.svelte.d.ts +11 -0
  132. package/dist/components/screens/reference-labels.svelte.d.ts.map +1 -0
  133. package/dist/components/screens/reference-labels.svelte.js +50 -0
  134. package/dist/components/screens/references.d.ts +6 -0
  135. package/dist/components/screens/references.d.ts.map +1 -0
  136. package/dist/components/screens/references.js +26 -0
  137. package/dist/components/screens/relations.d.ts +3 -1
  138. package/dist/components/screens/relations.d.ts.map +1 -1
  139. package/dist/components/screens/relations.js +4 -3
  140. package/dist/components/screens/roles.d.ts.map +1 -1
  141. package/dist/components/screens/roles.js +3 -2
  142. package/dist/components/screens/source.d.ts +37 -0
  143. package/dist/components/screens/source.d.ts.map +1 -0
  144. package/dist/components/screens/source.js +96 -0
  145. package/dist/components/screens/types.d.ts +63 -2
  146. package/dist/components/screens/types.d.ts.map +1 -1
  147. package/dist/components/screens/values.d.ts.map +1 -1
  148. package/dist/components/screens/values.js +5 -0
  149. package/dist/components/settings/OwnerApprovalsSettings.svelte +169 -0
  150. package/dist/components/settings/OwnerApprovalsSettings.svelte.d.ts +13 -0
  151. package/dist/components/settings/OwnerApprovalsSettings.svelte.d.ts.map +1 -0
  152. package/dist/components/settings/PrebuiltComponentsSettings.svelte +83 -0
  153. package/dist/components/settings/PrebuiltComponentsSettings.svelte.d.ts +14 -0
  154. package/dist/components/settings/PrebuiltComponentsSettings.svelte.d.ts.map +1 -0
  155. package/dist/components/settings/WorkProfileSettings.svelte +250 -0
  156. package/dist/components/settings/WorkProfileSettings.svelte.d.ts +22 -0
  157. package/dist/components/settings/WorkProfileSettings.svelte.d.ts.map +1 -0
  158. package/dist/components/settings/index.d.ts +3 -0
  159. package/dist/components/settings/index.d.ts.map +1 -1
  160. package/dist/components/settings/index.js +3 -0
  161. package/dist/components/workspace/admin-shell/AdminShell.svelte +186 -18
  162. package/dist/components/workspace/admin-shell/AdminShell.svelte.d.ts +26 -1
  163. package/dist/components/workspace/admin-shell/AdminShell.svelte.d.ts.map +1 -1
  164. package/dist/components/workspace/admin-shell/ShellSettingsPanel.svelte +18 -3
  165. package/dist/components/workspace/admin-shell/ShellSettingsPanel.svelte.d.ts +6 -0
  166. package/dist/components/workspace/admin-shell/ShellSettingsPanel.svelte.d.ts.map +1 -1
  167. package/dist/components/workspace/admin-shell/WorkspaceAccountMenu.svelte +89 -5
  168. package/dist/components/workspace/admin-shell/WorkspaceAccountMenu.svelte.d.ts +7 -1
  169. package/dist/components/workspace/admin-shell/WorkspaceAccountMenu.svelte.d.ts.map +1 -1
  170. package/dist/components/workspace/admin-shell/layout.d.ts +4 -0
  171. package/dist/components/workspace/admin-shell/layout.d.ts.map +1 -1
  172. package/dist/components/workspace/admin-shell/layout.js +17 -4
  173. package/dist/components/workspace/admin-shell/settings-delta.d.ts.map +1 -1
  174. package/dist/components/workspace/admin-shell/settings-delta.js +4 -3
  175. package/dist/components/workspace/admin-shell/settings-sections.d.ts +10 -0
  176. package/dist/components/workspace/admin-shell/settings-sections.d.ts.map +1 -0
  177. package/dist/components/workspace/admin-shell/settings-sections.js +16 -0
  178. package/dist/components/workspace/admin-shell/settings.d.ts +7 -0
  179. package/dist/components/workspace/admin-shell/settings.d.ts.map +1 -1
  180. package/dist/components/workspace/admin-shell/settings.js +26 -0
  181. package/dist/components/workspace/admin-shell/shell-icons.d.ts +4 -0
  182. package/dist/components/workspace/admin-shell/shell-icons.d.ts.map +1 -1
  183. package/dist/components/workspace/admin-shell/shell-icons.js +4 -0
  184. package/dist/components/workspace/admin-shell/state.svelte.d.ts +13 -5
  185. package/dist/components/workspace/admin-shell/state.svelte.d.ts.map +1 -1
  186. package/dist/components/workspace/admin-shell/state.svelte.js +37 -2
  187. package/dist/components/workspace/admin-shell/types.d.ts +32 -1
  188. package/dist/components/workspace/admin-shell/types.d.ts.map +1 -1
  189. package/dist/components/workspace/index.d.ts +3 -2
  190. package/dist/components/workspace/index.d.ts.map +1 -1
  191. package/dist/components/workspace/index.js +2 -1
  192. package/dist/i18n/server.d.ts +2 -0
  193. package/dist/i18n/server.d.ts.map +1 -1
  194. package/dist/i18n/server.js +2 -0
  195. package/dist/i18n/strings.connect-ai.d.ts +57 -0
  196. package/dist/i18n/strings.connect-ai.d.ts.map +1 -0
  197. package/dist/i18n/strings.connect-ai.js +57 -0
  198. package/dist/i18n/strings.onboarding.d.ts +51 -0
  199. package/dist/i18n/strings.onboarding.d.ts.map +1 -0
  200. package/dist/i18n/strings.onboarding.js +51 -0
  201. package/dist/i18n/strings.screens.d.ts +12 -0
  202. package/dist/i18n/strings.screens.d.ts.map +1 -1
  203. package/dist/i18n/strings.screens.js +13 -1
  204. package/dist/i18n/strings.settings.d.ts +2 -0
  205. package/dist/i18n/strings.settings.d.ts.map +1 -1
  206. package/dist/i18n/strings.settings.js +2 -0
  207. package/dist/i18n/strings.workspace.d.ts +14 -0
  208. package/dist/i18n/strings.workspace.d.ts.map +1 -1
  209. package/dist/i18n/strings.workspace.js +15 -1
  210. package/dist/smrt-knowledge.okf.md +21 -10
  211. package/package.json +46 -17
package/AGENTS.md CHANGED
@@ -242,8 +242,14 @@ for a data-surface one — for exactly the component's lifetime.
242
242
 
243
243
  ## Dependencies
244
244
 
245
+ - Cookbook policy and surface integration: [agents/cookbook-shell.md](agents/cookbook-shell.md).
245
246
  - `@happyvertical/smrt-types` (shared types) — includes the identity data contracts (`User`, `Role`, `Membership`, `Tenant`) the role/membership components type against, so no dependency on `smrt-users` / `smrt-profiles` is needed
246
247
  - `@happyvertical/smrt-ui` (UI runtime: primitives, theme system, i18n client, module registry) is a hard `dependency`. The agent-admin shells that used to type against `@happyvertical/smrt-agents/ui` moved to `@happyvertical/smrt-agents/svelte` (#1589), so `smrt-agents` is no longer a dependency here — this drops smrt-svelte below smrt-agents in the package DAG.
247
248
  - `@happyvertical/smrt-languages` is a hard `dependency` (not an optional peer): the Node-only `/i18n/server` subpath imports its resolver. The browser bundle still excludes it — the client `/i18n` layer never imports the languages root, so it tree-shakes out.
248
249
  - `@happyvertical/logger` (SDK) is a `dependency` for voice/AI error reporting in the form components. Consume it **only** through `src/internal/logger.ts`, never `createLogger()` at module scope: it reads `process.env`, which throws `ReferenceError` in the browser under `vite dev` and kills hydration. The wrapper builds the logger lazily and falls back to a bare `ConsoleLogger`.
249
250
  - Peer (all optional): `svelte` >=5.18.2, plus the browser-AI engines (`@happyvertical/speech`, `@huggingface/transformers`, `@mlc-ai/web-llm`, `@remotion/whisper-web`) and `chrono-node`.
251
+
252
+ ## Connect AI
253
+
254
+ Reusable onboarding/settings `./connect-ai` and authenticated `./connect-ai/server`
255
+ mount over inference engine APIs: [agents/connect-ai.md](agents/connect-ai.md).
@@ -115,3 +115,18 @@ Escape at the document level wherever focus is (returns focus to the trigger),
115
115
  and activating a notice link (closes without refocusing, so navigation keeps
116
116
  focus). Notice titles are links styled in `--smrt-color-primary` with an
117
117
  underline, not the browser default (#4567).
118
+
119
+ `RecordHistory` also accepts `UndatedHistoryEntry` for authorized host journals
120
+ without timestamp provenance. This is separate from `AuditHistoryEntry`, which
121
+ still requires a real `occurredAt` and `profileId`; `AuditList` remains dated.
122
+ Its generic presentation callbacks retain the dated audit type by default. A
123
+ list containing undated entries preserves the supplied host order and renders
124
+ no date for those rows. Omit unknown actors rather than inventing an identity.
125
+ The component still escapes summaries, labels and changed values and never
126
+ fetches, authorizes or restores a journal entry.
127
+
128
+ The cookbook host's read-only `history(event)` projects normal owner-authorized
129
+ `app.history` into this presentation shape. Consumer settings can load that method
130
+ server-side and mount the existing `RecordHistory` with label `Change history`;
131
+ a thin GET route may expose the same projection. This adds no consumer authority,
132
+ raw cookbook payload, timestamp, or promise of data restoration.
@@ -0,0 +1,180 @@
1
+ # Connect AI (`./connect-ai`, `./connect-ai/server`)
2
+
3
+ `tool_host_policy` is an inference startup failure, not a signed-out state.
4
+ Connect AI shows its translated app-only-tools incompatibility, suppresses ready
5
+ and In use, and offers Check again. It never enables the CLI's built-in tools.
6
+
7
+ CLI readiness requires `ready === true` from inference's startup preflight,
8
+ not merely installed/signed-in or a stale top-level `configured` snapshot.
9
+ Both presentations and the onboarding `onchange` gate use this same condition.
10
+ Each engine is missing, signed out/unknown, installed-but-unusable with its fixed
11
+ reason, or preflighted ready. Only the last may say In use / assistant ready.
12
+ The native Codex compatibility/options evidence lives in inference's
13
+ [engine contract](../../inference/agents/engines.md#codex-01621-compatibility-evidence-and-owner-options).
14
+ Mounted tests refuse absent preflight even when `configured: true`; existing
15
+ positive sign-in fixtures explicitly complete preflight before selection.
16
+ Both presentations call that final state “Ready in this app”; compact hosts
17
+ retain the validated CLI version in the translated ready message. Installed and
18
+ signed-in alone is never the final readiness claim. Tricia delegates its state
19
+ GET to the shared route helper and supplements only host presentation metadata.
20
+
21
+ `ConnectAi` is a Provider-free, Svelte 5 onboarding step or settings panel. It
22
+ composes smrt-ui Button/Card/Badge and translated `ui.connect_ai.*` messages,
23
+ with token-only styling, heading/region names, live status, accessible errors,
24
+ external-link announcements and keyboard controls. It uses plain product names.
25
+ `variant="onboarding" | "settings"` shares the same engine policy; `onchange`
26
+ reports the selected engine's readiness to the host's next-step button.
27
+
28
+ ```svelte
29
+ <script lang="ts">
30
+ import { ConnectAi, createConnectAiClient } from '@happyvertical/smrt-svelte/connect-ai';
31
+ const client = createConnectAiClient({ endpoint: '/api/connect-ai' });
32
+ </script>
33
+ <ConnectAi {client} apiKeyHref="/settings/inference" />
34
+ ```
35
+
36
+ `apiKeyHref` points to the host's existing inference settings panel/controller
37
+ (`@happyvertical/smrt-inference/svelte`, `createInferenceSettingsController`).
38
+ That surface owns provider choice, key entry, origin binding and smrt-secrets
39
+ storage. Connect AI receives only `apiReady`; there is no second key form or
40
+ key storage API. Returning from settings/focusing the page refreshes status.
41
+ The component never reads or renders tokens, account credentials or upstream
42
+ errors. It translates fixed errors and only renders an inference-validated
43
+ ChatGPT authorization link, with another browser protocol/host guard. Installation
44
+ URLs come from inference's canonical CLI metadata. The existing `safeHref` guard
45
+ is reused for ordinary links.
46
+
47
+ A server route exports `mountConnectAiRoutes({ authorize, openBrowser? })`'s
48
+ `GET` and `POST`. `authorize(event)` is REQUIRED on every request/poll and must
49
+ verify authenticated owner, active tenant and settings permissions before returning
50
+ `ConnectAiServerBinding` (or `null` to refuse). It supplies the CURRENT principal's
51
+ stored `engine` read/`select` write, CLI service, ChatGPT connection and API status
52
+ resolver. Nothing binds a process-wide user. Pass the same stored preference to
53
+ chat's `createInferenceAssistantAdapters`; no engine preference schema is added.
54
+
55
+ GET projects a key-free `ConnectAiState` using inference's `inferenceEngineStatus`,
56
+ `createAgentCliService` status and login snapshots, connection status and host API
57
+ resolution. POST accepts `connect`, `select`, `chatgpt-start`, `chatgpt-sign-out`.
58
+ It enforces exact same-origin JSON, bounded bodies, known actions/engine/tool
59
+ values and live readiness before saving a selection. Every response is no-store.
60
+ Failures return fixed codes, never caught error text. Hosts supply their canonical
61
+ preference store; route code does not create model schema or write SQL.
62
+
63
+ CLI sign-in starts only the installed vendor CLI's OWN login. Unknown auth state
64
+ is a retry, not a login attempt. No in-app Claude subscription login is offered,
65
+ no CLI credential files/keychain are read or proxied, and ChatGPT is an opt-in
66
+ preview billed separately from an API key. The published preview limitations
67
+ link and legal note remain visible. ChatGPT sign-out leaves the selected engine
68
+ unconfigured; it never silently selects another billing path.
69
+
70
+ Desktop hosts may use inference's `openSystemBrowser` as `openBrowser`; the URL
71
+ is checked by `isChatGPTAuthorizationUrl` before opening. Without it, a normal
72
+ new-tab link is returned. The component polls only while sign-in is running,
73
+ refreshes on focus, serializes its requests and aborts/reclaims the timer and
74
+ listener on unmount. Hosts can supply `initialState` from a load function and
75
+ an injected client for tests/other authenticated transports. Browser entries
76
+ import inference contracts as types only; Node APIs stay on `./connect-ai/server`.
77
+
78
+ ## Validation design
79
+
80
+ Tests use the package's jsdom harness on Node, fake connection/API states and
81
+ inference's vendor CLI fixtures; no real credentials, vendor login, containers,
82
+ database schema or new SQL dialect contract is introduced.
83
+
84
+ | Behavior/invariant | Trigger | Positive | Failure | Actor/context | Executor/transaction | Runtime/dialect | Edge | Level | Command |
85
+ | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |
86
+ | Connection states | Mount onboarding/settings | Missing, installed signed-out/signed-in, key saved, readiness | Sign-in/status errors translated; unknown CLI retry | Host-authenticated user's snapshot | N/A: props/status only | jsdom/Node; no SQL | Inference status DTO | Component + axe | smrt-svelte test |
87
+ | Sign-in and polling | Human connect/select/sign-out | Real fixture vendor CLI login; fake plan start/poll/select | Missing tool, unready engine, upstream failure, foreign URL | Current owner/tenant via authorize | Existing host preference callback; no new transaction | Node subprocess/jsdom | Inference CLI/connection APIs | Route/component | smrt-svelte test |
88
+ | Authorization/CSRF | Status/action request | Current host binding used per request | Denied host, foreign origin, oversized/malformed/unknown action refused before mutation | Authorized versus denied owner/tenant binding | Host owns authorization and persistence | jsdom/Node; no SQL | Same-origin Fetch handler | Route | smrt-svelte test |
89
+ | Credential hygiene/lifecycle | Failure/unmount | No-store, bounded key-free projection, abort and timer cleanup | SDK/account/key text omitted; hostile URL refused | Authenticated browser | N/A: no credential persistence here | jsdom/Node | Browser/server transport | Unit/component | smrt-svelte test |
90
+
91
+ ## Reuse check
92
+
93
+ MCP `review_smrt_project` reviewed chat and smrt-svelte; `build_context` architecture
94
+ query searched tool descriptions, engine adapters and Connect AI composition.
95
+ The configured server has architecture/model listings, no standalone component,
96
+ intent or recipe search. Read `docs/knowledge/intents/index.md` (AI, secrets, local
97
+ credentials, auth, approvals) and used `rg` by name AND purpose in smrt-ui,
98
+ smrt-svelte, chat, core, inference and app-shell: `ConnectAi`, `connect AI`,
99
+ `onboarding`, settings/status/sign-in/poll, API key, safe href and recipes.
100
+
101
+ | Introduced production file | Existing capability reused / why no existing file fits |
102
+ | --- | --- |
103
+ | `components/connect-ai/ConnectAi.svelte` | Ports shell's engine-connection composition to the owning shared Svelte layer; adopts smrt-ui primitives, i18n, safeHref and inference DTOs. Existing OwnerSetupForm creates the app owner, and InferenceSettingsPanel edits bindings/keys; neither composes vendor CLI and ChatGPT sign-in. No duplicate primitive or key form. |
104
+ | `components/connect-ai/client.ts` | Framework-neutral thin transport over the server mount, adapted from shell's onboarding client. No other shared transport provides these connection actions; no SvelteKit `$app` or shell global dependencies. |
105
+ | `components/connect-ai/server.ts` | Reuses inferenceEngineStatus, createAgentCliService, canonical CLI metadata, ChatGPTPlanConnection and URL validator. Shell mount is owner/model/runtime-specific; existing inference settings controller is reused for key saving but has no vendor CLI/plan action routes. Host authorizer/preference store remain external. Bounded JSON handling is local to this small Fetch route, not a new general HTTP layer. |
106
+ | `components/connect-ai/types.ts` | UI projection derives engine/tool/plan contracts from inference, with key-free fields only. Existing inference settings view types concern tiers/keys, not CLI/plan connection status. |
107
+ | `components/connect-ai/index.ts`, `i18n/strings.connect-ai.ts` | Export/catalog glue following existing package patterns; server snapshot builder registers the catalog. No model, recipe or MCP tool added. |
108
+
109
+ Tests reuse the established Svelte testing/axe harness and inference's
110
+ `installFakeCli`/`fakeDeps` fixtures. New helpers are test-local status fixtures
111
+ and request builders. Package DAG check confirms both new inference edges remain
112
+ acyclic. MCP's existing dependency/UI heuristic findings are not new copies.
113
+
114
+ ## Integration exposure boundary
115
+
116
+ Connection setup is independent of cookbook model exposure and reference picker
117
+ sources. A tenant with no enabled models must still be able to connect AI before
118
+ onboarding creates its model offerings. The route regression installs a closed
119
+ core gate, verifies API readiness and selection, and proves no model exposure
120
+ lookup is used. No screen, picker, or cookbook module is changed.
121
+
122
+ Saved-product hosts can opt into `presentation="compact"` for the original
123
+ Tricia visual layout: ordered connection options, account/version
124
+ text is optional host-projected data, and a login started here selects its
125
+ engine after completion. Optional client `modelState`/`chooseModel` methods
126
+ connect the settings-only model picker to the host's existing preference.
127
+ Both presentations use the same serialized request/poll/abort lifecycle.
128
+ `./connect-ai/client` exposes the browser-safe transport and pure presentation
129
+ functions without importing a Svelte component (Node adapter tests can use it).
130
+ The route mount's `allowUnconfiguredApiSelection` and
131
+ `includeSignOutConfirmation` options preserve older host contracts; both default
132
+ false. Fresh/Skip, saved model validation and a sign-out fallback preference
133
+ remain host policy. No new key form, credential store, model or route file.
134
+
135
+ Compact host clients may additionally supply `connectOutcome` for their existing
136
+ ready/login/missing DTO and `errorMessage` to project fixed key-free errors. The
137
+ ordinary `connect(): Promise<void>` contract and default error policy stay
138
+ unchanged. Tricia uses these hooks for a CLI removed between status and click.
139
+
140
+ `./onboarding` composes this step with durable template selection; see
141
+ [host first-run contract](../../template-sveltekit/agents/onboarding.md).
142
+
143
+ An enclosing wizard may pass `headingId` to reference its existing heading.
144
+ The standard step then omits its own heading and keeps its labelled region;
145
+ standalone/settings and compact presentations retain their existing defaults.
146
+
147
+ ## Startup readiness
148
+
149
+ Inference CLI status now carries optional `ready` and fixed-vocabulary
150
+ `startError`. Signed-in status alone never overrides a failed startup probe.
151
+ The probe starts the exact locked invocation with `--help` in a private empty
152
+ working directory, in the same sanitized process environment; it performs no
153
+ model request or credential mint. The existing 15-second detection cache owns
154
+ its lifetime. Connect AI projects only these safe fields and translates specific
155
+ runtime, invocation and directory failures; it neither renders provider output
156
+ nor offers a ready selection when the probe fails. The mounted tests cover all
157
+ three failures and accessible presentation. No new component/helper file.
158
+
159
+ ## OpenAI route ordering and first-run follow-up
160
+
161
+ Both presentations now show Claude Code, ChatGPT (recommended OpenAI-plan sign-in),
162
+ Codex CLI (an existing-CLI alternative), then API key. Codex is no longer hidden
163
+ under Settings-only Advanced. Shared status/route preflight and strict `ready ===
164
+ true` remain unchanged; Tricia still consumes the canonical handler. Compatible
165
+ Codex no longer receives a version refusal. Tests cover both orders and wording,
166
+ ready/unready states, model preference, sign-in completion and Tricia composer refresh.
167
+ FirstRunOnboarding shows Settings only for a completed/restarted app, hides Skip
168
+ and its hint after readiness, and exposes `aiAlternative` (the existing `InferenceEngineAction` label/href DTO)
169
+ inside the AI step card for the host's existing plugin Settings link. Reuse search found the
170
+ existing Card, link actions and wizard actions; no new component, route or transport.
171
+
172
+ The optional onboarding link uses data rather than a Svelte Snippet across the
173
+ package boundary. Linked consumers can use another compatible Svelte patch
174
+ (5.57.1 in the SDK, 5.57.3 in the product); their branded Snippet types differ.
175
+ Reuse `InferenceEngineAction`, Button and safeHref for the actual link requirement.
176
+ Component tests cover placement, disappearance after the AI step and unsafe URLs;
177
+ product svelte-check verifies the real cross-version boundary. No type assertion,
178
+ new action type, helper, component or dependency override is needed.
179
+
180
+ S1: failed engine selection stays visible across focus/status refresh. Pending ChatGPT sign-in recovers its validated link through `chatgpt-start` after reload without reopening the system browser. The link, ten-minute expiry explanation and Cancel live inside the ChatGPT card in both presentations. `chatgpt-cancel` invokes the authenticated connection's cancellation handle; unsupported SDK cancellation returns a fixed 409 and is never shown as success. No raw remote errors/URLs enter logs. WorkProfileSettings reuses Card/Toggle/ConfirmDialog for default-on removal and local-CLI protection settings; disabling protection requires the explicit command/file risk confirmation. The ChatGPT engine choice links to Connect AI when signed out.
@@ -53,6 +53,12 @@ sample data source are not part of it.
53
53
  (recipe text, else the model description, else a plain fallback), `noun` and
54
54
  `filter` carried through. Feature models share the `More` section after the
55
55
  recipes' sections.
56
+ - **Item icons**: `layout.items[id].icon` overrides the recipe icon in the
57
+ drawer, section menu and overview shortcuts. It is a 1–64 character identifier
58
+ (ASCII letter first, then letters, digits, `_` or `-`); unknown safe names
59
+ are retained for host renderers and otherwise use the shell's fallback glyph.
60
+ Absent overrides keep existing recipe icons and `fileText` defaults. Layout
61
+ parsing, moves and item renames preserve the override.
56
62
  - **Paths** are options: `entryPath` (default `/m/<package>/<Model>/[<key>/]`),
57
63
  `sectionPath` (default `/s/<slug>/`, slug = layout id with the first `:`
58
64
  turned into `-`), and `href` (a prefix or query helper applied to both).
@@ -85,6 +91,17 @@ sample data source are not part of it.
85
91
 
86
92
  ## `CookbookApp`
87
93
 
94
+ `assistant` accepts a host-supplied `{ component, transport, registry, label? }`
95
+ (the template host's `createCookbookAssistant()`). CookbookApp mounts it in the
96
+ shell panel, shares the registry with Provider, and owns the desktop/phone toggle.
97
+ `embed` hides in-app chat by omitting the assistant component. A host without
98
+ `assistant` retains the existing explicit panel/dock snippet API.
99
+
100
+ The optional host-owned `assistant.toolPresentation: 'generic'` flows through
101
+ the supplied component and `OnboardingAssistant` to the shared dock. It keeps
102
+ person-facing tool activity generic without changing provider history or
103
+ execution authority; hosts that omit it retain their existing presentation.
104
+
88
105
  `AppShell` with the builder's output. Props: `cookbook`, `catalog`, any
89
106
  `AppShell` prop (title, logo, `storageKey`, `user`, `permissions`, `dock`,
90
107
  `slotItems`, `settingsHref`, ...), and:
@@ -93,9 +110,8 @@ sample data source are not part of it.
93
110
  `records` the section pages add the count and latest records; `shortcuts`
94
111
  is a `CookbookShortcutsLoader`, below),
95
112
  - `widgetContext` (host capabilities for browser-side widget loads),
96
- - `resolveExport` (a static map of dynamic imports; turns a recipe export
97
- reference into a component, used for `shell-widget` slot items and recipe
98
- `widget` registration; without it those surfaces are ignored),
113
+ - `resolveExport` (optional override of the installed-manifest generated resolver
114
+ for shell widgets, recipe widgets and route surfaces),
99
115
  - `oncookbookchange(cookbook)` called with the full cookbook after a layout or
100
116
  overview edit (layout edits come from the shell's pencil toggle, enabled with
101
117
  `layoutEditing`). Without it edits live in memory. Persisting them is the
@@ -173,9 +189,8 @@ listing every problem, including a recipe no installed package declares.
173
189
 
174
190
  ## Not done here
175
191
 
176
- - **Field policies** (`cookbook.policies`) are returned as `policies` but not
177
- applied; applying them to the runtime is `smrt cookbook apply` and the
178
- runtime's job. The shell does not render a settings page; pass `settingsHref`.
192
+ - **Policy editing settings** remain host-owned; pass `settingsHref`. The shell
193
+ automatically resolves raw `cookbook.policies` for its record screens.
179
194
  - **Entry pages** (`/m/<package>/<Model>/`) are the app's routes; `./screens`
180
195
  (`RecipeScreens`) is the default content for them. Their data comes from the
181
196
  package model's generated REST route and its `@smrt/web` definition (#3749).
@@ -209,3 +224,155 @@ tsc excludes test files) holds the type assertions that smrt-types'
209
224
  `OverviewOverride`. `CookbookApp.test.ts` mounts the shell with the bakery
210
225
  cookbook (nav, section page, brand theme, edit callback); `server.test.ts` runs
211
226
  the loader over a temp project with a fake installed package.
227
+
228
+ ## Named reference screens
229
+
230
+ The host's model page mounts `RecipeScreens` from `./screens`. Pass all exposed
231
+ `collectionDefinitions` as `definitions` to enable the default REST reference
232
+ sources. For linked record navigation, build the sources once with
233
+ `createRecipeScreenReferences(collectionDefinitions, { hrefFor })` and pass them
234
+ as `references`; `hrefFor(definition, id)` maps the qualified model to the app's
235
+ record URL. Use the cookbook shell's model entries to determine which models
236
+ have pages; omit a URL for a model with no page. A custom data source supplies
237
+ its own `search({ query, offset, limit })` and `get(id)` in the same map. See
238
+ [screens](screens.md) for label metadata, pagination and unavailable-target
239
+ behavior. This shell does not own a model-page router or infer one from an API
240
+ endpoint.
241
+
242
+ ## Shared record-screen vocabulary and policy context
243
+
244
+ `CookbookApp` passes raw cookbook rows to the browser-safe smrt-fields resolver
245
+ and shares the result with generated/standalone screens and definition-driven
246
+ import/export. Hosts no longer provide `fieldPolicies`; that prop remains an
247
+ explicit compatibility override for server-resolved tenant/user policies.
248
+ Collection renames reach titles, create/edit actions, back links and overview
249
+ model choices without changing API identities. Use `RecipeScreens.entryId` for a
250
+ keyed collection entry. See [screens.md](screens.md#cookbook-policy-and-vocabulary-context).
251
+
252
+ ## Installed recipe surface imports
253
+
254
+ The existing core producer/consumer web-module emitter now exports
255
+ `recipeSurfaces` and `resolveExport` from `@smrt/web` (producer alias:
256
+ `@happyvertical/smrt-virt-web`). `recipeSurfaces[recipeId]` is a typed tuple of
257
+ `{ surface, load }`; `load()` returns the component or undefined. Recipe ids and
258
+ surface metadata are literal types. Declarations use Svelte's component type
259
+ rather than importing every package's Svelte source into a Node-only typecheck.
260
+
261
+ `CookbookApp` uses `./cookbook/surfaces` by default; the consumer plugin replaces
262
+ that optional port with the generated web module. Without a plugin, its empty
263
+ resolver preserves generic screens and explicit host resolvers remain usable.
264
+ The shell uses the generated resolver for widget/shell-widget surfaces and
265
+ shares it with `RecipeScreens` for declared route surfaces. Explicit
266
+ `resolveExport` remains an override. Hosts need the normal SMRT consumer plugin,
267
+ not a handwritten export map. Imports are literal dynamic imports, one per
268
+ export reference; reading a manifest or map imports no recipe component. Missing
269
+ route exports and rejected imports retain generic screens. Server widget data
270
+ loaders are emitted only in the SSR projection; the browser map never imports
271
+ those server modules. Hosts still supply authenticated server widget data and
272
+ any capabilities a package component requires, not component import mappings.
273
+
274
+ The installed fixture package under `__tests__/surface-package/` exercises this
275
+ through the real consumer plugin and an ordinary cookbook harness. Its consumer
276
+ project root is a disposable temporary directory: fixture manifests and knowledge
277
+ must never be written into the real package's `.smrt` directory. Core's
278
+ `consumer-plugin/load-resolve.test.ts` separately builds an installed fixture and
279
+ proves its marker exists in a dynamic chunk and not the initial chunk, and its
280
+ server loader is absent from the browser import graph.
281
+
282
+ ## Reuse inventory for policy/surface integration
283
+
284
+ MCP `review-smrt-project` ran on fields/core/types/smrt-svelte; architecture
285
+ context queried field policy resolution, raw rows, generated surfaces and
286
+ `resolveExport`. The intent index and owning packages were searched by symbol
287
+ and purpose (`resolveFieldPolicy`, `buildCodeSeedVisibility`, `rowToDelta`,
288
+ `applyDelta`, `parseRecipeExportRef`, `generateWebModule`, surface maps and lazy
289
+ imports). Existing owning code was extended rather than duplicated:
290
+
291
+ - `fields/src/policy.ts`: moves the existing pure seed/merge helpers and exposes
292
+ the same kernel to server resolution and cookbook consumers. The registry,
293
+ authorization, database reads and cache stay in the original server resolver.
294
+ - `core/src/cookbook/export-ref.ts`: moves the existing export-reference parser
295
+ from overview recipe widgets; the emitter and UI now reuse it.
296
+ - `surfaces.ts`: an empty optional integration port; the consumer plugin resolves
297
+ it to its existing emitter rather than requiring a virtual module in plain
298
+ Svelte hosts. No parallel surface registry is implemented.
299
+ - `__tests__/surface-package/Surface.svelte`: a test-only package route composing
300
+ the existing `EditForm`; its `index.js` is only a re-export and its manifest and
301
+ package.json are fixture data. No new production component/model is introduced.
302
+
303
+ ## Integration contract after the shared train
304
+
305
+ Client policy code imports only the browser-safe `smrt-fields/policy` and
306
+ `smrt-core/cookbook` entries, never the fields server resolver/root. Installed
307
+ provider recipes keep their entry ids, labels and surface paths after a same-name
308
+ app replacement. Generated `replacedQualifiedNames` is the only alias authority;
309
+ canonical app rows override provider contributions without erasing sparse metadata.
310
+
311
+ Live exposure remains host-owned: subscribe to exposure changes, refresh navigation
312
+ with `filterRuntimeCookbookSnapshot`, filter definitions with `filterRuntimeExposure`,
313
+ and check direct URLs before mounting a screen. An installed lazy surface map is an
314
+ AOT superset, not authorization. The component integration case closes the host
315
+ preference, removes the projected screen/navigation, then reopens it without a build.
316
+
317
+ Read-only reference fields compose the existing disabled `ReferencePicker`, retaining
318
+ its manifest display label. Hidden references never mount a picker or issue a target
319
+ lookup. Save payloads preserve existing IDs and use valid raw defaults only on create.
320
+
321
+ Core's scanned app/STI fixture drives the existing screen field/draft functions into
322
+ REST create and verifies the effective app discriminator and hidden default in SQLite.
323
+ The existing durable cookbook-tool fixture proves policy metadata is unchanged while
324
+ a replacement is held, is published after owner decision/consumption, and cannot replay.
325
+ UI read-only metadata does not grant permission or approve assistant tools.
326
+
327
+ Reuse audit repeated MCP reviews for core/fields/smrt-svelte and intent-index/name/purpose
328
+ searches across core, fields, smrt-ui, smrt-svelte and chat. `cookbookPolicyLayers` factors
329
+ the two existing raw-row selectors; it uses existing registry/manifest replacement
330
+ provenance and the original sparse merge kernel. No new component/model is introduced.
331
+
332
+ ## Lazy activation and virtual names
333
+
334
+ With the consumer plugin's `lazyActivation`, the generated resolver requires current
335
+ visible recipe ids. `CookbookApp` passes `cookbook.recipes` automatically. Supply the
336
+ host's filtered cookbook snapshot and update it after successful activation/persistence
337
+ and exposure changes (including store failure); do not render an AOT installed catalog
338
+ as a live cookbook. SSR callers additionally pass a trusted tenant and install the
339
+ combined readiness/exposure gate. A refused import returns undefined for generic
340
+ fallback and is retried on the next current projection, with no rebuild.
341
+
342
+ The shared Fields resolver enumerates validated virtual display labels for stored
343
+ and raw policies. They keep the linked Profile name, can be relabelled/hidden, and
344
+ remain excluded from forms, create defaults and CSV imports. Visible names can be
345
+ exported; policy-hidden names cannot. The screen field selector retains the projected
346
+ `Name` fallback as well as cookbook labels/read-only metadata.
347
+
348
+ This rebase's reuse check repeated MCP package reviews and architecture context,
349
+ the intent index and `rg` searches for projection/readonly/activation/surface helpers
350
+ across core, fields, smrt-ui, smrt-svelte and chat. It extends existing policy field
351
+ enumeration and the web emitter, reuses public registry/UI validators and the existing
352
+ activation/exposure gates, and adds only the shared load-context type. No production
353
+ component, model, route or file is added.
354
+
355
+ ## Recipe screen import boundary
356
+
357
+ `context.ts` and `types.ts` are shared by standalone recipe screens. Keep these
358
+ contracts independent of shell components, including type-only imports: downstream
359
+ `svelte-check` follows them into the shell's theme CSS. `CookbookAppProps` lives in
360
+ `app-props.ts` and keeps its public exports from `./cookbook` and
361
+ `./cookbook/server`; standalone screens never import the app props or `AppShell`. Legitimate app hosts use Vite's CSS types (or the package's existing
362
+ ambient CSS declaration), which standalone recipe packages should not need.
363
+ `recipe-screen-boundary.test.mjs` traverses screen imports, including types, to
364
+ prevent the shell dependency from returning.
365
+
366
+ Reuse check: MCP `review-smrt-project` for smrt-svelte, the intent index, and
367
+ name/purpose searches for `AppShellProps`, `CookbookAppProps`, shell props and
368
+ import-boundary tests in smrt-ui/smrt-svelte/chat/core found the existing
369
+ `CookbookAppProps` in `types.ts`. `app-props.ts` moves that contract unchanged;
370
+ no parallel props type or runtime component is introduced.
371
+
372
+ `catalogFromManifests(manifests, true)` retains recipe search/help details while
373
+ still projecting model declarations to shell metadata. The default trimmed
374
+ projection is unchanged. Template host compilation uses this projection to avoid
375
+ reading full installed manifests at runtime; schemas remain activation-owned.
376
+ The catalog test covers both projections and verifies no object-schema map is
377
+ retained. Reuse inspection: MCP package review, intent index and exact/purpose
378
+ searches found this existing canonical projection; no new helper or type.
@@ -89,3 +89,13 @@ input size and domain validation and retain source evidence independently.
89
89
 
90
90
  No schema, authorization, transaction, or tenant mutation is introduced by
91
91
  this additive export; those behavioral test dimensions are not applicable.
92
+
93
+ ## Cookbook-driven exports
94
+
95
+ Pass `definition` instead of pre-derived `fields` to `ImportExport` under
96
+ `CookbookApp`. It derives columns with the same resolved cookbook policy as the
97
+ record screens, including collection/field labels. Hidden or policy-omitted
98
+ fields are not offered and cannot reach CSV/TSV, even when rows contain their
99
+ values. `policy` is an optional explicit override. The legacy `fields` input is
100
+ still supported for standalone hosts. Read-only fields remain exportable but
101
+ are not importable; `locked` retains its existing import-default semantics.