@mindstudio-ai/remy 0.1.279 → 0.1.280
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.
|
@@ -44,6 +44,7 @@ All fields are nested under the `"web"` key.
|
|
|
44
44
|
| `devCommand` | `string` | `"npm run dev"` | Command to start the dev server |
|
|
45
45
|
| `defaultPreviewMode` | `"desktop"` \| `"mobile"` | `"desktop"` | Default preview viewport in the editor. Set to `"mobile"` for mobile-first apps. |
|
|
46
46
|
| `prerender` | `object` | — | Opt into prerendering the listed routes/patterns for crawlers/unfurlers. See "Prerendering" below. |
|
|
47
|
+
| `mounts` | `array` | — | Serve other same-workspace apps under path prefixes of this app's hosts. See "Mounting other apps" below. |
|
|
47
48
|
|
|
48
49
|
### Frontend SDK
|
|
49
50
|
|
|
@@ -92,6 +93,24 @@ The project uses `"jsx": "react-jsx"` (automatic JSX transform) — do not `impo
|
|
|
92
93
|
|
|
93
94
|
On deploy, the platform runs `npm install && npm run build` in the web directory and hosts the output on CDN.
|
|
94
95
|
|
|
96
|
+
Two serving conventions every web interface must follow:
|
|
97
|
+
|
|
98
|
+
1. **Assets via `MS_ASSET_BASE_URL`.** The platform build sets this env var to a release-addressed CDN origin. Point the bundler's public path at it so asset URLs work on any host or mount path:
|
|
99
|
+
|
|
100
|
+
```ts
|
|
101
|
+
// vite.config.ts
|
|
102
|
+
export default defineConfig({
|
|
103
|
+
base: process.env.MS_ASSET_BASE_URL || '/',
|
|
104
|
+
// ...
|
|
105
|
+
});
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
2. **Router basename from `platform.basePath`.** The platform injects the path prefix the page is served under ('' on the app's own hosts, the mount path when another app mounts this one). The SDK prefixes its own calls automatically; app code must feed it to the router and avoid hardcoded root-absolute URLs (`<img src="/logo.png">`, raw `location.assign('/about')`):
|
|
109
|
+
|
|
110
|
+
```ts
|
|
111
|
+
createBrowserRouter(routes, { basename: platform.basePath || '/' });
|
|
112
|
+
```
|
|
113
|
+
|
|
95
114
|
#### Error Handling and Analytics
|
|
96
115
|
|
|
97
116
|
The SDK automatically reports uncaught errors, unhandled promise rejections, and pageviews to a per-app dashboard the owner gets for free. No setup required. The analytics dashboard covers visits, unique visitors, top pages, referrers, UTM breakdowns, country-level geo, device/browser/OS, new vs returning, and live online count.
|
|
@@ -136,6 +155,21 @@ await prerender.invalidate(['/u/abc']); // omit arg to purge all
|
|
|
136
155
|
|
|
137
156
|
`mindstudio-prod prerender` can help you verify/manage snapshots during development.
|
|
138
157
|
|
|
158
|
+
### Mounting other apps
|
|
159
|
+
|
|
160
|
+
A web interface can serve other apps from the same workspace under path prefixes of its own hosts (the multi-zone pattern — e.g. a marketing site serving a self-contained demo app at `/demos/vector-search` instead of linking to its subdomain):
|
|
161
|
+
|
|
162
|
+
```json
|
|
163
|
+
{ "web": { "mounts": [{ "path": "/demos/vector-search", "app": "vector-search-demo" }] } }
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
- `path`: non-root mount prefix; mounts must be disjoint (none may prefix another).
|
|
167
|
+
- `app`: the target's `custom_subdomain` or appId — a v2 app in the same workspace, validated at build.
|
|
168
|
+
|
|
169
|
+
Under the mount everything is the child's, served first-class (its live bundle, session, backend, auth, telemetry, frame policy). The child needs no mount-specific config and keeps working at its own subdomain; deploys stay independent. Mount-safety = the two serving conventions above (`MS_ASSET_BASE_URL` assets + `platform.basePath` basename, no hardcoded root-absolute URLs); the parent's build log warns when a target's build isn't mount-safe.
|
|
170
|
+
|
|
171
|
+
Caveats: prerendering for mounted paths is declared in the PARENT's `prerender.paths`; the auth cookie is per-host, so don't mount an auth-enabled app on a parent that also uses auth; a mount whose target has no live web build falls through to the parent's SPA.
|
|
172
|
+
|
|
139
173
|
## API Interface
|
|
140
174
|
|
|
141
175
|
REST endpoints for external consumers — other services, mobile apps, integrations. This is separate from the web frontend's internal RPC (`@mindstudio-ai/interface` calls `/_/methods` directly and does not use the API interface). The API interface lives at `/_/api/` and exposes only the methods you choose to route.
|