create-ailk 0.44.0 → 0.46.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 +6 -3
- package/component-catalog.json +24 -1
- package/component-catalog.md +6 -5
- package/dist/add-module.d.ts +7 -0
- package/dist/add-module.js +17 -2
- package/dist/apply-design.js +1 -12
- package/dist/lib/env-catalog.js +2 -2
- package/dist/lib/import-mdx.js +10 -2
- package/dist/lib/license-key-files.d.ts +2 -0
- package/dist/lib/license-key-files.js +11 -0
- package/dist/paid-sections.d.ts +19 -0
- package/dist/paid-sections.js +41 -0
- package/dist/programmatic.js +56 -6
- package/dist/seed-workspace.d.ts +1 -1
- package/dist/seed-workspace.js +10 -3
- package/dist/surfaces.js +1 -1
- package/dist/update.d.ts +21 -2
- package/dist/update.js +188 -10
- package/package.json +3 -3
- package/templates/apps/api/.env.example +23 -0
- package/templates/apps/api/CLAUDE.md +17 -7
- package/templates/apps/api/src/lib/__mocks__/prisma.ts +11 -0
- package/templates/apps/mcp/.env.example +14 -3
- package/templates/apps/mcp/CLAUDE.md +47 -24
- package/templates/apps/mcp/src/index.ts +1 -1
- package/templates/apps/web/.env.example +1 -1
- package/templates/apps/web/CLAUDE.md +47 -16
- package/templates/apps/web/app/.well-known/mcp.json/build-manifest.ts +44 -41
- package/templates/apps/web/app/.well-known/mcp.json/route.ts +24 -33
- package/templates/apps/web/app/[locale]/layout.tsx +10 -7
- package/templates/apps/web/app/api/site-status/__tests__/route.test.ts +120 -0
- package/templates/apps/web/app/api/site-status/route.ts +62 -0
- package/templates/apps/web/app/llms.txt/route.ts +3 -3
- package/templates/apps/web/app/openapi.json/__tests__/route.test.ts +21 -4
- package/templates/apps/web/app/openapi.json/route.ts +10 -9
- package/templates/apps/web/app/sitemap.xml/route.ts +3 -3
- package/templates/apps/web/auth.ts +25 -1
- package/templates/apps/web/lib/__tests__/fixtures/mcp-stub-server.ts +245 -0
- package/templates/apps/web/lib/__tests__/mcp-served-tools.test.ts +395 -0
- package/templates/apps/web/lib/__tests__/offerings-pricing.test.ts +112 -0
- package/templates/apps/web/lib/__tests__/pricing-page.test.ts +280 -0
- package/templates/apps/web/lib/__tests__/site-brand.test.ts +5 -6
- package/templates/apps/web/lib/__tests__/site-visibility.test.ts +64 -0
- package/templates/apps/web/lib/__tests__/structured-data.test.tsx +108 -11
- package/templates/apps/web/lib/license-key-store.ts +1 -1
- package/templates/apps/web/lib/mcp-oauth.ts +64 -0
- package/templates/apps/web/lib/mcp-served-tools.ts +231 -0
- package/templates/apps/web/lib/offerings-pricing.ts +30 -6
- package/templates/apps/web/lib/pricing-page.ts +142 -35
- package/templates/apps/web/lib/site-brand.tsx +1 -7
- package/templates/apps/web/lib/site-visibility.ts +45 -0
- package/templates/apps/web/messages/en.json +8 -0
- package/templates/apps/web/middleware.ts +16 -1
- package/templates/apps/web/src/lib/routes.ts +3 -3
- package/versions.json +51 -51
- package/templates/apps/web/app/.well-known/ai-plugin.json/route.ts +0 -93
- package/templates/apps/web/lib/release-scope.ts +0 -47
|
@@ -13,7 +13,9 @@
|
|
|
13
13
|
* - anything else (expired, empty, a failed read) — the site's contact
|
|
14
14
|
* email in place of those sections, never an error (D5).
|
|
15
15
|
* `pricingSections` runs that choice per page, narrowed to the page's own
|
|
16
|
-
* `plans` (#10044 D4); `plans: []` reads no Stripe data at all.
|
|
16
|
+
* `plans` (#10044 D4); `plans: []` reads no Stripe data at all. A `pricing`
|
|
17
|
+
* section that lists its own `offeringPlans` is a plan group (#12103 D2): it
|
|
18
|
+
* shows exactly those plans' Stripe cards, and none is removed.
|
|
17
19
|
*
|
|
18
20
|
* Stripe text reaches markup only as React text through `offeringsPricing`,
|
|
19
21
|
* and JSON-LD only through renderPage's serializer (T4).
|
|
@@ -187,8 +189,13 @@ export async function offeringsCopy(locale: string): Promise<{
|
|
|
187
189
|
};
|
|
188
190
|
}
|
|
189
191
|
|
|
190
|
-
/**
|
|
192
|
+
/**
|
|
193
|
+
* The authored section copy a Stripe section keeps — never a plan or price
|
|
194
|
+
* fact. `cardLayout` (#12103 D6) is also re-applied over the mapper's own
|
|
195
|
+
* layout by `stripePlansSection`, so an authored one wins.
|
|
196
|
+
*/
|
|
191
197
|
const AUTHORED_COPY_FIELDS = [
|
|
198
|
+
"cardLayout",
|
|
192
199
|
"eyebrow",
|
|
193
200
|
"headline",
|
|
194
201
|
"description",
|
|
@@ -225,45 +232,88 @@ function insertionIndex(sections: PageSection[]): number {
|
|
|
225
232
|
return sections[0]?.type === "hero" ? 1 : 0;
|
|
226
233
|
}
|
|
227
234
|
|
|
235
|
+
/** A non-`addons` pricing section — a plans section. */
|
|
236
|
+
function isPlansSection(section: PageSection): section is PricingSection {
|
|
237
|
+
return isPricing(section) && section.data.variant !== "addons";
|
|
238
|
+
}
|
|
239
|
+
|
|
228
240
|
/**
|
|
229
|
-
*
|
|
230
|
-
* `
|
|
231
|
-
* plans slot and the first `addons` one the add-ons slot; every other pricing
|
|
232
|
-
* section, and a slot whose fragment is `null`, is removed. A fragment with no
|
|
233
|
-
* slot is inserted after a leading hero (the add-ons directly after the
|
|
234
|
-
* plans). No other section moves.
|
|
241
|
+
* Each plan group's Stripe plans fragment (#12103 D2), keyed by its section:
|
|
242
|
+
* `null` when none of the group's plans is shown.
|
|
235
243
|
*/
|
|
236
|
-
export
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
244
|
+
export type OfferingsGroups = ReadonlyMap<PricingSection, PricingData | null>;
|
|
245
|
+
|
|
246
|
+
/**
|
|
247
|
+
* The page's Stripe fragments from one shown-set read (#12103 D2). Each plans
|
|
248
|
+
* section that lists `offeringPlans` is mapped alone, for exactly those plans
|
|
249
|
+
* (its add-ons discarded), into `groups`. `pricing` is the page-level mapping
|
|
250
|
+
* — the page's `plans`, less every plan a group lists — for the unlisted plans
|
|
251
|
+
* slot and the add-ons slot. A page with no group maps exactly as before, with
|
|
252
|
+
* `groups` empty.
|
|
253
|
+
*/
|
|
254
|
+
export function offeringsFragments(
|
|
255
|
+
declared: PageSection[],
|
|
256
|
+
shownSet: unknown,
|
|
257
|
+
options: {
|
|
258
|
+
locale: string;
|
|
259
|
+
labels: OfferingsPricingLabels;
|
|
260
|
+
plans: readonly string[] | undefined;
|
|
261
|
+
},
|
|
262
|
+
): { pricing: OfferingsPricing | null; groups: OfferingsGroups } {
|
|
263
|
+
const { locale, labels, plans } = options;
|
|
264
|
+
const listed = declared.filter(
|
|
265
|
+
(s): s is PricingSection =>
|
|
266
|
+
isPlansSection(s) && s.data.offeringPlans !== undefined,
|
|
245
267
|
);
|
|
246
|
-
const
|
|
247
|
-
|
|
268
|
+
const exclude = listed.flatMap((s) => s.data.offeringPlans ?? []);
|
|
269
|
+
const groups = new Map(
|
|
270
|
+
listed.map((section) => [
|
|
271
|
+
section,
|
|
272
|
+
offeringsPricing(shownSet, {
|
|
273
|
+
locale,
|
|
274
|
+
labels,
|
|
275
|
+
plans: section.data.offeringPlans,
|
|
276
|
+
})?.plans ?? null,
|
|
277
|
+
]),
|
|
248
278
|
);
|
|
249
|
-
const
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
279
|
+
const pricing = offeringsPricing(shownSet, {
|
|
280
|
+
locale,
|
|
281
|
+
labels,
|
|
282
|
+
plans,
|
|
283
|
+
...(exclude.length > 0 ? { exclude } : {}),
|
|
284
|
+
});
|
|
285
|
+
return { pricing, groups };
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
/**
|
|
289
|
+
* One Stripe plans section in `slot`'s place: the slot's authored copy, the
|
|
290
|
+
* mapper's fragment, the slot's own `cardLayout` over the mapper's (#12103
|
|
291
|
+
* D6; `billingToggle` stays the mapper's computed one), and a `?plan=`
|
|
292
|
+
* recommendation (#8842) — applied by each section to its own cards.
|
|
293
|
+
*/
|
|
294
|
+
function stripePlansSection(
|
|
295
|
+
slot: PricingSection | undefined,
|
|
296
|
+
fragment: PricingData,
|
|
297
|
+
recommend: string | undefined,
|
|
298
|
+
recommendedLabel: string,
|
|
299
|
+
): PricingSection {
|
|
300
|
+
return {
|
|
301
|
+
id: slot?.id ?? "offerings-plans",
|
|
253
302
|
type: "pricing",
|
|
254
303
|
data: {
|
|
255
|
-
...authoredCopy(
|
|
256
|
-
...
|
|
304
|
+
...authoredCopy(slot),
|
|
305
|
+
...fragment,
|
|
306
|
+
cardLayout: slot?.data.cardLayout ?? fragment.cardLayout,
|
|
257
307
|
// A `?plan=` recommendation moves the mapper's highlight onto the named
|
|
258
308
|
// plan and wears `recommendedLabel` (#8842); the mapper's own
|
|
259
309
|
// "Recommended" pill label would ride along as a second label, so it is
|
|
260
310
|
// dropped from every card when a recommendation is in play.
|
|
261
311
|
...(recommend !== undefined &&
|
|
262
|
-
|
|
312
|
+
fragment.plans.some(
|
|
263
313
|
(card) => card.key?.toLowerCase() === recommend.toLowerCase(),
|
|
264
314
|
)
|
|
265
315
|
? {
|
|
266
|
-
plans:
|
|
316
|
+
plans: fragment.plans.map(
|
|
267
317
|
({ highlightLabel: _, ...card }) => card,
|
|
268
318
|
),
|
|
269
319
|
}
|
|
@@ -273,6 +323,39 @@ export function withOfferings(
|
|
|
273
323
|
...(recommend !== undefined ? { recommended: recommend } : {}),
|
|
274
324
|
} as PricingData,
|
|
275
325
|
};
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
/**
|
|
329
|
+
* The page's sections with the Stripe fragments in place of its authored
|
|
330
|
+
* `pricing` sections (D4). Each plan group in `groups` (#12103 D2) becomes
|
|
331
|
+
* its own Stripe section where it was, or is removed when its fragment is
|
|
332
|
+
* `null`. Of the other sections, the first non-`addons` pricing section is the
|
|
333
|
+
* plans slot and the first `addons` one the add-ons slot; every other pricing
|
|
334
|
+
* section, and a slot whose fragment is `null`, is removed. A fragment with no
|
|
335
|
+
* slot is inserted after a leading hero (the add-ons directly after the last
|
|
336
|
+
* plans section) — except the plans fragment on a page with plan groups, which
|
|
337
|
+
* has said what it shows and gets no inserted section. No other section moves.
|
|
338
|
+
*/
|
|
339
|
+
export function withOfferings(
|
|
340
|
+
sections: PageSection[],
|
|
341
|
+
pricing: OfferingsPricing,
|
|
342
|
+
plan: string | undefined,
|
|
343
|
+
recommendedLabel: string,
|
|
344
|
+
addonsHeadline: string,
|
|
345
|
+
groups?: OfferingsGroups,
|
|
346
|
+
): PageSection[] {
|
|
347
|
+
const grouped = groups !== undefined && groups.size > 0;
|
|
348
|
+
const plansSlot = sections.find(
|
|
349
|
+
(s): s is PricingSection => isPlansSection(s) && !groups?.has(s),
|
|
350
|
+
);
|
|
351
|
+
const addonsSlot = sections.find(
|
|
352
|
+
(s): s is PricingSection => isPricing(s) && s.data.variant === "addons",
|
|
353
|
+
);
|
|
354
|
+
const recommend =
|
|
355
|
+
plan !== undefined && LOOKUP_KEY_PLAN_PATTERN.test(plan) ? plan : undefined;
|
|
356
|
+
const plansSection: PricingSection | null =
|
|
357
|
+
pricing.plans &&
|
|
358
|
+
stripePlansSection(plansSlot, pricing.plans, recommend, recommendedLabel);
|
|
276
359
|
const addonsSection: PricingSection | null = pricing.addons && {
|
|
277
360
|
id: addonsSlot?.id ?? "offerings-addons",
|
|
278
361
|
type: "pricing",
|
|
@@ -287,17 +370,33 @@ export function withOfferings(
|
|
|
287
370
|
};
|
|
288
371
|
|
|
289
372
|
const placed: PageSection[] = [];
|
|
373
|
+
const stripePlans: PageSection[] = [];
|
|
290
374
|
for (const section of sections) {
|
|
291
375
|
if (!isPricing(section)) placed.push(section);
|
|
292
|
-
else if (section
|
|
293
|
-
|
|
376
|
+
else if (groups?.has(section)) {
|
|
377
|
+
const fragment = groups.get(section);
|
|
378
|
+
if (fragment) {
|
|
379
|
+
const group = stripePlansSection(
|
|
380
|
+
section,
|
|
381
|
+
fragment,
|
|
382
|
+
recommend,
|
|
383
|
+
recommendedLabel,
|
|
384
|
+
);
|
|
385
|
+
placed.push(group);
|
|
386
|
+
stripePlans.push(group);
|
|
387
|
+
}
|
|
388
|
+
} else if (section === plansSlot && plansSection) {
|
|
389
|
+
placed.push(plansSection);
|
|
390
|
+
stripePlans.push(plansSection);
|
|
391
|
+
} else if (section === addonsSlot && addonsSection)
|
|
294
392
|
placed.push(addonsSection);
|
|
295
393
|
}
|
|
296
|
-
if (plansSection && !plansSlot) {
|
|
394
|
+
if (plansSection && !plansSlot && !grouped) {
|
|
297
395
|
placed.splice(insertionIndex(placed), 0, plansSection);
|
|
396
|
+
stripePlans.push(plansSection);
|
|
298
397
|
}
|
|
299
398
|
if (addonsSection && !addonsSlot) {
|
|
300
|
-
const plansAt =
|
|
399
|
+
const plansAt = Math.max(-1, ...stripePlans.map((s) => placed.indexOf(s)));
|
|
301
400
|
placed.splice(
|
|
302
401
|
plansAt >= 0 ? plansAt + 1 : insertionIndex(placed),
|
|
303
402
|
0,
|
|
@@ -367,7 +466,8 @@ export function pagePlans(frontmatter: unknown): string[] | undefined {
|
|
|
367
466
|
* - `plans: []` → the written sections, no Stripe read;
|
|
368
467
|
* - unconnected → the written sections (`?plan=` moving the recommendation);
|
|
369
468
|
* - shown → the page's Stripe cards in place of its `pricing` sections,
|
|
370
|
-
* when any of its plans is shown
|
|
469
|
+
* when any of its plans is shown — each plan group's own plans in its
|
|
470
|
+
* place (#12103 D2);
|
|
371
471
|
* - anything else → the contact email in their place.
|
|
372
472
|
*/
|
|
373
473
|
export async function pricingSections(
|
|
@@ -388,15 +488,22 @@ export async function pricingSections(
|
|
|
388
488
|
if (read.kind === "shown") {
|
|
389
489
|
const { labels, recommendedLabel, addonsHeadline } =
|
|
390
490
|
await offeringsCopy(locale);
|
|
391
|
-
const pricing =
|
|
392
|
-
|
|
393
|
-
|
|
491
|
+
const { pricing, groups } = offeringsFragments(declared, read.shownSet, {
|
|
492
|
+
locale,
|
|
493
|
+
labels,
|
|
494
|
+
plans,
|
|
495
|
+
});
|
|
496
|
+
if (pricing) {
|
|
497
|
+
const placed = withOfferings(
|
|
394
498
|
declared,
|
|
395
499
|
pricing,
|
|
396
500
|
plan,
|
|
397
501
|
recommendedLabel,
|
|
398
502
|
addonsHeadline,
|
|
503
|
+
groups,
|
|
399
504
|
);
|
|
505
|
+
// Every pricing section left is a Stripe one; none means nothing shown.
|
|
506
|
+
if (placed.some(isPricing)) return placed;
|
|
400
507
|
}
|
|
401
508
|
}
|
|
402
509
|
return withContactFallback(declared);
|
|
@@ -169,8 +169,6 @@ export interface SiteBrand {
|
|
|
169
169
|
siteName: string;
|
|
170
170
|
description: string;
|
|
171
171
|
copyrightHolder: string;
|
|
172
|
-
/** False when the hub's seo row turns search indexing off (`robots.index: false`). */
|
|
173
|
-
indexable: boolean;
|
|
174
172
|
}
|
|
175
173
|
|
|
176
174
|
/**
|
|
@@ -190,8 +188,7 @@ function oneLine(value: string): string {
|
|
|
190
188
|
* refilled from `_site.mdx` — `siteName` is `NEXT_PUBLIC_SITE_NAME`, else the
|
|
191
189
|
* hub `name`; `description` the hub's, else the seo row's, else the neutral
|
|
192
190
|
* fallback; `copyrightHolder` the hub `legalName`, else the hub `siteName`.
|
|
193
|
-
* Otherwise the module's constants, exactly.
|
|
194
|
-
* whether or not an identity row exists, and fails open. Never rejects.
|
|
191
|
+
* Otherwise the module's constants, exactly. Never rejects.
|
|
195
192
|
*/
|
|
196
193
|
export async function resolveSiteBrand(): Promise<SiteBrand> {
|
|
197
194
|
return brandFrom(await readHubSite());
|
|
@@ -199,14 +196,12 @@ export async function resolveSiteBrand(): Promise<SiteBrand> {
|
|
|
199
196
|
|
|
200
197
|
/** `resolveSiteBrand`'s rule over one hub read, so a caller holding the read derives the same brand. */
|
|
201
198
|
export function brandFrom(hub: HubSite | undefined): SiteBrand {
|
|
202
|
-
const indexable = hub?.seo?.robots?.index !== false;
|
|
203
199
|
const identity = hub?.identity;
|
|
204
200
|
if (!identity) {
|
|
205
201
|
return {
|
|
206
202
|
siteName: SITE_NAME,
|
|
207
203
|
description: SITE_DESCRIPTION,
|
|
208
204
|
copyrightHolder: COPYRIGHT_HOLDER,
|
|
209
|
-
indexable,
|
|
210
205
|
};
|
|
211
206
|
}
|
|
212
207
|
const siteName =
|
|
@@ -217,6 +212,5 @@ export function brandFrom(hub: HubSite | undefined): SiteBrand {
|
|
|
217
212
|
oneLine(identity.description ?? hub.seo?.description ?? "") ||
|
|
218
213
|
FALLBACK_SITE_DESCRIPTION,
|
|
219
214
|
copyrightHolder: oneLine(identity.legalName ?? "") || siteName,
|
|
220
|
-
indexable,
|
|
221
215
|
};
|
|
222
216
|
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* #11978 D2 — the site's one rule for Hidden (spec
|
|
3
|
+
* docs/specs/11978-one-site-visibility-control-with-spec.md).
|
|
4
|
+
*
|
|
5
|
+
* The site is Hidden when STEALTH is set on its hosting project (the hosting
|
|
6
|
+
* lock) or when the owner's Site visibility switch — the `site.discovery`
|
|
7
|
+
* row, read through `siteDiscoverable()` — is off. The middleware, the locale
|
|
8
|
+
* layout, mcp.json, openapi.json and `/api/site-status` all read it here, so
|
|
9
|
+
* the surfaces act on, and the status route reports, one answer.
|
|
10
|
+
*
|
|
11
|
+
* Edge-safe: it imports no `node:` module, so the middleware can load it.
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
import { siteDiscoverable } from "@working-theory/api-client";
|
|
15
|
+
import { parseStealth } from "@working-theory/web-i18n/stealth";
|
|
16
|
+
|
|
17
|
+
/** STEALTH's own header value, so Hidden is byte-for-byte what STEALTH sends. */
|
|
18
|
+
export const HIDDEN_ROBOTS_HEADER = "noindex, nofollow, noarchive";
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* `"hosting"` when STEALTH is set on the hosting project, else `null`. Read
|
|
22
|
+
* through the one shared parse, so an unknown value throws `StealthValueError`.
|
|
23
|
+
*/
|
|
24
|
+
export function siteLock(): "hosting" | null {
|
|
25
|
+
return parseStealth(process.env["STEALTH"]) ? "hosting" : null;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Whether the site is Hidden: the hosting lock, or the owner's switch off.
|
|
30
|
+
* Makes no hub read under the lock. The hub read never rejects
|
|
31
|
+
* (`siteDiscoverable`); an unknown STEALTH value rejects with
|
|
32
|
+
* `StealthValueError`, as it fails the build.
|
|
33
|
+
*/
|
|
34
|
+
export async function siteHidden(): Promise<boolean> {
|
|
35
|
+
return siteLock() !== null || !(await siteDiscoverable());
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* The discovery files' default `discoverable` dep: Live unless Hidden, so
|
|
40
|
+
* sitemap.xml and both llms.txt copies hide under STEALTH as well as the
|
|
41
|
+
* switch.
|
|
42
|
+
*/
|
|
43
|
+
export async function siteLive(): Promise<boolean> {
|
|
44
|
+
return !(await siteHidden());
|
|
45
|
+
}
|
|
@@ -712,6 +712,13 @@
|
|
|
712
712
|
"toolBulletList": "Bulleted list",
|
|
713
713
|
"toolNumberedList": "Numbered list",
|
|
714
714
|
"toolLink": "Link",
|
|
715
|
+
"toolTable": "Table",
|
|
716
|
+
"tableInsert": "Insert table",
|
|
717
|
+
"tableAddRow": "Add row below",
|
|
718
|
+
"tableDeleteRow": "Delete row",
|
|
719
|
+
"tableAddColumn": "Add column to the right",
|
|
720
|
+
"tableDeleteColumn": "Delete column",
|
|
721
|
+
"tableDelete": "Delete table",
|
|
715
722
|
"toolImage": "Insert image",
|
|
716
723
|
"toolView": "View",
|
|
717
724
|
"toolRendered": "Rendered — your words, formatted",
|
|
@@ -732,6 +739,7 @@
|
|
|
732
739
|
"bulletList": "Types - before each line → a bulleted list.",
|
|
733
740
|
"numberedList": "Types 1. before each line → a numbered list.",
|
|
734
741
|
"link": "Types [words](address) → a link.",
|
|
742
|
+
"table": "Makes a table; in Markdown, | between cells and | - | under the header. Click a cell, then use this menu to add or remove rows and columns.",
|
|
735
743
|
"insert": "A meeting, magnet, offer, FAQ or image from your library. AI uses these when it lays out the page.",
|
|
736
744
|
"changes": "Compare your unsaved edits with the last save."
|
|
737
745
|
},
|
|
@@ -43,6 +43,12 @@
|
|
|
43
43
|
// base, so old links keep working. A site with no `services.path` takes none
|
|
44
44
|
// of these branches.
|
|
45
45
|
//
|
|
46
|
+
// Site visibility (#11978 D2). While the site is Hidden — STEALTH on the
|
|
47
|
+
// hosting project, or the owner's switch off — every response this middleware
|
|
48
|
+
// returns, on every branch, carries `X-Robots-Tag: noindex, nofollow,
|
|
49
|
+
// noarchive`, the value STEALTH's next.config.mjs rule sends. `siteHidden()` is
|
|
50
|
+
// awaited once per request; its hub read is shared per instance for 15 s.
|
|
51
|
+
//
|
|
46
52
|
// S16 spec: docs/internal/specs/ailk-pre-oss-security-phase-3-s16-security-headers-spec.md
|
|
47
53
|
// S2 spec: docs/internal/specs/i18n-phase1-s2-next-intl-foundation-spec.md
|
|
48
54
|
// P2 S1 spec: docs/internal/specs/i18n-phase2-s1-hreflang-metadata-spec.md §3
|
|
@@ -69,6 +75,7 @@ import {
|
|
|
69
75
|
toInternalServicesPath,
|
|
70
76
|
toPublicServicesHref,
|
|
71
77
|
} from "./lib/services-path";
|
|
78
|
+
import { HIDDEN_ROBOTS_HEADER, siteHidden } from "./lib/site-visibility";
|
|
72
79
|
import {
|
|
73
80
|
DEFAULT_SECURITY_HEADERS,
|
|
74
81
|
ONE_TAP_SECURITY_HEADERS,
|
|
@@ -185,7 +192,7 @@ const FILE_ROUTE_SECURITY_HEADERS: Readonly<Record<string, string>> =
|
|
|
185
192
|
),
|
|
186
193
|
);
|
|
187
194
|
|
|
188
|
-
|
|
195
|
+
function route(request: NextRequest): NextResponse {
|
|
189
196
|
// Step 1: Forward x-pathname to server components so generateMetadata can
|
|
190
197
|
// build path-aware hreflang alternates (P2 S1). Clone the request headers
|
|
191
198
|
// and inject the pathname before running next-intl so the rewritten URL
|
|
@@ -291,6 +298,14 @@ export function middleware(request: NextRequest): NextResponse {
|
|
|
291
298
|
return intlResponse;
|
|
292
299
|
}
|
|
293
300
|
|
|
301
|
+
export async function middleware(request: NextRequest): Promise<NextResponse> {
|
|
302
|
+
const hidden = await siteHidden();
|
|
303
|
+
const response = route(request);
|
|
304
|
+
// #11978 D2 — Hidden replaces a `!PUBLIC_PAGES` noindex, never removes it.
|
|
305
|
+
if (hidden) response.headers.set("X-Robots-Tag", HIDDEN_ROBOTS_HEADER);
|
|
306
|
+
return response;
|
|
307
|
+
}
|
|
308
|
+
|
|
294
309
|
// Skip Next.js internal assets and public/ files — security headers attach to
|
|
295
310
|
// user-facing routes and API handlers, not framework or static asset endpoints.
|
|
296
311
|
// Also exclude next-intl-specific internal paths (_next/server).
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Shared route utilities for agent-surface discovery routes.
|
|
3
3
|
*
|
|
4
|
-
* Extracted from llms.txt, sitemap.xml
|
|
5
|
-
*
|
|
4
|
+
* Extracted from the llms.txt, sitemap.xml and robots.txt handlers to avoid
|
|
5
|
+
* copy-paste duplication.
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
8
|
import { pagePath, renamedPath, routeFor } from "@working-theory/templates/routes";
|
|
@@ -21,7 +21,7 @@ import { SITE_BASE_URL } from "../../lib/site-brand";
|
|
|
21
21
|
* expect a per-call env read, the same contract this function had before
|
|
22
22
|
* #4157; a frozen snapshot would silently stop honoring an env var set
|
|
23
23
|
* after this module first loaded. Every caller runs in the Node.js runtime
|
|
24
|
-
* (none of robots.txt/sitemap.xml/llms.txt/
|
|
24
|
+
* (none of robots.txt/sitemap.xml/llms.txt/mcp.json/layout
|
|
25
25
|
* declares `runtime = "edge"`), so the frontmatter-derived fallback
|
|
26
26
|
* (`SITE_BASE_URL`, when no env override is set) is safe here.
|
|
27
27
|
*/
|
package/versions.json
CHANGED
|
@@ -1,69 +1,69 @@
|
|
|
1
1
|
{
|
|
2
|
-
"@working-theory/account": "0.
|
|
3
|
-
"@working-theory/admin-ui": "0.
|
|
4
|
-
"@working-theory/aeo": "0.
|
|
5
|
-
"@working-theory/agent-context": "0.
|
|
2
|
+
"@working-theory/account": "0.74.0",
|
|
3
|
+
"@working-theory/admin-ui": "0.74.0",
|
|
4
|
+
"@working-theory/aeo": "0.74.0",
|
|
5
|
+
"@working-theory/agent-context": "0.74.0",
|
|
6
6
|
"@working-theory/agent-contract": "0.1.0",
|
|
7
7
|
"@working-theory/agent-memory": "0.0.0",
|
|
8
8
|
"@working-theory/ai": "0.1.0",
|
|
9
|
-
"@working-theory/analytics": "0.
|
|
10
|
-
"@working-theory/api": "0.
|
|
11
|
-
"@working-theory/api-client": "0.
|
|
12
|
-
"@working-theory/auth": "0.
|
|
9
|
+
"@working-theory/analytics": "0.74.0",
|
|
10
|
+
"@working-theory/api": "0.74.0",
|
|
11
|
+
"@working-theory/api-client": "0.74.0",
|
|
12
|
+
"@working-theory/auth": "0.74.0",
|
|
13
13
|
"@working-theory/cda-filesystem": "0.0.0",
|
|
14
|
-
"@working-theory/cli": "0.
|
|
15
|
-
"@working-theory/common": "0.
|
|
14
|
+
"@working-theory/cli": "0.74.0",
|
|
15
|
+
"@working-theory/common": "0.74.0",
|
|
16
16
|
"@working-theory/consent": "0.1.0",
|
|
17
|
-
"@working-theory/content-adapters": "0.
|
|
18
|
-
"@working-theory/content-projection": "0.
|
|
19
|
-
"@working-theory/email": "0.
|
|
17
|
+
"@working-theory/content-adapters": "0.74.0",
|
|
18
|
+
"@working-theory/content-projection": "0.74.0",
|
|
19
|
+
"@working-theory/email": "0.74.0",
|
|
20
20
|
"@working-theory/env": "0.0.0",
|
|
21
|
-
"@working-theory/eslint-config": "0.
|
|
22
|
-
"@working-theory/fumadocs-schema": "0.
|
|
23
|
-
"@working-theory/ids": "0.
|
|
24
|
-
"@working-theory/jsonld": "0.
|
|
25
|
-
"@working-theory/license": "0.
|
|
26
|
-
"@working-theory/mcp-server": "0.
|
|
27
|
-
"@working-theory/metadata": "0.
|
|
28
|
-
"@working-theory/observability": "0.
|
|
29
|
-
"@working-theory/page-renderer": "0.
|
|
21
|
+
"@working-theory/eslint-config": "0.74.0",
|
|
22
|
+
"@working-theory/fumadocs-schema": "0.74.0",
|
|
23
|
+
"@working-theory/ids": "0.23.0",
|
|
24
|
+
"@working-theory/jsonld": "0.74.0",
|
|
25
|
+
"@working-theory/license": "0.74.0",
|
|
26
|
+
"@working-theory/mcp-server": "0.74.0",
|
|
27
|
+
"@working-theory/metadata": "0.74.0",
|
|
28
|
+
"@working-theory/observability": "0.74.0",
|
|
29
|
+
"@working-theory/page-renderer": "0.74.0",
|
|
30
30
|
"@working-theory/plugin-mcp": "0.1.3",
|
|
31
|
-
"@working-theory/schema": "0.
|
|
32
|
-
"@working-theory/schema-pack-registry": "0.
|
|
33
|
-
"@working-theory/schema-validator": "0.
|
|
34
|
-
"@working-theory/sections-registry": "0.
|
|
35
|
-
"@working-theory/site-config": "0.
|
|
36
|
-
"@working-theory/site-pages": "0.
|
|
37
|
-
"@working-theory/spoke-checkout": "0.7.
|
|
38
|
-
"@working-theory/stripe-client": "0.
|
|
39
|
-
"@working-theory/templates": "0.
|
|
40
|
-
"@working-theory/theme": "0.
|
|
41
|
-
"@working-theory/ui": "0.
|
|
42
|
-
"@working-theory/validation": "0.
|
|
43
|
-
"@working-theory/web-i18n": "0.
|
|
44
|
-
"@working-theory/admin": "0.
|
|
45
|
-
"@working-theory/api-commerce": "0.2.
|
|
46
|
-
"@working-theory/api-content-write": "0.
|
|
47
|
-
"@working-theory/api-hub": "0.
|
|
48
|
-
"@working-theory/api-multi-tenant": "0.
|
|
49
|
-
"@working-theory/api-scheduling": "0.6.
|
|
50
|
-
"@working-theory/api-signal-collectors": "0.7.
|
|
51
|
-
"@working-theory/api-workspace": "0.
|
|
31
|
+
"@working-theory/schema": "0.74.0",
|
|
32
|
+
"@working-theory/schema-pack-registry": "0.74.0",
|
|
33
|
+
"@working-theory/schema-validator": "0.74.0",
|
|
34
|
+
"@working-theory/sections-registry": "0.74.0",
|
|
35
|
+
"@working-theory/site-config": "0.74.0",
|
|
36
|
+
"@working-theory/site-pages": "0.74.0",
|
|
37
|
+
"@working-theory/spoke-checkout": "0.7.30",
|
|
38
|
+
"@working-theory/stripe-client": "0.74.0",
|
|
39
|
+
"@working-theory/templates": "0.74.0",
|
|
40
|
+
"@working-theory/theme": "0.74.0",
|
|
41
|
+
"@working-theory/ui": "0.74.0",
|
|
42
|
+
"@working-theory/validation": "0.74.0",
|
|
43
|
+
"@working-theory/web-i18n": "0.74.0",
|
|
44
|
+
"@working-theory/admin": "0.25.0",
|
|
45
|
+
"@working-theory/api-commerce": "0.2.8",
|
|
46
|
+
"@working-theory/api-content-write": "0.16.0",
|
|
47
|
+
"@working-theory/api-hub": "0.8.0",
|
|
48
|
+
"@working-theory/api-multi-tenant": "0.5.0",
|
|
49
|
+
"@working-theory/api-scheduling": "0.6.13",
|
|
50
|
+
"@working-theory/api-signal-collectors": "0.7.3",
|
|
51
|
+
"@working-theory/api-workspace": "0.18.0",
|
|
52
52
|
"@working-theory/billing-client": "0.0.0",
|
|
53
53
|
"@working-theory/branding": "0.0.0",
|
|
54
54
|
"@working-theory/license-client": "0.0.0",
|
|
55
55
|
"@working-theory/license-manifest": "0.0.0",
|
|
56
|
-
"@working-theory/mcp-scheduling": "0.4.
|
|
57
|
-
"@working-theory/mcp-signal-collectors": "0.2.
|
|
58
|
-
"@working-theory/mcp-workspace": "0.
|
|
56
|
+
"@working-theory/mcp-scheduling": "0.4.15",
|
|
57
|
+
"@working-theory/mcp-signal-collectors": "0.2.28",
|
|
58
|
+
"@working-theory/mcp-workspace": "0.16.0",
|
|
59
59
|
"@working-theory/partner-session": "0.0.0",
|
|
60
60
|
"@working-theory/preview-protocol": "0.0.0",
|
|
61
|
-
"@working-theory/ui-commerce": "0.
|
|
62
|
-
"@working-theory/ui-docs-blog": "0.
|
|
63
|
-
"@working-theory/ui-scheduling": "0.
|
|
64
|
-
"@working-theory/ui-signal-collectors": "0.
|
|
61
|
+
"@working-theory/ui-commerce": "0.74.0",
|
|
62
|
+
"@working-theory/ui-docs-blog": "0.74.0",
|
|
63
|
+
"@working-theory/ui-scheduling": "0.74.0",
|
|
64
|
+
"@working-theory/ui-signal-collectors": "0.74.0",
|
|
65
65
|
"@working-theory/web": "0.0.0",
|
|
66
66
|
"@working-theory/app-api": "1.0.0",
|
|
67
67
|
"@working-theory/mcp": "0.0.0",
|
|
68
|
-
"@working-theory/database": "0.
|
|
68
|
+
"@working-theory/database": "0.74.0"
|
|
69
69
|
}
|
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* GET /.well-known/ai-plugin.json
|
|
3
|
-
*
|
|
4
|
-
* Returns the agent plugin manifest for AILK. The shape conforms to the
|
|
5
|
-
* AgentPluginManifestSchema defined in @working-theory/agent-contract.
|
|
6
|
-
*
|
|
7
|
-
* Fields with no source today default to 'none' / placeholder values and
|
|
8
|
-
* are documented here for Phase 2 enrichment:
|
|
9
|
-
* - logo_url: no asset yet; omitted
|
|
10
|
-
* - contact_email: no org email configured; omitted
|
|
11
|
-
* - legal_info_url: no legal page yet; omitted
|
|
12
|
-
* - api.url: /openapi.json on this same origin, served by `app/openapi.json`,
|
|
13
|
-
* which proxies apps/api's `/v1/openapi.json` (#7396)
|
|
14
|
-
*
|
|
15
|
-
* ─── Consumer re-validation expectation ─────────────────────────────────────
|
|
16
|
-
* This manifest is published over a public, cacheable HTTP route. Consumers
|
|
17
|
-
* (LLM agents, gateways, validators) MUST re-verify the manifest contents at
|
|
18
|
-
* fetch time — DO NOT trust a cached or out-of-band copy. In particular:
|
|
19
|
-
*
|
|
20
|
-
* - `description_for_model`: an agent host should bound its length and
|
|
21
|
-
* scan for prompt-injection patterns before passing it into a model
|
|
22
|
-
* context window.
|
|
23
|
-
* - `auth`: confirm the declared scheme matches the API's actual auth
|
|
24
|
-
* enforcement at the OpenAPI endpoint.
|
|
25
|
-
* - `api.url`: re-fetch the OpenAPI spec and validate the schema before
|
|
26
|
-
* synthesizing tool definitions.
|
|
27
|
-
*
|
|
28
|
-
* See `docs/security/agent-manifest.md` for the full consumer guidance.
|
|
29
|
-
*/
|
|
30
|
-
|
|
31
|
-
import { siteDiscoverable } from "@working-theory/api-client";
|
|
32
|
-
|
|
33
|
-
import { SITE_DESCRIPTION, SITE_NAME } from "../../../lib/site-brand";
|
|
34
|
-
import { resolveBaseUrl } from "../../../src/lib/routes";
|
|
35
|
-
|
|
36
|
-
// #10510 D4 — read per request: the owner's discovery switch is a runtime
|
|
37
|
-
// setting a prerendered file could never follow.
|
|
38
|
-
export const dynamic = "force-dynamic";
|
|
39
|
-
|
|
40
|
-
/** Soft cap to detect runaway `description_for_model` growth. */
|
|
41
|
-
export const DESCRIPTION_FOR_MODEL_SOFT_CAP_CHARS = 8_000;
|
|
42
|
-
|
|
43
|
-
// #4157 — SITE_NAME-based, and no longer describes AILK's own commercial
|
|
44
|
-
// model ("purchase a license"): that claim was never true of a customer's
|
|
45
|
-
// scaffolded site, which doesn't sell AILK licenses.
|
|
46
|
-
const MANIFEST_DESCRIPTION_FOR_MODEL = `${SITE_NAME} is an AI-native site built with API + MCP as canonical agent surfaces. Use it to explore the site's content and available tools.`;
|
|
47
|
-
|
|
48
|
-
/**
|
|
49
|
-
* Validates that a manifest's `description_for_model` is within reasonable
|
|
50
|
-
* bounds. Logs a warning when oversized; returns a boolean for callers that
|
|
51
|
-
* want to short-circuit (we choose to still serve the manifest, since
|
|
52
|
-
* truncating silently would be worse than warning).
|
|
53
|
-
*/
|
|
54
|
-
export function validateDescriptionForModel(description: string): boolean {
|
|
55
|
-
if (description.length > DESCRIPTION_FOR_MODEL_SOFT_CAP_CHARS) {
|
|
56
|
-
console.warn(
|
|
57
|
-
`[ai-plugin.json] description_for_model exceeds soft cap (${description.length} > ${DESCRIPTION_FOR_MODEL_SOFT_CAP_CHARS} chars). Consumers may rate-limit or reject oversized manifests.`,
|
|
58
|
-
);
|
|
59
|
-
return false;
|
|
60
|
-
}
|
|
61
|
-
return true;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
// Startup-time validation: fire once on module load so over-sized manifests
|
|
65
|
-
// are flagged before the first request lands.
|
|
66
|
-
validateDescriptionForModel(MANIFEST_DESCRIPTION_FOR_MODEL);
|
|
67
|
-
|
|
68
|
-
export async function GET(): Promise<Response> {
|
|
69
|
-
// #10510 D4 — hidden by the owner: 404, never cached.
|
|
70
|
-
if (!(await siteDiscoverable())) return new Response(null, { status: 404, headers: { "cache-control": "no-store" } });
|
|
71
|
-
const baseUrl = resolveBaseUrl();
|
|
72
|
-
|
|
73
|
-
const manifest = {
|
|
74
|
-
schema_version: "v1",
|
|
75
|
-
name_for_human: SITE_NAME,
|
|
76
|
-
name_for_model: "ai_launch_kit",
|
|
77
|
-
// #8085 — the site's own description, as /.well-known/mcp.json (#8057).
|
|
78
|
-
description_for_human: SITE_DESCRIPTION,
|
|
79
|
-
description_for_model: MANIFEST_DESCRIPTION_FOR_MODEL,
|
|
80
|
-
auth: { type: "none" },
|
|
81
|
-
api: {
|
|
82
|
-
type: "openapi",
|
|
83
|
-
url: `${baseUrl}/openapi.json`,
|
|
84
|
-
},
|
|
85
|
-
};
|
|
86
|
-
|
|
87
|
-
return Response.json(manifest, {
|
|
88
|
-
status: 200,
|
|
89
|
-
headers: {
|
|
90
|
-
"cache-control": "public, max-age=86400",
|
|
91
|
-
},
|
|
92
|
-
});
|
|
93
|
-
}
|