@profullstack/waitlist 0.12.0 → 0.14.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.
package/README.md CHANGED
@@ -120,7 +120,7 @@ The page reports one exposure a day; a signup is the conversion. Both go through
120
120
  waitlist API, which holds the CrawlProof token. Stop the experiment with a winner in
121
121
  CrawlProof and every page switches to it. Turn it off per site with `"ab": false`.
122
122
 
123
- ## Plugins (0.4; buyaday 0.6; book + promo 0.7; affiliate 0.9)
123
+ ## Plugins (0.4; buyaday 0.6; book + promo 0.7; affiliate 0.9; paid referral terms 0.13; advisor 0.14)
124
124
 
125
125
  Every page showcases all plugins by default. Pick per site in `sites.json`:
126
126
  `"plugins": ["form", "board"]` keeps only those, `"plugins": { "faq": false }` drops some.
@@ -140,26 +140,70 @@ Every page showcases all plugins by default. Pick per site in `sites.json`:
140
140
  | `book` | The Profullstack pitch (four solution lines) and `<book-a-call>`, our booking widget: open times from the OutreachGraph public calendar in the reader's own time zone, booked inline as a PairUX call. A plain link to the booking page without script. `"booking": {"handle": "chovy"}` picks the calendar |
141
141
  | `promo` | "More from the network": sister properties from the live `@profullstack/cross-promo` catalog, tagged `utm_medium=waitlist`. `"promoAudience": "developers"` (or a list) overrides the audience picked from the hierarchy |
142
142
  | `community` | A header bar with Search and a branded **Community** button to the name's own tsbb board (`https://bbs.<name>.pit.world`, sign in with pit.world / CoinPay OAuth 2.1, or `tsbb login <board> --with coinpay`). Linked only once the board answers over HTTPS, so new names gain it as their certificate lands. Writes `brand.json` (look, colours, light/dark, closest tsbb skin) that pit.world's board seed uses to match the site |
143
+ | `advisor` | An **Advisor** page (`advisor/`) that answers questions about the site's own topic from what the build holds: the pitch, the FAQ, the resources and the text search results. The visitor signs in with their own c0mpute account (OAuth 2.1 + PKCE, scope `inference`, through CoinPay or a passkey) and the page calls c0mpute's chat API with that key, billed to them: no server and no key on the site. Also writes `advisor/dataset.jsonl` (the same notes as a `c0mpute train lora` dataset), `context.json` and `prompt.txt`, and prints the CLI commands to ask or train from a terminal. Skipped when the build holds fewer than 3 documents. Settings: `advisor: { clientId, model }` (the page registers its own OAuth client on first sign-in when no `clientId` is given). Asking from the browser needs c0mpute to allow cross-origin calls to `/v1/chat/completions` (profullstack/c0mpute#718) |
143
144
  | (search, resources) | Every search item and resource carries pit.world's result tools from `https://pit.world/widgets.js`: vote, Summarize, Listen and Share. They work without an account; on a pit.world host, "Sign in with CoinPay" (OAuth 2.1 + PKCE through pit.world) raises the limits. From a terminal the same account is `pit login` |
144
- | `affiliate` | Referrals (0.9). Every signup gets a personal link `https://<site>/?ref=<code>`, shown right after joining by `<pf-referral-share>` ("You are #X of Y, N people referred.", copy button, plain X/Bluesky/LinkedIn/email links) and in the confirmation email with a signed status page. A visitor who arrives with `?ref=` keeps a 30-day first-party, first-touch cookie `wl_ref`; their signup credits the referrer once they confirm. Each confirmed referral moves the referrer up `bumpPlaces`. A "Move up the list" section bakes `<pf-referral-leaderboard>` (handles or masked emails only). With `buyaday` on, a door sold to a referred visitor credits the referrer too (holi.days `ref=<code>.<site>`). See below |
145
+ | `affiliate` | Referrals (0.9). Every signup gets a personal link `https://<site>/?ref=<code>`, shown right after joining by `<pf-referral-share>` ("You are #X of Y, N people referred.", copy button, plain X/Bluesky/LinkedIn/email links) and in the confirmation email with a signed status page. A visitor who arrives with `?ref=` keeps a 30-day first-party, first-touch cookie `wl_ref`; their signup credits the referrer once they confirm. Each confirmed referral moves the referrer up `bumpPlaces`. A "Move up the list" section bakes `<pf-referral-leaderboard>` (handles or masked emails only). With `buyaday` on, a door sold to a referred visitor credits the referrer too (holi.days `ref=<code>.<site>`), and since 0.13 the page states the paid terms: the referrer earns `commissionPct` of what that visitor pays and the visitor gets `discountPct` off. See below |
145
146
 
146
147
  ### Referrals (`affiliate`)
147
148
 
148
149
  ```json
149
- { "name": "comp.lang", "affiliate": { "enabled": true, "bumpPlaces": 3, "leaderboard": true, "leaderboardLimit": 10 } }
150
+ { "name": "comp.lang", "affiliate": { "enabled": true, "bumpPlaces": 3, "leaderboard": true, "leaderboardLimit": 10, "commissionPct": 20, "discountPct": 10 } }
150
151
  ```
151
152
 
152
153
  All keys are optional (shown with their defaults); `"affiliate": { "enabled": false }` or
153
154
  `"plugins": { "affiliate": false }` turns it off. The rules live on the API (moshcoding.com):
154
155
  no self-referral (same normalized email: case, `+tags`, Gmail dots), one credit per referred
155
156
  person per list, only confirmed signups count, at most 3 credited signups per hashed IP per
156
- list per day (IPs are HMAC'd, never stored). Nothing here pays or promises money.
157
+ list per day (IPs are HMAC'd, never stored).
158
+
159
+ #### Paid referrals (0.13)
160
+
161
+ The only thing a waitlist site sells is a door on a [holi.days](https://holi.days.pit.world)
162
+ calendar, through the `buyaday` block. When a visitor who arrived through someone's referral
163
+ link pays for a door, holi.days takes `discountPct` off the price and records `commissionPct`
164
+ of the amount paid as owed to the referrer.
165
+
166
+ | Key | Default | Meaning |
167
+ | --- | --- | --- |
168
+ | `commissionPct` | `20` | Percent of what a referred buyer pays that the referrer earns. Whole number, 0..50. |
169
+ | `discountPct` | `10` | Percent off a paid door for the referred buyer. Whole number, 0..50. |
170
+
171
+ With either above 0 (and both `affiliate` and `buyaday` on) the site says so in three places:
172
+
173
+ - "Move up the list" gains one paragraph: "When someone you refer buys a calendar door through
174
+ your link, you earn 20% of what they pay and they get 10% off. We pay commissions in USDC
175
+ through CoinPay and email you at the address you joined with when you have earnings. Doors
176
+ booked free with the holi.days badge do not count." The place-bump sentence stays.
177
+ - `<pf-referral-share commission-pct="20" discount-pct="10">`, shown after a signup: "Earn 20%
178
+ of what people you refer pay. They get 10% off."
179
+ - `<pf-buy-a-day discount-pct="10" commission-pct="20">`: "10% off a paid door with a referral
180
+ link. Referrers earn 20% of what the buyer pays."
181
+
182
+ `0` leaves that half out. `"commissionPct": 0, "discountPct": 0` turns the money wording off for
183
+ a site, and it reads as it did before 0.13. A site without `buyaday` says nothing about money
184
+ either: there is nothing on it to buy.
185
+
186
+ What to know before turning it on:
187
+
188
+ - **These two keys are wording.** The waitlist moves no money. holi.days applies the discount
189
+ and keeps the commission ledger from its own `REFERRAL_DISCOUNT_PCT` and
190
+ `REFERRAL_COMMISSION_PCT` (defaults 10 and 20; live values at
191
+ `https://holi.days.pit.world/api/v1/referral-terms`). Keep the site's numbers equal to those.
192
+ - **Paid doors need holi.days payments to be open.** holi.days sells a door through CoinPay
193
+ only when its `COINPAY_API_KEY` is set (`paidBookingOpen` in the terms JSON). While it is
194
+ closed, nobody can pay for a door, so nobody earns a commission or gets a discount; doors are
195
+ then only bookable free with the holi.days badge, which never counts.
196
+ - **Payouts are made by hand.** Commissions are owed once the buyer's payment confirms, and
197
+ paid in USDC through CoinPay by whoever runs holi.days (its admin API lists what is owed per
198
+ code). The email to the referrer is sent by that person: nothing in this package sends it.
199
+ - A commission is void if the door is refunded, released or hidden before the payout, and a
200
+ door bought through your own link earns nothing.
157
201
 
158
202
  Snippet for any page on the same API:
159
203
 
160
204
  ```html
161
205
  <waitlist-form dn="comp.lang" bump="3"></waitlist-form>
162
- <pf-referral-share bump="3"></pf-referral-share>
206
+ <pf-referral-share bump="3" commission-pct="20" discount-pct="10"></pf-referral-share>
163
207
  <pf-referral-leaderboard dn="comp.lang"></pf-referral-leaderboard>
164
208
  <script type="module" src="https://cdn.jsdelivr.net/npm/@profullstack/waitlist/src/index.js"></script>
165
209
  <script type="module" src="https://cdn.jsdelivr.net/npm/@profullstack/marketing-widgets/src/widgets.js"></script>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@profullstack/waitlist",
3
- "version": "0.12.0",
3
+ "version": "0.14.0",
4
4
  "description": "Email waitlist for any launch page: a <waitlist-form> web component, a live signup chart, and a static-site builder on @profullstack/css + @profullstack/charts.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -51,7 +51,7 @@
51
51
  "@profullstack/footer": "^0.7.3",
52
52
  "@resvg/resvg-js": "^2.6.2",
53
53
  "@profullstack/comments": "^0.2.0",
54
- "@profullstack/marketing-widgets": "^0.2.0",
54
+ "@profullstack/marketing-widgets": "^0.3.0",
55
55
  "@profullstack/cross-promo": "^0.2.1"
56
56
  },
57
57
  "devDependencies": {
@@ -0,0 +1,245 @@
1
+ // <site-advisor>: the question box on a site's Advisor page.
2
+ //
3
+ // The page is static, so the visitor brings the account: "Sign in with
4
+ // c0mpute" runs OAuth 2.1 + PKCE against c0mpute.com (scope `inference`),
5
+ // which signs them in through CoinPay or a passkey. The key that comes back
6
+ // stays in this tab's sessionStorage and is sent only to c0mpute.
7
+ //
8
+ // The page registers itself as a public OAuth client the first time someone
9
+ // signs in (c0mpute's open registration endpoint), unless the build baked a
10
+ // client id into the config. Config is the JSON script inside the element
11
+ // (src/advisor.js advisorConfig).
12
+
13
+ const SCOPE = 'inference';
14
+ const b64url = (bytes) => btoa(String.fromCharCode(...new Uint8Array(bytes))).replace(/\+/g, '-').replace(/\//g, '_').replace(/=+$/, '');
15
+
16
+ export function randomToken(bytes = 32) {
17
+ return b64url(crypto.getRandomValues(new Uint8Array(bytes)));
18
+ }
19
+
20
+ /** PKCE S256: the challenge for a verifier. */
21
+ export async function pkceChallenge(verifier) {
22
+ return b64url(await crypto.subtle.digest('SHA-256', new TextEncoder().encode(verifier)));
23
+ }
24
+
25
+ /** The page's own address without query or hash: the redirect URI. */
26
+ export function redirectUri(href) {
27
+ const u = new URL(href);
28
+ return `${u.origin}${u.pathname}`;
29
+ }
30
+
31
+ export function authorizeUrl({ api, clientId, redirect, challenge, state }) {
32
+ const q = new URLSearchParams({ response_type: 'code', client_id: clientId, redirect_uri: redirect, code_challenge: challenge, code_challenge_method: 'S256', scope: SCOPE, state });
33
+ return `${api}/oauth/authorize?${q}`;
34
+ }
35
+
36
+ /** The chat request: the site's notes as the system message, then the conversation so far. */
37
+ export function chatBody(cfg, history, question) {
38
+ return {
39
+ model: cfg.model || 'auto',
40
+ stream: false,
41
+ messages: [{ role: 'system', content: cfg.system }, ...history.slice(-6), { role: 'user', content: question }],
42
+ };
43
+ }
44
+
45
+ /** A message a person can act on, from whatever c0mpute (or the network) said. */
46
+ export function explain(status, body) {
47
+ const msg = body?.error?.message || body?.error_description || (typeof body?.error === 'string' ? body.error : '');
48
+ if (status === 401) return 'Your c0mpute sign-in is no longer valid. Sign in again.';
49
+ if (status === 402) return msg || 'Your c0mpute balance is empty. Top it up at c0mpute.com/checkout.';
50
+ if (status === 429) return msg || 'Too many questions for now. Try again in a few minutes.';
51
+ if (status === 0) return 'c0mpute could not be reached from this page. Try again, or ask from a terminal with the command below.';
52
+ return msg || `c0mpute answered ${status}. Try again in a minute.`;
53
+ }
54
+
55
+ const store = (kind) => {
56
+ try {
57
+ return kind === 'local' ? localStorage : sessionStorage;
58
+ } catch {
59
+ return null;
60
+ }
61
+ };
62
+
63
+ async function call(url, init) {
64
+ try {
65
+ const res = await fetch(url, init);
66
+ const body = await res.json().catch(() => ({}));
67
+ return { ok: res.ok, status: res.status, body };
68
+ } catch {
69
+ // A network failure and a refused cross-origin call look the same from here.
70
+ return { ok: false, status: 0, body: {} };
71
+ }
72
+ }
73
+
74
+ const h = (tag, props = {}, ...kids) => {
75
+ const n = document.createElement(tag);
76
+ for (const [k, v] of Object.entries(props)) {
77
+ if (k === 'class') n.className = v;
78
+ else if (k.startsWith('on')) n.addEventListener(k.slice(2), v);
79
+ else if (v !== false && v != null) n.setAttribute(k, v === true ? '' : v);
80
+ }
81
+ for (const k of kids) n.append(k);
82
+ return n;
83
+ };
84
+
85
+ if (typeof HTMLElement !== 'undefined') {
86
+ class SiteAdvisor extends HTMLElement {
87
+ #cfg = null;
88
+ #key = null;
89
+ #who = null;
90
+ #history = [];
91
+ #busy = false;
92
+ #error = '';
93
+ #log = [];
94
+
95
+ async connectedCallback() {
96
+ if (this.#cfg) return;
97
+ try {
98
+ this.#cfg = JSON.parse(this.querySelector('script[type="application/json"]')?.textContent || 'null');
99
+ } catch {
100
+ this.#cfg = null;
101
+ }
102
+ if (!this.#cfg?.system) return; // leave the static fallback text in place
103
+ this.#key = store('session')?.getItem(this.#k('key')) ?? null;
104
+ this.#render();
105
+ await this.#finishSignIn();
106
+ if (this.#key) void this.#loadWho();
107
+ }
108
+
109
+ #k(name) {
110
+ return `site-advisor:${this.#cfg.api}:${name}`;
111
+ }
112
+
113
+ async #clientId() {
114
+ if (this.#cfg.clientId) return this.#cfg.clientId;
115
+ const redirect = redirectUri(location.href);
116
+ const cacheKey = this.#k(`client:${redirect}`);
117
+ const cached = store('local')?.getItem(cacheKey);
118
+ if (cached) return cached;
119
+ const r = await call(`${this.#cfg.api}/api/oauth/register`, {
120
+ method: 'POST',
121
+ headers: { 'content-type': 'application/json' },
122
+ body: JSON.stringify({ client_name: `${this.#cfg.site} advisor (${location.host})`, redirect_uris: [redirect], token_endpoint_auth_method: 'none', grant_types: ['authorization_code'], response_types: ['code'] }),
123
+ });
124
+ if (!r.ok || !r.body.client_id) throw new Error(explain(r.status, r.body));
125
+ store('local')?.setItem(cacheKey, r.body.client_id);
126
+ return r.body.client_id;
127
+ }
128
+
129
+ async #signIn() {
130
+ this.#error = '';
131
+ this.#busy = true;
132
+ this.#render();
133
+ try {
134
+ const clientId = await this.#clientId();
135
+ const verifier = randomToken(48);
136
+ const state = randomToken(16);
137
+ const redirect = redirectUri(location.href);
138
+ store('session')?.setItem(this.#k('pending'), JSON.stringify({ verifier, state, clientId, redirect }));
139
+ location.assign(authorizeUrl({ api: this.#cfg.api, clientId, redirect, challenge: await pkceChallenge(verifier), state }));
140
+ } catch (e) {
141
+ this.#busy = false;
142
+ this.#error = e.message;
143
+ this.#render();
144
+ }
145
+ }
146
+
147
+ /** Back from c0mpute with ?code&state: swap the code for a key, then clean the address bar. */
148
+ async #finishSignIn() {
149
+ const q = new URLSearchParams(location.search);
150
+ if (!q.has('code') && !q.has('error')) return;
151
+ const pending = JSON.parse(store('session')?.getItem(this.#k('pending')) || 'null');
152
+ store('session')?.removeItem(this.#k('pending'));
153
+ history.replaceState(null, '', redirectUri(location.href));
154
+ if (q.has('error')) {
155
+ this.#error = q.get('error') === 'access_denied' ? 'Sign-in was cancelled.' : `Sign-in failed: ${q.get('error_description') || q.get('error')}`;
156
+ } else if (!pending || pending.state !== q.get('state')) {
157
+ this.#error = 'Sign-in could not be completed in this tab. Start it again.';
158
+ } else {
159
+ const r = await call(`${this.#cfg.api}/api/oauth/token`, {
160
+ method: 'POST',
161
+ headers: { 'content-type': 'application/json' },
162
+ body: JSON.stringify({ grant_type: 'authorization_code', code: q.get('code'), code_verifier: pending.verifier, client_id: pending.clientId, redirect_uri: pending.redirect }),
163
+ });
164
+ if (r.ok && r.body.access_token) {
165
+ this.#key = r.body.access_token;
166
+ store('session')?.setItem(this.#k('key'), this.#key);
167
+ } else this.#error = explain(r.status, r.body);
168
+ }
169
+ this.#render();
170
+ }
171
+
172
+ async #loadWho() {
173
+ const r = await call(`${this.#cfg.api}/api/v1/me`, { headers: { authorization: `Bearer ${this.#key}` } });
174
+ if (r.status === 401) return this.#signOut('Your c0mpute sign-in is no longer valid. Sign in again.');
175
+ if (r.ok) {
176
+ this.#who = { name: r.body.name || 'your c0mpute account', balance: r.body.balance?.spendable_usd ?? null };
177
+ this.#render();
178
+ }
179
+ }
180
+
181
+ #signOut(message = '') {
182
+ const key = this.#key;
183
+ this.#key = null;
184
+ this.#who = null;
185
+ this.#history = [];
186
+ store('session')?.removeItem(this.#k('key'));
187
+ if (key && !message) void call(`${this.#cfg.api}/api/oauth/revoke`, { method: 'POST', headers: { 'content-type': 'application/json' }, body: JSON.stringify({ token: key }) });
188
+ this.#error = message;
189
+ this.#render();
190
+ }
191
+
192
+ async #ask(question) {
193
+ const q = question.trim();
194
+ if (!q || this.#busy) return;
195
+ this.#busy = true;
196
+ this.#error = '';
197
+ this.#log.push({ role: 'user', text: q });
198
+ this.#render();
199
+ const r = await call(`${this.#cfg.api}/v1/chat/completions`, {
200
+ method: 'POST',
201
+ headers: { authorization: `Bearer ${this.#key}`, 'content-type': 'application/json' },
202
+ body: JSON.stringify(chatBody(this.#cfg, this.#history, q)),
203
+ });
204
+ this.#busy = false;
205
+ const answer = r.body?.choices?.[0]?.message?.content;
206
+ if (r.ok && answer) {
207
+ this.#history.push({ role: 'user', content: q }, { role: 'assistant', content: answer });
208
+ this.#log.push({ role: 'assistant', text: answer, model: r.body.model });
209
+ } else if (r.status === 401) {
210
+ this.#log.pop();
211
+ return this.#signOut('Your c0mpute sign-in is no longer valid. Sign in again.');
212
+ } else {
213
+ this.#log.pop();
214
+ this.#error = r.ok ? 'The model returned no answer. Try rephrasing.' : explain(r.status, r.body);
215
+ }
216
+ this.#render();
217
+ this.querySelector('input[name="q"]')?.focus();
218
+ }
219
+
220
+ #render() {
221
+ const cfg = this.#cfg;
222
+ const out = [];
223
+ if (this.#log.length) {
224
+ out.push(h('div', { class: 'advisor-log stack', 'aria-live': 'polite' }, ...this.#log.map((m) => h('div', { class: `advisor-turn advisor-${m.role}` }, h('p', { class: 'advisor-who muted' }, m.role === 'user' ? 'You' : `${cfg.site} advisor${m.model ? ` · ${m.model}` : ''}`), h('div', { class: 'advisor-text' }, m.text)))));
225
+ }
226
+ if (this.#error) out.push(h('p', { class: 'advisor-error', role: 'alert' }, this.#error));
227
+ if (!this.#key) {
228
+ out.push(h('p', {}, h('button', { type: 'button', disabled: this.#busy, onclick: () => void this.#signIn() }, this.#busy ? 'Opening c0mpute…' : 'Sign in with c0mpute to ask')));
229
+ } else {
230
+ const input = h('input', { name: 'q', type: 'text', required: true, maxlength: '1000', autocomplete: 'off', placeholder: cfg.examples?.[0] || `Ask about ${cfg.site}`, 'aria-label': 'Your question', disabled: this.#busy });
231
+ out.push(
232
+ h('form', { class: 'stack', onsubmit: (e) => { e.preventDefault(); void this.#ask(input.value); } }, h('div', { class: 'field-group' }, input, h('button', { type: 'submit', disabled: this.#busy }, this.#busy ? 'Thinking…' : 'Ask'))),
233
+ );
234
+ if (cfg.examples?.length && !this.#log.length) {
235
+ out.push(h('p', { class: 'advisor-examples' }, ...cfg.examples.map((ex) => h('button', { type: 'button', class: 'advisor-example', disabled: this.#busy, onclick: () => void this.#ask(ex) }, ex))));
236
+ }
237
+ out.push(
238
+ h('p', { class: 'muted' }, this.#who ? `Signed in as ${this.#who.name}${this.#who.balance != null ? `, balance $${Number(this.#who.balance).toFixed(2)}` : ''}. ` : 'Signed in. ', h('button', { type: 'button', class: 'advisor-link', onclick: () => this.#signOut() }, 'Sign out')),
239
+ );
240
+ }
241
+ this.replaceChildren(...out);
242
+ }
243
+ }
244
+ if (!customElements.get('site-advisor')) customElements.define('site-advisor', SiteAdvisor);
245
+ }
package/src/advisor.js ADDED
@@ -0,0 +1,181 @@
1
+ // The `advisor` plugin: an Advisor page on every site that answers questions
2
+ // about that site's own topic, from what the build already holds (the pitch,
3
+ // the FAQ, the resources and the baked search results).
4
+ //
5
+ // Nothing here has a server or a key. The visitor signs in with their own
6
+ // c0mpute account (OAuth 2.1 + PKCE, which signs in through CoinPay) and the
7
+ // page calls c0mpute's chat API with the key that grant returns, billed to
8
+ // them. The same corpus is written as a JSONL dataset so anyone can train a
9
+ // LoRA adapter on it with `c0mpute train lora`.
10
+ //
11
+ // Files written under advisor/: index.html, context.json, prompt.txt, dataset.jsonl.
12
+ import { esc, headTags, clip } from './seo.js';
13
+
14
+ export const C0MPUTE = 'https://c0mpute.com';
15
+ /** Small on purpose: workers train LoRA in fp32, on CPU as often as GPU. */
16
+ export const TRAIN_BASE = 'Qwen/Qwen2.5-0.5B-Instruct';
17
+ export const ADVISOR_PATH = 'advisor/';
18
+
19
+ const MAX_CONTEXT_CHARS = 14_000;
20
+ const PER_TAB = 6;
21
+
22
+ const clean = (v) => String(v ?? '').replace(/\s+/g, ' ').trim();
23
+
24
+ /**
25
+ * Everything the site knows, as documents: { kind, title, text, url? }.
26
+ * `search` and `resources` are what runPlugins fetched (either may be null).
27
+ */
28
+ export function advisorCorpus(s, { search = null, resources = null } = {}) {
29
+ const docs = [];
30
+ const about = [s.tagline, s.summary, s.about].map(clean).filter(Boolean).join(' ');
31
+ if (about) docs.push({ kind: 'site', title: s.title, text: about, url: s.url });
32
+ if (s.points?.length) docs.push({ kind: 'site', title: `What is coming on ${s.title}`, text: s.points.map(clean).filter(Boolean).join('; '), url: s.url });
33
+ for (const f of s.faq ?? []) {
34
+ const q = clean(f.q);
35
+ const a = clean(f.a);
36
+ if (q && a) docs.push({ kind: 'faq', title: q, text: a, url: s.url });
37
+ }
38
+ const seen = new Set();
39
+ const add = (kind, r) => {
40
+ const url = clean(r?.url);
41
+ const title = clean(r?.title);
42
+ if (!url || !title || seen.has(url)) return;
43
+ seen.add(url);
44
+ docs.push({ kind, title, text: clean(r.summary) || title, url });
45
+ };
46
+ for (const r of resources?.results ?? []) add('resource', r);
47
+ for (const t of search?.live ?? []) {
48
+ // Image and video tabs are thumbnails with thin titles: no use to a text model.
49
+ if (t.id === 'images' || t.id === 'videos') continue;
50
+ for (const r of (search.tabs?.[t.id]?.results ?? []).slice(0, PER_TAB)) add(t.id, r);
51
+ }
52
+ return docs;
53
+ }
54
+
55
+ /** The corpus as numbered text for the prompt, cut at whole documents to fit a small model. */
56
+ export function advisorContext(corpus, maxChars = MAX_CONTEXT_CHARS) {
57
+ const out = [];
58
+ let used = 0;
59
+ for (const [i, d] of corpus.entries()) {
60
+ const line = `[${i + 1}] ${d.title}\n${clip(d.text, 600)}${d.url ? `\nSource: ${d.url}` : ''}`;
61
+ if (used + line.length > maxChars) break;
62
+ out.push(line);
63
+ used += line.length + 2;
64
+ }
65
+ return out.join('\n\n');
66
+ }
67
+
68
+ export function advisorSystem(s) {
69
+ return `You are the ${s.title} advisor, on ${s.host}. ${clean(s.tagline)}
70
+ Answer questions about this site's topic from the numbered notes below, and say which note a fact came from by its number. The notes are the site's own FAQ and a daily snapshot of web results about the topic.
71
+ - Lead with the answer in one or two sentences, then the detail.
72
+ - If the notes do not cover the question, say so plainly and answer from general knowledge, marked as such. Never invent a source.
73
+ - ${s.title} itself has not opened yet: for anything about the product, the notes are all that is known.
74
+ - Keep it under about 200 words unless asked for more.`;
75
+ }
76
+
77
+ /**
78
+ * The corpus as a `c0mpute train lora` dataset: one {"title","text"} per line.
79
+ * FAQ entries keep their question and answer together so the adapter learns the pair.
80
+ */
81
+ export function advisorDataset(s, corpus) {
82
+ return corpus
83
+ .map((d) => {
84
+ const text = d.kind === 'faq' ? `Question: ${d.title}\nAnswer: ${d.text}` : `${d.text}${d.url && d.kind !== 'site' ? `\nSource: ${d.url}` : ''}`;
85
+ return JSON.stringify({ title: d.kind === 'faq' ? `${s.title} FAQ` : d.title, text });
86
+ })
87
+ .join('\n') + (corpus.length ? '\n' : '');
88
+ }
89
+
90
+ /** What the <site-advisor> element needs, baked into the page. */
91
+ export function advisorConfig(s, corpus) {
92
+ return {
93
+ site: s.title,
94
+ host: s.host,
95
+ api: C0MPUTE,
96
+ clientId: s.advisor?.clientId || null,
97
+ model: s.advisor?.model || 'auto',
98
+ system: `${advisorSystem(s)}\n\nNotes:\n\n${advisorContext(corpus)}`,
99
+ examples: (s.faq ?? []).map((f) => clean(f.q)).filter(Boolean).slice(0, 3),
100
+ };
101
+ }
102
+
103
+ const slug = (name) => clean(name).toLowerCase().replace(/[^a-z0-9]+/g, '-').replace(/^-|-$/g, '') || 'site';
104
+
105
+ /** The shell commands shown on the page: train an adapter, and ask from the CLI. */
106
+ export function advisorCommands(s) {
107
+ const base = `${s.url}${ADVISOR_PATH}`;
108
+ return {
109
+ train: [
110
+ 'c0mpute login',
111
+ `curl -sO ${base}dataset.jsonl`,
112
+ `c0mpute train lora --base ${TRAIN_BASE} --dataset dataset.jsonl --name ${slug(s.name)}-advisor`,
113
+ ],
114
+ ask: [`c0mpute chat --system "$(curl -s ${base}prompt.txt)" "What is ${s.title}?"`],
115
+ };
116
+ }
117
+
118
+ export function advisorMeta(s, corpus) {
119
+ const url = `${s.url}${ADVISOR_PATH}`;
120
+ return {
121
+ url,
122
+ seoTitle: clip(`Ask the ${s.title} advisor`, 60),
123
+ description: clip(`Ask anything about ${s.title} and its topic. Answers come from this site's FAQ and ${corpus.length} notes it keeps, on open models on the c0mpute network.`, 158),
124
+ h1: `Ask the ${s.title} advisor`,
125
+ };
126
+ }
127
+
128
+ /** The home page card that links to the Advisor page. */
129
+ export function advisorCardHtml(s, corpus) {
130
+ return `<section class="card stack" aria-labelledby="advisor-card"><h2 id="advisor-card">Ask the advisor</h2>
131
+ <p>Questions about ${esc(s.title)} and its topic, answered from the ${corpus.length} notes this site keeps.</p>
132
+ <p><a class="button" href="${ADVISOR_PATH}">Ask a question</a></p></section>`;
133
+ }
134
+
135
+ /**
136
+ * The Advisor page. `chrome({ head, body, spec })` renders the shared shell.
137
+ * Everything useful is in the HTML (what it knows, how to ask from a CLI, how
138
+ * to train): the element only adds sign-in and the question box.
139
+ */
140
+ export function advisorPageHtml(s, corpus, { chrome, rebase }) {
141
+ const m = advisorMeta(s, corpus);
142
+ const ps = { ...s, url: m.url, seoTitle: m.seoTitle, description: m.description };
143
+ const cfg = JSON.stringify(advisorConfig(s, corpus)).replace(/</g, '\\u003c');
144
+ const cmd = advisorCommands(s);
145
+ const base = esc(m.url);
146
+ const known = corpus
147
+ .filter((d) => d.kind !== 'site')
148
+ .slice(0, 24)
149
+ .map((d) => `<li>${d.url && d.kind !== 'faq' ? `<a href="${esc(d.url)}" rel="noopener nofollow">${esc(d.title)}</a>` : esc(d.title)} <small class="muted">${esc(d.kind)}</small></li>`)
150
+ .join('');
151
+ const body = `<header class="waitlist-hero stack" data-space="md">
152
+ <p class="waitlist-kicker"><a href="../">← ${esc(s.title)}</a> <span class="badge">Advisor</span></p>
153
+ <h1>${esc(m.h1)}</h1>
154
+ <p class="waitlist-answer">Ask about ${esc(s.title)} and its topic. Answers come from this site's FAQ and a daily snapshot of ${corpus.length} notes, on open models on the <a href="${C0MPUTE}">c0mpute</a> network.</p>
155
+ </header>
156
+ <section class="card stack" aria-labelledby="advisor-ask"><h2 id="advisor-ask">Ask a question</h2>
157
+ <site-advisor><script type="application/json">${cfg}</script>
158
+ <p class="muted">Asking needs JavaScript and a c0mpute account. Without them, the commands below do the same from a terminal.</p>
159
+ </site-advisor>
160
+ <p class="muted">You sign in with your own c0mpute account (through CoinPay or a passkey). Each answer is charged to your compute balance, or runs on the free tier when it is empty. This site has no server and never sees your key.</p>
161
+ </section>
162
+ <section class="stack advisor-section" aria-labelledby="advisor-cli"><h2 id="advisor-cli">From a terminal</h2>
163
+ <p>The same notes, with the <a href="${C0MPUTE}/docs">c0mpute CLI</a>:</p>
164
+ <pre><code>${esc(cmd.ask.join('\n'))}</code></pre>
165
+ </section>
166
+ <section class="stack advisor-section" aria-labelledby="advisor-train"><h2 id="advisor-train">Train your own</h2>
167
+ <p>The notes are also a training set (<a href="${base}dataset.jsonl">dataset.jsonl</a>, ${corpus.length} rows, rebuilt daily). This trains a small LoRA adapter on it with a c0mpute worker and downloads it to you:</p>
168
+ <pre><code>${esc(cmd.train.join('\n'))}</code></pre>
169
+ <p class="muted">The last command only checks the data and shows a preview. Add <code>--yes</code> to send it to a worker; training is paid from your c0mpute balance at the price the worker bids.</p>
170
+ </section>
171
+ ${known ? `<section class="stack advisor-section" aria-labelledby="advisor-knows"><h2 id="advisor-knows">What it knows</h2><ul class="waitlist-points">${known}</ul>
172
+ <p class="muted">Machine-readable: <a href="${base}context.json">context.json</a> · <a href="${base}prompt.txt">prompt.txt</a></p></section>` : ''}`;
173
+ const head = headTags(ps);
174
+ return { html: rebase(chrome({ head, body, spec: ps }), '../'), path: 'advisor', meta: m };
175
+ }
176
+
177
+ /** context.json: the prompt and the documents, for agents and the CLI. */
178
+ export function advisorContextJson(s, corpus) {
179
+ const cfg = advisorConfig(s, corpus);
180
+ return JSON.stringify({ site: s.title, host: s.host, updated: s.updated, model: cfg.model, system: cfg.system, documents: corpus, dataset: `${s.url}${ADVISOR_PATH}dataset.jsonl`, train: { base: TRAIN_BASE, commands: advisorCommands(s).train } }, null, 2) + '\n';
181
+ }
package/src/build.js CHANGED
@@ -4,10 +4,11 @@
4
4
  */
5
5
  import { mkdir, writeFile, copyFile, readFile, readdir } from 'node:fs/promises';
6
6
  import { pluginSet, keywordsFor, runPlugins, baseSlot, affiliateConfig } from './plugins.js';
7
+ import { ADVISOR_PATH, advisorCardHtml, advisorContextJson, advisorCorpus, advisorConfig, advisorDataset, advisorMeta, advisorPageHtml } from './advisor.js';
7
8
  import { boardLive, boardUrl, brandJson, navHtml } from './community.js';
8
9
  import {
9
10
  TABS, SORTS, tabPath, searchPageHtml, searchPageMeta, searchJson, searchLlms, manifestJson,
10
- openSearchXml, serviceWorker, maskableIconSvg,
11
+ openSearchXml, serviceWorker, maskableIconSvg, rebase,
11
12
  } from './search.js';
12
13
  import { createRequire } from 'node:module';
13
14
  import { createHash } from 'node:crypto';
@@ -133,6 +134,7 @@ export function normalize(spec) {
133
134
  audience: spec.audience || '',
134
135
  promoAudience: spec.promoAudience || null,
135
136
  booking: spec.booking && typeof spec.booking === 'object' ? spec.booking : null,
137
+ advisor: spec.advisor && typeof spec.advisor === 'object' ? spec.advisor : null,
136
138
  indexnowKey: spec.indexnowKey || indexNowKey(name),
137
139
  updated: spec.updated || new Date().toISOString().slice(0, 10),
138
140
  };
@@ -264,8 +266,15 @@ export async function buildSite(spec, out, { footers = true, images = true, fetc
264
266
  await writeFile(join(out, 'assets', 'icon-maskable-512.png'), await svgToPng(maskableIconSvg(s), { width: 512 }));
265
267
  }
266
268
  const foot = footers ? await renderFooters(s, { fetchImpl }) : '';
267
- const { slot, search } = await runPlugins(s, out, { fetchImpl, cacheDir, maxAgeMs, searchOpts });
269
+ const { slot, search, resources } = await runPlugins(s, out, { fetchImpl, cacheDir, maxAgeMs, searchOpts });
268
270
  s.searchLive = Boolean(search?.live?.length);
271
+ // advisor: a page that answers from what this build holds. Too little to go on, no page.
272
+ const corpus = s.plugins.has('advisor') ? advisorCorpus(s, { search, resources }) : [];
273
+ s.advisorLive = corpus.length >= ADVISOR_MIN_DOCS;
274
+ if (s.advisorLive) {
275
+ await copyFile(join(here, 'advisor-client.js'), join(out, 'assets', 'advisor.js'));
276
+ slot.cards.push(advisorCardHtml(s, corpus));
277
+ }
269
278
  // community: the name's own board, linked once it answers over HTTPS; brand.json for its look.
270
279
  if (s.plugins.has('community')) {
271
280
  s.community = (await boardLive(boardUrl(s), { fetchImpl })) ? boardUrl(s) : null;
@@ -277,6 +286,7 @@ export async function buildSite(spec, out, { footers = true, images = true, fetc
277
286
  await writeFile(join(out, 'index.html'), withAssetVersion(pageHtml(s, { footers: foot, slot }), ver));
278
287
  await writeFile(join(out, '404.html'), withAssetVersion(pageHtml(s, { footers: foot, noindex: true, slot }), ver));
279
288
  const pages = s.searchLive ? await writeSearch(s, search, out, { footers: foot, slot, ver, images }) : [];
289
+ if (s.advisorLive) pages.push(await writeAdvisor(s, corpus, out, { footers: foot, slot, ver }));
280
290
  s.extraUrls = pages.map((p) => p.url);
281
291
  await writeFile(join(out, 'site.webmanifest'), manifestJson(s, s.searchLive ? search : null));
282
292
  await writeFile(join(out, 'opensearch.xml'), openSearchXml(s));
@@ -318,6 +328,29 @@ async function writeSearch(s, search, out, { footers, slot, ver, images }) {
318
328
  return pages;
319
329
  }
320
330
 
331
+ /** Below this many documents an advisor would only be guessing. */
332
+ export const ADVISOR_MIN_DOCS = 3;
333
+
334
+ /**
335
+ * Write the Advisor page and its data: the prompt and documents (context.json,
336
+ * prompt.txt) and the training set (dataset.jsonl). Returns the sitemap entry.
337
+ */
338
+ async function writeAdvisor(s, corpus, out, { footers, slot, ver }) {
339
+ const dir = join(out, ADVISOR_PATH);
340
+ await mkdir(dir, { recursive: true });
341
+ // The waitlist form rides along; the home page's cards and sections do not.
342
+ const pageSlot = { ...slot, cards: [], sections: [], scripts: [...slot.scripts, '<script type="module" src="assets/advisor.js"></script>'] };
343
+ const { html } = advisorPageHtml(s, corpus, {
344
+ rebase,
345
+ chrome: ({ head, body, spec }) => withAssetVersion(shellHtml(spec, { head, main: `${body}\n<section class="card stack" aria-label="Waitlist"><h2>Get ${esc(s.title)} when it opens</h2>${slot.hero.join('\n')}</section>`, footers, slot: pageSlot }), ver),
346
+ });
347
+ await writeFile(join(dir, 'index.html'), html);
348
+ await writeFile(join(dir, 'context.json'), advisorContextJson(s, corpus));
349
+ await writeFile(join(dir, 'prompt.txt'), advisorConfig(s, corpus).system + '\n');
350
+ await writeFile(join(dir, 'dataset.jsonl'), advisorDataset(s, corpus));
351
+ return { url: advisorMeta(s, corpus).url, lastmod: s.updated, changefreq: 'daily' };
352
+ }
353
+
321
354
  /** A short hash of everything in assets/; module imports between assets carry it too. */
322
355
  export async function versionAssets(out) {
323
356
  const dir = join(out, 'assets');
package/src/community.js CHANGED
@@ -78,6 +78,7 @@ export async function boardLive(url, { fetchImpl = globalThis.fetch, timeoutMs =
78
78
  export function navHtml(s, { community = null, esc }) {
79
79
  const links = [
80
80
  s.searchLive ? `<a href="search/">Search</a>` : '',
81
+ s.advisorLive ? `<a href="advisor/">Advisor</a>` : '',
81
82
  community ? `<a class="waitlist-community" href="${esc(community)}" rel="noopener">Community</a>` : '',
82
83
  ].filter(Boolean);
83
84
  if (!links.length) return '';
package/src/plugins.js CHANGED
@@ -13,7 +13,8 @@
13
13
  * promo "More from the network": sister properties from @profullstack/cross-promo.
14
14
  * `"promoAudience": "developers"` (or a list) picks who the reader is.
15
15
  * affiliate referral links, place bumps and a leaderboard (`"affiliate": {...}`, see
16
- * affiliateConfig); door sales credit the referrer when buyaday is on.
16
+ * affiliateConfig); door sales credit the referrer when buyaday is on, and
17
+ * the page then states the paid terms (commissionPct / discountPct).
17
18
  */
18
19
  import { mkdir, readFile, writeFile, copyFile } from 'node:fs/promises';
19
20
  import { createRequire } from 'node:module';
@@ -24,7 +25,7 @@ import { fetchSearch, searchCardHtml } from './search.js';
24
25
 
25
26
  const require = createRequire(import.meta.url);
26
27
 
27
- export const PLUGINS = ['form', 'stats', 'ab', 'faq', 'search', 'resources', 'board', 'share', 'feed', 'buyaday', 'book', 'promo', 'affiliate', 'community'];
28
+ export const PLUGINS = ['form', 'stats', 'ab', 'faq', 'search', 'resources', 'board', 'share', 'feed', 'buyaday', 'book', 'promo', 'affiliate', 'community', 'advisor'];
28
29
 
29
30
  /** Resolve a site's `plugins` setting to a Set (default: all of them). */
30
31
  export function pluginSet(setting) {
@@ -37,9 +38,17 @@ export function pluginSet(setting) {
37
38
  /**
38
39
  * The `affiliate` plugin's settings from sites.json:
39
40
  *
40
- * "affiliate": { "enabled": true, "bumpPlaces": 3, "leaderboard": true, "leaderboardLimit": 10 }
41
+ * "affiliate": { "enabled": true, "bumpPlaces": 3, "leaderboard": true, "leaderboardLimit": 10,
42
+ * "commissionPct": 20, "discountPct": 10 }
41
43
  *
42
44
  * bumpPlaces is how many places one confirmed referral moves someone up (0..50).
45
+ *
46
+ * commissionPct / discountPct are the paid referral terms the page states: what
47
+ * a referrer earns of a calendar door a referred visitor pays for, and what that
48
+ * visitor gets off (whole numbers, 0..50). They are wording only: holi.days
49
+ * applies the discount and keeps the ledger from its own REFERRAL_COMMISSION_PCT
50
+ * and REFERRAL_DISCOUNT_PCT, so keep the two in step. 0 leaves that part out;
51
+ * both 0 and the site says nothing about money.
43
52
  */
44
53
  export function affiliateConfig(raw) {
45
54
  const a = raw && typeof raw === 'object' ? raw : {};
@@ -49,9 +58,31 @@ export function affiliateConfig(raw) {
49
58
  bumpPlaces: int(a.bumpPlaces, 3, 0, 50),
50
59
  leaderboard: a.leaderboard !== false,
51
60
  leaderboardLimit: int(a.leaderboardLimit, 10, 1, 100),
61
+ commissionPct: int(a.commissionPct, 20, 0, 50),
62
+ discountPct: int(a.discountPct, 10, 0, 50),
52
63
  };
53
64
  }
54
65
 
66
+ /**
67
+ * The paid referral terms a site states, or zeros when it should say nothing
68
+ * about money: affiliate off, or no `buyaday` (the buy-a-day block is the only
69
+ * thing a referred visitor can pay for, so without it there is nothing to earn).
70
+ */
71
+ export function referralTerms(s) {
72
+ const on = s.plugins || pluginSet();
73
+ const a = s.affiliate;
74
+ if (!a || !on.has('affiliate') || !on.has('buyaday')) return { commissionPct: 0, discountPct: 0 };
75
+ return { commissionPct: a.commissionPct || 0, discountPct: a.discountPct || 0 };
76
+ }
77
+
78
+ /** The one paragraph about money in "Move up the list" ('' when the site states no terms). */
79
+ export function referralTermsParagraph({ commissionPct, discountPct }) {
80
+ if (!commissionPct && !discountPct) return '';
81
+ const what = [commissionPct ? `you earn ${commissionPct}% of what they pay` : '', discountPct ? `they get ${discountPct}% off` : ''].filter(Boolean).join(' and ');
82
+ const pay = commissionPct ? ' We pay commissions in USDC through CoinPay and email you at the address you joined with when you have earnings.' : '';
83
+ return `When someone you refer buys a calendar door through your link, ${what}.${pay} Doors booked free with the holi.days badge do not count.`;
84
+ }
85
+
55
86
  /**
56
87
  * Copy the @profullstack/marketing-widgets browser files FLAT into assets/ (as
57
88
  * mw-widgets.js + mw-core.js: versionAssets reads assets/ and would EISDIR on a
@@ -75,8 +106,10 @@ export async function affiliateHtml(s, { fetchImpl } = {}) {
75
106
  ? `Everyone who joins gets a personal link. Each friend who joins through yours and confirms their email moves you up ${a.bumpPlaces} ${a.bumpPlaces === 1 ? 'place' : 'places'}.`
76
107
  : 'Everyone who joins gets a personal link. Friends who join through yours and confirm their email put you on the board.';
77
108
  const board = a.leaderboard ? await mw.referralLeaderboardHtml({ dn: s.dn, api: s.api, limit: a.leaderboardLimit, fetchImpl }) : '';
109
+ const money = referralTermsParagraph(referralTerms(s));
78
110
  return `<section class="stack waitlist-affiliate" aria-labelledby="referrals"><h2 id="referrals">Move up the list</h2>
79
111
  <p>${esc(how)}</p>
112
+ ${money ? `<p class="waitlist-referral-terms">${esc(money)}</p>` : ''}
80
113
  ${board}
81
114
  </section>`;
82
115
  }
@@ -157,7 +190,9 @@ export function baseSlot(s) {
157
190
  <div class="field-group"><input id="wl-email" name="email" type="email" autocomplete="email" required><button type="submit">${esc(s.button)}</button></div></form>
158
191
  </waitlist-form>`);
159
192
  // Shown after a signup: place on the list, personal link, copy + share links.
160
- if (aff) slot.hero.push(`<pf-referral-share bump="${aff.bumpPlaces}"></pf-referral-share>`);
193
+ // commission-pct / discount-pct make it state the paid terms; absent, it says nothing about money.
194
+ const terms = referralTerms(s);
195
+ if (aff) slot.hero.push(`<pf-referral-share bump="${aff.bumpPlaces}"${terms.commissionPct ? ` commission-pct="${terms.commissionPct}"` : ''}${terms.discountPct ? ` discount-pct="${terms.discountPct}"` : ''}></pf-referral-share>`);
161
196
  }
162
197
  if (on.has('stats')) {
163
198
  slot.cards.push(`<section class="card stack" aria-labelledby="count"><h2 id="count">Who's waiting</h2>
@@ -200,9 +235,10 @@ export async function runPlugins(s, out, { fetchImpl, cacheDir, maxAgeMs, search
200
235
  // Offers are baked in (no script needed, crawlers read them); the copied script
201
236
  // refreshes them live so taken doors drop off. An empty feed renders nothing.
202
237
  // With affiliate on, a door sold to a referred visitor credits the referrer too
203
- // (holi.days ref = <code>.<site>, from ?ref or the wl_ref cookie).
238
+ // (holi.days ref = <code>.<site>, from ?ref or the wl_ref cookie), and the offer
239
+ // states the referral discount (needs marketing-widgets 0.3).
204
240
  const mw = await import('@profullstack/marketing-widgets');
205
- const html = await mw.buyADayHtml({ ref: s.host, keywords: s.buyadayKeywords || keywordsFor(s), limit: s.buyadayLimit || 3, fetchImpl, referrerCookie: on.has('affiliate') });
241
+ const html = await mw.buyADayHtml({ ref: s.host, keywords: s.buyadayKeywords || keywordsFor(s), limit: s.buyadayLimit || 3, fetchImpl, referrerCookie: on.has('affiliate'), ...referralTerms(s) });
206
242
  if (html.includes('pf-mw-offer')) {
207
243
  await copyMarketingWidgets(mw, out, slot);
208
244
  slot.sections.push(`<section class="stack" aria-label="Buy a day">${html}</section>`);
package/src/waitlist.css CHANGED
@@ -55,3 +55,16 @@
55
55
  .waitlist-nav-links a:hover { border-color: currentColor; }
56
56
  .waitlist-nav-links a.waitlist-community { background: var(--pf-color-primary, currentColor); color: var(--pf-color-on-primary, #fff); border-color: transparent; font-weight: 700; }
57
57
  .waitlist-nav-links a.waitlist-community:hover { filter: brightness(1.1); }
58
+
59
+ /* advisor plugin: the question box on advisor/ (src/advisor-client.js). */
60
+ site-advisor { display: block; }
61
+ .advisor-section { margin-block-start: 2rem; }
62
+ .advisor-section pre { overflow-x: auto; }
63
+ .advisor-turn { padding-block: 0.6rem; border-block-end: 1px solid color-mix(in srgb, currentColor 18%, transparent); }
64
+ .advisor-who { margin: 0 0 0.2rem; font-size: 0.8em; }
65
+ .advisor-text { white-space: pre-wrap; overflow-wrap: anywhere; }
66
+ .advisor-user .advisor-text { font-weight: 600; }
67
+ .advisor-error { padding: 0.6rem 0.8rem; border: 1px solid currentColor; border-radius: 0.4rem; }
68
+ .advisor-examples { display: flex; flex-wrap: wrap; gap: 0.5rem; }
69
+ .advisor-example { font-size: 0.85em; }
70
+ .advisor-link { padding: 0; border: 0; background: none; color: inherit; font: inherit; text-decoration: underline; cursor: pointer; }