create-ailk 0.45.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.
Files changed (42) hide show
  1. package/README.md +6 -3
  2. package/component-catalog.json +24 -1
  3. package/component-catalog.md +6 -5
  4. package/dist/lib/env-catalog.js +1 -1
  5. package/dist/lib/import-mdx.js +10 -2
  6. package/dist/seed-workspace.d.ts +1 -1
  7. package/dist/seed-workspace.js +10 -3
  8. package/dist/surfaces.js +1 -1
  9. package/package.json +3 -3
  10. package/templates/apps/api/.env.example +23 -0
  11. package/templates/apps/api/CLAUDE.md +13 -6
  12. package/templates/apps/api/src/lib/__mocks__/prisma.ts +11 -0
  13. package/templates/apps/mcp/.env.example +8 -0
  14. package/templates/apps/mcp/CLAUDE.md +22 -6
  15. package/templates/apps/web/.env.example +1 -1
  16. package/templates/apps/web/CLAUDE.md +47 -16
  17. package/templates/apps/web/app/.well-known/mcp.json/route.ts +6 -7
  18. package/templates/apps/web/app/[locale]/layout.tsx +10 -7
  19. package/templates/apps/web/app/api/site-status/__tests__/route.test.ts +120 -0
  20. package/templates/apps/web/app/api/site-status/route.ts +62 -0
  21. package/templates/apps/web/app/llms.txt/route.ts +3 -3
  22. package/templates/apps/web/app/openapi.json/__tests__/route.test.ts +21 -4
  23. package/templates/apps/web/app/openapi.json/route.ts +10 -9
  24. package/templates/apps/web/app/sitemap.xml/route.ts +3 -3
  25. package/templates/apps/web/auth.ts +25 -1
  26. package/templates/apps/web/lib/__tests__/fixtures/mcp-stub-server.ts +10 -3
  27. package/templates/apps/web/lib/__tests__/mcp-served-tools.test.ts +61 -0
  28. package/templates/apps/web/lib/__tests__/offerings-pricing.test.ts +112 -0
  29. package/templates/apps/web/lib/__tests__/pricing-page.test.ts +280 -0
  30. package/templates/apps/web/lib/__tests__/site-brand.test.ts +5 -6
  31. package/templates/apps/web/lib/__tests__/site-visibility.test.ts +64 -0
  32. package/templates/apps/web/lib/mcp-oauth.ts +64 -0
  33. package/templates/apps/web/lib/mcp-served-tools.ts +51 -9
  34. package/templates/apps/web/lib/offerings-pricing.ts +30 -6
  35. package/templates/apps/web/lib/pricing-page.ts +142 -35
  36. package/templates/apps/web/lib/site-brand.tsx +1 -7
  37. package/templates/apps/web/lib/site-visibility.ts +45 -0
  38. package/templates/apps/web/messages/en.json +8 -0
  39. package/templates/apps/web/middleware.ts +16 -1
  40. package/templates/apps/web/src/lib/routes.ts +3 -3
  41. package/versions.json +51 -51
  42. package/templates/apps/web/app/.well-known/ai-plugin.json/route.ts +0 -93
@@ -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
- }