everything-dev 1.28.5 → 1.28.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli/sync.cjs +1 -2
- package/dist/cli/sync.cjs.map +1 -1
- package/dist/cli/sync.mjs +1 -2
- package/dist/cli/sync.mjs.map +1 -1
- package/dist/cli/upgrade.cjs +2 -1
- package/dist/cli/upgrade.cjs.map +1 -1
- package/dist/cli/upgrade.mjs +2 -1
- package/dist/cli/upgrade.mjs.map +1 -1
- package/dist/contract.cjs +8 -0
- package/dist/contract.cjs.map +1 -1
- package/dist/contract.d.cts +14 -3
- package/dist/contract.d.cts.map +1 -1
- package/dist/contract.d.mts +14 -3
- package/dist/contract.d.mts.map +1 -1
- package/dist/contract.mjs +7 -1
- package/dist/contract.mjs.map +1 -1
- package/dist/index.cjs +2 -0
- package/dist/index.d.cts +2 -2
- package/dist/index.d.mts +2 -2
- package/dist/index.mjs +2 -2
- package/dist/integrity.cjs +36 -6
- package/dist/integrity.cjs.map +1 -1
- package/dist/integrity.d.cts +6 -2
- package/dist/integrity.d.cts.map +1 -1
- package/dist/integrity.d.mts +6 -2
- package/dist/integrity.d.mts.map +1 -1
- package/dist/integrity.mjs +36 -6
- package/dist/integrity.mjs.map +1 -1
- package/dist/plugin.d.cts +2 -2
- package/dist/plugin.d.mts +2 -2
- package/dist/types.d.cts +2 -2
- package/dist/types.d.mts +2 -2
- package/package.json +1 -1
- package/skills/extends-config/SKILL.md +43 -0
- package/skills/init-upgrade/SKILL.md +65 -0
- package/skills/super-app/SKILL.md +147 -0
|
@@ -27,6 +27,71 @@ bos init --overrides ui,api,host # Include host locally
|
|
|
27
27
|
7. Write initial snapshot (`.bos/sync-snapshot.json`)
|
|
28
28
|
8. `bun install` + `bos types gen`
|
|
29
29
|
|
|
30
|
+
## Shared Host + Custom Tenant App
|
|
31
|
+
|
|
32
|
+
Use this pattern when you want one deployed host runtime and separate tenant apps that inherit from it.
|
|
33
|
+
|
|
34
|
+
### 1. Create the base host runtime
|
|
35
|
+
|
|
36
|
+
Create the app that owns the shared host, auth, API, and base plugin list:
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
bos init --overrides ui,api,host
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
This base runtime is the app the host boots from.
|
|
43
|
+
|
|
44
|
+
### 2. Create the tenant app from the base runtime
|
|
45
|
+
|
|
46
|
+
Create a second app whose `bos.config.json` extends the base runtime:
|
|
47
|
+
|
|
48
|
+
```json
|
|
49
|
+
{
|
|
50
|
+
"extends": "bos://linktree.near/linktree.com",
|
|
51
|
+
"account": "alice.near",
|
|
52
|
+
"domain": "linktree.com"
|
|
53
|
+
}
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
Then customize the tenant-owned sections, usually:
|
|
57
|
+
- `account`
|
|
58
|
+
- `repository`
|
|
59
|
+
- `app.ui`
|
|
60
|
+
- existing `plugins.<id>.ui`
|
|
61
|
+
- existing `plugins.<id>.sidebar`
|
|
62
|
+
|
|
63
|
+
### 3. Understand fixed-core tenant mode
|
|
64
|
+
|
|
65
|
+
Today the shared host stays fixed to the base runtime for:
|
|
66
|
+
- `app.host`
|
|
67
|
+
- `app.api`
|
|
68
|
+
- `app.auth`
|
|
69
|
+
- server-side plugin loading
|
|
70
|
+
|
|
71
|
+
Tenant apps are request-scoped overlays on top of that base host. In fixed-core mode, the supported tenant overrides are:
|
|
72
|
+
- `app.ui`
|
|
73
|
+
- existing `plugins.<id>.ui`
|
|
74
|
+
- existing `plugins.<id>.sidebar`
|
|
75
|
+
|
|
76
|
+
Tenant apps must extend the base runtime and do not introduce new server-side plugin IDs dynamically.
|
|
77
|
+
|
|
78
|
+
### 4. Host deployment env for tenant mode
|
|
79
|
+
|
|
80
|
+
The shared host uses these env vars to resolve tenant requests:
|
|
81
|
+
|
|
82
|
+
```bash
|
|
83
|
+
NETWORK_ID=mainnet
|
|
84
|
+
ALLOW_OVERRIDE=ui,plugins.*
|
|
85
|
+
TENANT_WHITELIST=alice.near,bob.near
|
|
86
|
+
ALLOW_UNTRUSTED_SSR=false
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
Subdomains resolve by convention, for example:
|
|
90
|
+
- `linktree.com` -> base runtime
|
|
91
|
+
- `alice.linktree.com` -> `bos://alice.near/linktree.com`
|
|
92
|
+
|
|
93
|
+
Use the `extends-config` skill when reasoning about how the tenant config merges with the base runtime.
|
|
94
|
+
|
|
30
95
|
### Init File Selection
|
|
31
96
|
|
|
32
97
|
`buildInitPatterns(overrides, plugins)` chooses what init copies from the template source:
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: super-app
|
|
3
|
+
description: Build shared-host, shared-API super apps with tenant-specific UI composition. Use when setting up a base runtime plus custom tenant apps, configuring fixed-core multi-tenancy, or reasoning about what tenants can override today.
|
|
4
|
+
metadata:
|
|
5
|
+
sources: "host/src/services/tenant-runtime.ts,host/src/program.ts,host/src/services/federation.server.ts,packages/everything-dev/src/config.ts"
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Super Apps
|
|
9
|
+
|
|
10
|
+
Use this skill for the shared-host pattern where one runtime owns the host, auth, API, and base plugin set, while many tenant apps extend that runtime and swap UI-facing pieces per request.
|
|
11
|
+
|
|
12
|
+
## Mental Model
|
|
13
|
+
|
|
14
|
+
- The base runtime is the server core and trust boundary.
|
|
15
|
+
- Tenant apps are published BOS configs that extend the base runtime.
|
|
16
|
+
- The host resolves the tenant config from the request hostname.
|
|
17
|
+
- In fixed-core mode, the host, auth, API, and server-side plugins stay fixed to the base runtime.
|
|
18
|
+
- Tenant-specific UI composition is applied per request.
|
|
19
|
+
|
|
20
|
+
Example mapping:
|
|
21
|
+
- `linktree.com` -> base runtime `bos://linktree.near/linktree.com`
|
|
22
|
+
- `alice.linktree.com` -> tenant runtime `bos://alice.near/linktree.com`
|
|
23
|
+
|
|
24
|
+
## What Works Today
|
|
25
|
+
|
|
26
|
+
Supported tenant overrides in fixed-core mode:
|
|
27
|
+
- `app.ui`
|
|
28
|
+
- existing `plugins.<id>.ui`
|
|
29
|
+
- existing `plugins.<id>.sidebar`
|
|
30
|
+
|
|
31
|
+
Still fixed to the base runtime:
|
|
32
|
+
- `app.host`
|
|
33
|
+
- `app.api`
|
|
34
|
+
- `app.auth`
|
|
35
|
+
- server-side plugin loading and router mounting
|
|
36
|
+
|
|
37
|
+
Not part of this mode:
|
|
38
|
+
- tenant-specific API overrides
|
|
39
|
+
- tenant-specific auth overrides
|
|
40
|
+
- introducing new plugin IDs dynamically per tenant
|
|
41
|
+
- full per-request host/plugin/auth/api hot swap
|
|
42
|
+
|
|
43
|
+
## Setup Flow
|
|
44
|
+
|
|
45
|
+
### 1. Create the base runtime
|
|
46
|
+
|
|
47
|
+
The base runtime owns the shared host and API surface:
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
bos init --overrides ui,api,host
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
This app is the one you deploy as the shared host.
|
|
54
|
+
|
|
55
|
+
### 2. Publish the base runtime
|
|
56
|
+
|
|
57
|
+
The base runtime must be published before tenants can extend it:
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
bos publish --deploy
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
### 3. Create a tenant app that extends the base runtime
|
|
64
|
+
|
|
65
|
+
Tenant `bos.config.json`:
|
|
66
|
+
|
|
67
|
+
```json
|
|
68
|
+
{
|
|
69
|
+
"extends": "bos://linktree.near/linktree.com",
|
|
70
|
+
"account": "alice.near",
|
|
71
|
+
"domain": "linktree.com",
|
|
72
|
+
"repository": "https://github.com/example/alice-app",
|
|
73
|
+
"app": {
|
|
74
|
+
"ui": {
|
|
75
|
+
"name": "ui",
|
|
76
|
+
"development": "local:ui",
|
|
77
|
+
"production": "https://cdn.example.com/alice-ui",
|
|
78
|
+
"integrity": "sha384-..."
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
You can also override existing plugin UIs and sidebar entries for tenant-specific navigation.
|
|
85
|
+
|
|
86
|
+
## Host Env For Tenant Mode
|
|
87
|
+
|
|
88
|
+
The shared host uses these env vars to resolve tenants:
|
|
89
|
+
|
|
90
|
+
```bash
|
|
91
|
+
NETWORK_ID=mainnet
|
|
92
|
+
ALLOW_OVERRIDE=ui,plugins.*
|
|
93
|
+
TENANT_WHITELIST=alice.near,bob.near
|
|
94
|
+
ALLOW_UNTRUSTED_SSR=false
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
Meaning:
|
|
98
|
+
- `NETWORK_ID` controls whether subdomains resolve to `.near` or `.testnet`
|
|
99
|
+
- `ALLOW_OVERRIDE` controls which tenant config sections can affect request-scoped composition
|
|
100
|
+
- `TENANT_WHITELIST` controls which tenants may use SSR
|
|
101
|
+
- `ALLOW_UNTRUSTED_SSR=true` allows SSR for any valid tenant with SSR config
|
|
102
|
+
|
|
103
|
+
## Resolution Rules
|
|
104
|
+
|
|
105
|
+
Tenant resolution is convention-based:
|
|
106
|
+
- bare domain serves the base runtime
|
|
107
|
+
- a single subdomain label resolves to a tenant account
|
|
108
|
+
- nested labels are rejected in tenant mode
|
|
109
|
+
|
|
110
|
+
The tenant config must:
|
|
111
|
+
- exist in FastKV
|
|
112
|
+
- extend the base runtime
|
|
113
|
+
- resolve to the expected tenant account
|
|
114
|
+
- provide integrity for overridden remote UIs
|
|
115
|
+
|
|
116
|
+
## Security Model
|
|
117
|
+
|
|
118
|
+
- Tenant UI overrides are integrity-checked before trust is established.
|
|
119
|
+
- Integrity verification uses bounded streaming, not full-response buffering.
|
|
120
|
+
- Asset requests use stale-while-revalidate verification to avoid latency spikes.
|
|
121
|
+
- HTML and SSR requests use blocking verification.
|
|
122
|
+
- SSR module cache identity includes `ssrIntegrity`, not just the SSR URL.
|
|
123
|
+
|
|
124
|
+
## Recommended Workflow
|
|
125
|
+
|
|
126
|
+
For the base runtime:
|
|
127
|
+
|
|
128
|
+
```bash
|
|
129
|
+
bos dev --host remote
|
|
130
|
+
bos publish --deploy
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
For a tenant UI app:
|
|
134
|
+
|
|
135
|
+
```bash
|
|
136
|
+
bos dev --host remote --api remote
|
|
137
|
+
bos publish --deploy
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
After publishing config changes that affect the base host runtime, restart the host process so it reloads the latest base config snapshot.
|
|
141
|
+
|
|
142
|
+
## When To Load Other Skills
|
|
143
|
+
|
|
144
|
+
- Use `everything-dev#init-upgrade` for scaffold/sync/upgrade mechanics.
|
|
145
|
+
- Use `everything-dev#extends-config` for deep-merge and resolved-config semantics.
|
|
146
|
+
- Use `everything-dev#publish-sync` for publish and deploy steps.
|
|
147
|
+
- Use this `super-app` skill when the question is specifically about the shared-host, shared-API multi-tenant architecture.
|