create-ailk 0.41.0 → 0.42.1
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 +31 -1
- package/component-catalog.json +6 -0
- package/dist/add-route.d.ts +2 -6
- package/dist/add-route.js +2 -43
- package/dist/export-content.d.ts +10 -3
- package/dist/export-content.js +61 -9
- package/dist/language-import.js +5 -2
- package/dist/lib/env-catalog.js +4 -0
- package/dist/lib/import-mdx.d.ts +2 -0
- package/dist/lib/import-mdx.js +46 -22
- package/dist/magnet-page.d.ts +36 -0
- package/dist/magnet-page.js +70 -0
- package/dist/migrate-content.d.ts +12 -3
- package/dist/migrate-content.js +62 -11
- package/dist/routes.d.ts +38 -2
- package/dist/routes.js +586 -27
- package/dist/surfaces.d.ts +16 -0
- package/dist/surfaces.js +36 -0
- package/dist/update.d.ts +1 -1
- package/dist/update.js +24 -2
- package/package.json +3 -3
- package/templates/.claude/hooks/template-guard.sh +145 -36
- package/templates/CLAUDE.md +1 -1
- package/templates/apps/api/CLAUDE.md +2 -0
- package/templates/apps/mcp/CLAUDE.md +9 -3
- package/templates/apps/web/CLAUDE.md +16 -2
- package/templates/apps/web/app/[locale]/layout.tsx +6 -3
- package/templates/apps/web/app/llms.txt/__tests__/site-listing.test.ts +28 -0
- package/templates/apps/web/app/sitemap.xml/__tests__/site-listing.test.ts +28 -0
- package/templates/apps/web/lib/__tests__/page-chrome.test.ts +24 -0
- package/templates/apps/web/lib/__tests__/route-paths.test.ts +57 -0
- package/templates/apps/web/lib/mcp-oauth.ts +14 -10
- package/templates/apps/web/lib/page-chrome.ts +8 -5
- package/templates/apps/web/lib/route-paths.ts +22 -0
- package/templates/apps/web/lib/services-path.ts +27 -18
- package/templates/apps/web/middleware.ts +2 -1
- package/templates/apps/web/next.config.mjs +123 -2
- package/templates/apps/web/src/lib/routes.ts +4 -2
- package/versions.json +51 -51
package/dist/surfaces.d.ts
CHANGED
|
@@ -55,6 +55,22 @@ export declare const PAGE_PACKAGE_ROUTES: readonly {
|
|
|
55
55
|
}[];
|
|
56
56
|
/** The page package that ships `route` (a ROUTE_ROOT-relative dir), or `undefined` when no page package does. */
|
|
57
57
|
export declare function pagePackageOfRoute(route: string): string | undefined;
|
|
58
|
+
/**
|
|
59
|
+
* #11385 D6 — the route families a site may rename with `<family>: { path:
|
|
60
|
+
* /<segment> }` in `content/_site.mdx`, family key → convention segment. A
|
|
61
|
+
* copy of `@working-theory/site-config`'s record (create-ailk imports nothing
|
|
62
|
+
* at runtime); `tests/routes/route-renames-parity.test.ts` pins the two equal.
|
|
63
|
+
*/
|
|
64
|
+
export declare const RENAMABLE_ROUTE_FAMILIES: Readonly<Record<string, string>>;
|
|
65
|
+
/** #11385 D6 — first segments no rename may take; a copy of site-config's `RESERVED_ROUTE_SEGMENTS`. */
|
|
66
|
+
export declare const RESERVED_ROUTE_SEGMENTS: readonly string[];
|
|
67
|
+
/**
|
|
68
|
+
* #11385 D7 — the first segment of every `@working-theory/templates` `ROUTES`
|
|
69
|
+
* row and of every legacy route it still redirects from, sorted: the routes a
|
|
70
|
+
* rename may not take. A copy (create-ailk cannot
|
|
71
|
+
* read `ROUTES` at runtime); the parity test pins it to the routes map.
|
|
72
|
+
*/
|
|
73
|
+
export declare const ROUTES_FIRST_SEGMENTS: readonly string[];
|
|
58
74
|
/** Template-relative route directories that are always copied. */
|
|
59
75
|
export declare const CORE_ROUTE_DIRS: readonly string[];
|
|
60
76
|
/**
|
package/dist/surfaces.js
CHANGED
|
@@ -250,6 +250,42 @@ export function pagePackageOfRoute(route) {
|
|
|
250
250
|
}
|
|
251
251
|
return best?.package;
|
|
252
252
|
}
|
|
253
|
+
/**
|
|
254
|
+
* #11385 D6 — the route families a site may rename with `<family>: { path:
|
|
255
|
+
* /<segment> }` in `content/_site.mdx`, family key → convention segment. A
|
|
256
|
+
* copy of `@working-theory/site-config`'s record (create-ailk imports nothing
|
|
257
|
+
* at runtime); `tests/routes/route-renames-parity.test.ts` pins the two equal.
|
|
258
|
+
*/
|
|
259
|
+
export const RENAMABLE_ROUTE_FAMILIES = Object.freeze({
|
|
260
|
+
meet: "meet",
|
|
261
|
+
caseStudies: "case-studies",
|
|
262
|
+
portfolio: "portfolio",
|
|
263
|
+
team: "team",
|
|
264
|
+
courses: "courses",
|
|
265
|
+
events: "events",
|
|
266
|
+
integrations: "integrations",
|
|
267
|
+
partners: "partners",
|
|
268
|
+
features: "features",
|
|
269
|
+
products: "products",
|
|
270
|
+
resources: "resources",
|
|
271
|
+
for: "for",
|
|
272
|
+
});
|
|
273
|
+
/** #11385 D6 — first segments no rename may take; a copy of site-config's `RESERVED_ROUTE_SEGMENTS`. */
|
|
274
|
+
export const RESERVED_ROUTE_SEGMENTS = Object.freeze(["api", "og", "v1", "apple-icon"]);
|
|
275
|
+
/**
|
|
276
|
+
* #11385 D7 — the first segment of every `@working-theory/templates` `ROUTES`
|
|
277
|
+
* row and of every legacy route it still redirects from, sorted: the routes a
|
|
278
|
+
* rename may not take. A copy (create-ailk cannot
|
|
279
|
+
* read `ROUTES` at runtime); the parity test pins it to the routes map.
|
|
280
|
+
*/
|
|
281
|
+
export const ROUTES_FIRST_SEGMENTS = Object.freeze([
|
|
282
|
+
"about", "account", "alternatives", "appointments", "blog", "careers", "case-studies", "clients", "consent",
|
|
283
|
+
"contact", "courses", "docs", "downloads", "events", "faq", "features", "flows", "for", "forgot-password", "glossary",
|
|
284
|
+
"how-to", "integrations", "launch-service", "meet", "newsletter", "partners", "portfolio", "pricing", "privacy",
|
|
285
|
+
"private", "products", "projects", "purchase", "purchase-policy", "reports", "reset-password", "resources",
|
|
286
|
+
"schedule", "services", "sign-in", "sign-up", "software", "team", "tech-articles", "templates", "terms", "testimonials",
|
|
287
|
+
"thanks", "trial", "unsubscribe", "verify-email", "vs", "whitepapers", "working-agreement",
|
|
288
|
+
]);
|
|
253
289
|
/** Template-relative route directories that are always copied. */
|
|
254
290
|
export const CORE_ROUTE_DIRS = [
|
|
255
291
|
`${ROUTE_ROOT}/about`,
|
package/dist/update.d.ts
CHANGED
|
@@ -183,6 +183,6 @@ export interface UpdateArgs {
|
|
|
183
183
|
target: string | undefined;
|
|
184
184
|
help: boolean;
|
|
185
185
|
}
|
|
186
|
-
export declare const UPDATE_HELP = "create-ailk update \u2014 bring template fixes into a site's copied app code.\n\nUsage:\n create-ailk update [<target-dir>]\n\nArguments:\n <target-dir> The existing site. Defaults to the current dir.\n\nOptions:\n --help, -h Print this message.\n\nReads .ailk-template-files.json (written beside .ailk-site-manifest.json by\nevery template scaffold) to tell an untouched copy from an edit. An\nuntouched apps/web, apps/api or apps/mcp file, or a root tools/jest file the\napp jest configs require, whose template copy changed is overwritten. An\nedited file whose template copy also changed is three-way merged with\n`git` (git must be on PATH); a conflict leaves the file alone and is\nlisted under \"Needs review\"; an apps/web/messages catalog instead gains the\ntemplate's new keys and keeps every value it has \u2014 also when its recorded\nversion's copy cannot be read \u2014 and is reviewed only when a key is an object\non one side and a value on the other; a written apps/web file that uses\nthrough t(...) a key the catalog then lacks is held with it, listed under\n\"Held back with <catalog>\". Each @working-theory/* package a written apps/web\nfile imports that apps/web/package.json does not declare is added to its\ndependencies at this release's version. An edited file whose\nbytes are another published create-ailk version's copy is a stale copy, not\nan edit: it is overwritten or removed as an untouched file is, listed with\nthe version it matched. An edit that touches only comment lines is listed as\n\"comment-only edit\"; on a conflict the template's copy lands. A file at a\ntemplate path that is not in the record (one an earlier sync-routes --apply\nor add-route copied without recording it) whose bytes are a published\ncreate-ailk version's copy \u2014 from the version the site was scaffolded at to\nthis one \u2014 is adopted: recorded and moved forward as an untouched file is,\nlisted under \"Adopted\" with the version it matched. One whose bytes are the\nrunning copy with this site's modules' patches applied (a module's\njest.config.cjs or next.config.mjs edit) is left as it is and not listed.\nOne whose bytes match no published copy is a site edit: skipped, never overwritten, and counted under\n\"Held as site edits, not in the record\". No file under a route the site\nlists in customizations.yaml declined_routes is written: each is listed under\n\"Skipped\" naming the declined route. Every template\ntest, and every site-edited template file, that imports a file left under\n\"Needs review\" (by a relative or @/ import, transitively) is held\nat the site's version with it, its record entry is not advanced, and it is\nlisted under \"Held back with <file>\" \u2014 reconcile the file, then run update\nagain to bring it forward. A skipped file never holds another. A file whose\nown bytes are the record's is not held by what it imports: it moves, unless\nit names an export the held copy lacks, and the held file is listed as\n\"Held back: <file> \u2014 imported by N moved files; the site edit is <hunk\nsummary>\". A written file whose import names a file the site lacks gets it\nadded when this template supplies it; otherwise it is held the same way,\nunder \"Held back with <file> (not in this site)\", unless its own copy\nalready named the file \u2014 then it moves and the path is listed under \"Not in\nthis site or the template: <file>\". A file the template removed is kept\nwhile any file still in the site imports it. A file a customizations.yaml\nentry records is never removed, nor anything it imports: it keeps its record\nrow and is listed under \"Skipped\" as kept. Every other file in the run\nstill updates. When project.yaml has an env_contract block, each\nenv var the written files read that has no row gains one; no row is edited.\nA record row at a path create-ailk no longer records is dropped and listed.\nA surface the site's .ailk-site-manifest.json names a page on but\narchitecture.yaml does not declare (one no module owns, such as projects)\ngets its route files added and is declared, listed under \"Surfaces declared\nfrom the roster\". A code-route row of that roster no page file serves is\ndropped, listed under \"Roster rows dropped, no route serves them\".\nA site with no record gets one on its first run, from the version its\n.ailk-site-manifest.json already records. A site scaffolded before\n@working-theory/mcp-server has its copied apps/mcp moved to the boot set:\nthe server and each module's paid MCP pack join apps/mcp/package.json, the\ncopied server files go, and apps/mcp/src/lib/paid-tools.generated.ts is\nrewritten on every run. A site scaffolded before @working-theory/api has its\ncopied apps/api moved to the boot file: the app becomes @working-theory/app-api,\nthe package and the six @working-theory/api-<module> packages join\napps/api/package.json, its bins and build:vercel delegate to the package, and\nthe copied server files go. Run `pnpm install` after either move, since the\napp's package.json gained dependencies. Each mdx-body page in content/ with no\n'# ' heading gets its title and description written into its body as its\nheading and intro, listed under \"Page heading added\"; a page with one heading\nis left as it is, and one with several, or one whose frontmatter it cannot\nread, is listed under \"Needs review\". Each bare { on an mdx-body page is\nescaped as \\{ when the site's own MDX parser then reads the page clean, listed\nunder \"Placeholder brace escaped\"; a page it cannot escape safely, or any page\nwith one while the site's dependencies are not installed, is listed under\n\"Needs review\". Each topology seam (*.generated.* \u2014 the web seam, the\n(authed) gate, the API origin and the MCP seam) is rendered again for the\ntopology and sign-in mode .ailk-site-manifest.json records and listed under\n\"Regenerated\", when its bytes are still the render .ailk-template-files.json\nrecords; one edited by hand, or with no recorded render, is listed under\n\"Needs review\" and left as it is. Last, the generated route files of every installed page\npackage (one whose package.json declares \"ailk\": { \"routes\" }) are rewritten\nfrom its manifest, listed under \"Route files regenerated\"; run\n`create-ailk routes --write` after the install when the packages were not\ninstalled yet. Commit before running
|
|
186
|
+
export declare const UPDATE_HELP = "create-ailk update \u2014 bring template fixes into a site's copied app code.\n\nUsage:\n create-ailk update [<target-dir>]\n\nArguments:\n <target-dir> The existing site. Defaults to the current dir.\n\nOptions:\n --help, -h Print this message.\n\nReads .ailk-template-files.json (written beside .ailk-site-manifest.json by\nevery template scaffold) to tell an untouched copy from an edit. An\nuntouched apps/web, apps/api or apps/mcp file, or a root tools/jest file the\napp jest configs require, whose template copy changed is overwritten. An\nedited file whose template copy also changed is three-way merged with\n`git` (git must be on PATH); a conflict leaves the file alone and is\nlisted under \"Needs review\"; an apps/web/messages catalog instead gains the\ntemplate's new keys and keeps every value it has \u2014 also when its recorded\nversion's copy cannot be read \u2014 and is reviewed only when a key is an object\non one side and a value on the other; a written apps/web file that uses\nthrough t(...) a key the catalog then lacks is held with it, listed under\n\"Held back with <catalog>\". Each @working-theory/* package a written apps/web\nfile imports that apps/web/package.json does not declare is added to its\ndependencies at this release's version. An edited file whose\nbytes are another published create-ailk version's copy is a stale copy, not\nan edit: it is overwritten or removed as an untouched file is, listed with\nthe version it matched. An edit that touches only comment lines is listed as\n\"comment-only edit\"; on a conflict the template's copy lands. A file at a\ntemplate path that is not in the record (one an earlier sync-routes --apply\nor add-route copied without recording it) whose bytes are a published\ncreate-ailk version's copy \u2014 from the version the site was scaffolded at to\nthis one \u2014 is adopted: recorded and moved forward as an untouched file is,\nlisted under \"Adopted\" with the version it matched. One whose bytes are the\nrunning copy with this site's modules' patches applied (a module's\njest.config.cjs or next.config.mjs edit) is left as it is and not listed.\nOne whose bytes match no published copy is a site edit: skipped, never overwritten, and counted under\n\"Held as site edits, not in the record\". No file under a route the site\nlists in customizations.yaml declined_routes is written: each is listed under\n\"Skipped\" naming the declined route. Every template\ntest, and every site-edited template file, that imports a file left under\n\"Needs review\" (by a relative or @/ import, transitively) is held\nat the site's version with it, its record entry is not advanced, and it is\nlisted under \"Held back with <file>\" \u2014 reconcile the file, then run update\nagain to bring it forward. A skipped file never holds another. A file whose\nown bytes are the record's is not held by what it imports: it moves, unless\nit names an export the held copy lacks, and the held file is listed as\n\"Held back: <file> \u2014 imported by N moved files; the site edit is <hunk\nsummary>\". A written file whose import names a file the site lacks gets it\nadded when this template supplies it; otherwise it is held the same way,\nunder \"Held back with <file> (not in this site)\", unless its own copy\nalready named the file \u2014 then it moves and the path is listed under \"Not in\nthis site or the template: <file>\". A file the template removed is kept\nwhile any file still in the site imports it. A file a customizations.yaml\nentry records is never removed, nor anything it imports: it keeps its record\nrow and is listed under \"Skipped\" as kept. Every other file in the run\nstill updates. When project.yaml has an env_contract block, each\nenv var the written files read that has no row gains one; no row is edited.\nA record row at a path create-ailk no longer records is dropped and listed.\nA surface the site's .ailk-site-manifest.json names a page on but\narchitecture.yaml does not declare (one no module owns, such as projects)\ngets its route files added and is declared, listed under \"Surfaces declared\nfrom the roster\". A code-route row of that roster no page file serves is\ndropped, listed under \"Roster rows dropped, no route serves them\".\nA site with no record gets one on its first run, from the version its\n.ailk-site-manifest.json already records. A site scaffolded before\n@working-theory/mcp-server has its copied apps/mcp moved to the boot set:\nthe server and each module's paid MCP pack join apps/mcp/package.json, the\ncopied server files go, and apps/mcp/src/lib/paid-tools.generated.ts is\nrewritten on every run. A site scaffolded before @working-theory/api has its\ncopied apps/api moved to the boot file: the app becomes @working-theory/app-api,\nthe package and the six @working-theory/api-<module> packages join\napps/api/package.json, its bins and build:vercel delegate to the package, and\nthe copied server files go. Run `pnpm install` after either move, since the\napp's package.json gained dependencies. Each mdx-body page in content/ with no\n'# ' heading gets its title and description written into its body as its\nheading and intro, listed under \"Page heading added\"; a page with one heading\nis left as it is, and one with several, or one whose frontmatter it cannot\nread, is listed under \"Needs review\". Each bare { on an mdx-body page is\nescaped as \\{ when the site's own MDX parser then reads the page clean, listed\nunder \"Placeholder brace escaped\"; a page it cannot escape safely, or any page\nwith one while the site's dependencies are not installed, is listed under\n\"Needs review\". Each topology seam (*.generated.* \u2014 the web seam, the\n(authed) gate, the API origin and the MCP seam) is rendered again for the\ntopology and sign-in mode .ailk-site-manifest.json records and listed under\n\"Regenerated\", when its bytes are still the render .ailk-template-files.json\nrecords; one edited by hand, or with no recorded render, is listed under\n\"Needs review\" and left as it is. Last, the generated route files of every installed page\npackage (one whose package.json declares \"ailk\": { \"routes\" }) are rewritten\nfrom its manifest, listed under \"Route files regenerated\"; run\n`create-ailk routes --write` after the install when the packages were not\ninstalled yet. Each hand-written page `routes --check` then fails on \u2014 no\ndecided customizations.yaml entry, under a package's prefix, or at a\npackage's own route \u2014 is listed under \"Needs review\". Commit before running,\nand review the diff after.\n";
|
|
187
187
|
/** Parse the argv AFTER the `update` word. Strict `node:util` parseArgs, like `parseAdoptArgs`. */
|
|
188
188
|
export declare function parseUpdateArgs(argv: string[]): UpdateArgs;
|
package/dist/update.js
CHANGED
|
@@ -117,7 +117,7 @@ import { escapeBareBraces, findBareBraces } from "./mdx-braces.js";
|
|
|
117
117
|
import { MODULE_SLICES } from "./module-architecture.js";
|
|
118
118
|
import { MODULE_FLAGS_PATH, PAID_MCP_TOOLS_PATH, PAID_SECTIONS_PATH, renderSitePaidSections, writeModuleFlags, writePaidMcpTools, writePaidSectionsRegistry, } from "./paid-sections.js";
|
|
119
119
|
import { ParseError } from "./parse-args.js";
|
|
120
|
-
import { RoutesRefusedError, customizationsRecord, isGenerated, writeRoutes } from "./routes.js";
|
|
120
|
+
import { PAGE_DECISION_GUIDANCE, RoutesRefusedError, checkRoutes, customizationsRecord, isGenerated, writeRoutes } from "./routes.js";
|
|
121
121
|
import { planSeamRefresh, seamRow, siteSeamRenders } from "./seam-refresh.js";
|
|
122
122
|
import { SITE_LISTING_PATH } from "./site-listing-path.js";
|
|
123
123
|
import { SITE_ROSTER_PATH, planServedRoster, readRosterPageRoutes } from "./site-roster.js";
|
|
@@ -2647,6 +2647,25 @@ export async function updateSite(opts) {
|
|
|
2647
2647
|
let routesWritten = [];
|
|
2648
2648
|
try {
|
|
2649
2649
|
routesWritten = writeRoutes(targetDir).written;
|
|
2650
|
+
// #11700 D10 — each hand-written page the routes check fails on is a
|
|
2651
|
+
// review row, so the bump PR carries the list, not only a red preflight.
|
|
2652
|
+
const drift = checkRoutes(targetDir);
|
|
2653
|
+
const pageRow = (path, what) => {
|
|
2654
|
+
const suggestion = drift.routeSuggestions[path];
|
|
2655
|
+
review.push({
|
|
2656
|
+
path,
|
|
2657
|
+
reason: `${what} — routes --check fails on it; ${PAGE_DECISION_GUIDANCE}${suggestion === undefined ? "" : `; ${suggestion}`}`,
|
|
2658
|
+
});
|
|
2659
|
+
};
|
|
2660
|
+
for (const { path, id } of drift.undecidedPages) {
|
|
2661
|
+
pageRow(path, id === undefined ? "a site page with no decided customizations.yaml entry" : `a page whose customizations.yaml entry "${id}" is not decided`);
|
|
2662
|
+
}
|
|
2663
|
+
for (const path of drift.stray)
|
|
2664
|
+
pageRow(path, "a site page under a page package's route prefix");
|
|
2665
|
+
for (const path of drift.stale) {
|
|
2666
|
+
if (!isGenerated(readFileSync(join(targetDir, path), "utf8")))
|
|
2667
|
+
pageRow(path, "a site page at a page package's own route");
|
|
2668
|
+
}
|
|
2650
2669
|
}
|
|
2651
2670
|
catch (err) {
|
|
2652
2671
|
if (!(err instanceof RoutesRefusedError))
|
|
@@ -2956,7 +2975,10 @@ records; one edited by hand, or with no recorded render, is listed under
|
|
|
2956
2975
|
package (one whose package.json declares "ailk": { "routes" }) are rewritten
|
|
2957
2976
|
from its manifest, listed under "Route files regenerated"; run
|
|
2958
2977
|
\`create-ailk routes --write\` after the install when the packages were not
|
|
2959
|
-
installed yet.
|
|
2978
|
+
installed yet. Each hand-written page \`routes --check\` then fails on — no
|
|
2979
|
+
decided customizations.yaml entry, under a package's prefix, or at a
|
|
2980
|
+
package's own route — is listed under "Needs review". Commit before running,
|
|
2981
|
+
and review the diff after.
|
|
2960
2982
|
`;
|
|
2961
2983
|
/** Parse the argv AFTER the `update` word. Strict `node:util` parseArgs, like `parseAdoptArgs`. */
|
|
2962
2984
|
export function parseUpdateArgs(argv) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-ailk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.42.1",
|
|
4
4
|
"description": "Scaffolder for AI Launch Kit — `pnpm create ailk@latest <dir>` produces a starter repo consuming @working-theory/* from npm (per ADR 0007).",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -28,8 +28,8 @@
|
|
|
28
28
|
"tar": "^7.5.21"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
|
-
"@working-theory/schema": "0.
|
|
32
|
-
"@working-theory/templates": "0.
|
|
31
|
+
"@working-theory/schema": "0.70.0",
|
|
32
|
+
"@working-theory/templates": "0.70.0"
|
|
33
33
|
},
|
|
34
34
|
"repository": {
|
|
35
35
|
"type": "git",
|
|
@@ -4,7 +4,15 @@
|
|
|
4
4
|
# still match the template's sha256, is refused (exit 2) unless an entry in
|
|
5
5
|
# customizations.yaml names it; the refusal on stderr names the file, the
|
|
6
6
|
# entry to add and the upstream route. An edited, unrecorded or manifest-named
|
|
7
|
-
# file passes. A site with no record warns and passes.
|
|
7
|
+
# file passes. A site with no record warns and passes.
|
|
8
|
+
#
|
|
9
|
+
# A NEW routing file under apps/web/app/[locale]/ (page.tsx, layout.tsx,
|
|
10
|
+
# route.ts) that is not a record key and matches no architecture.yaml
|
|
11
|
+
# customizations.scaffold_paths glob is refused (exit 2) unless a
|
|
12
|
+
# customizations.yaml entry names it with a decided decision (build-in: site —
|
|
13
|
+
# <decider>, <YYYY-MM-DD>, <reason>, or build-in: ailk#<N>); undecided does not
|
|
14
|
+
# count. The refusal names the package page and generator to use instead. An
|
|
15
|
+
# Edit of an existing page is left to routes --check. Pure bash, grep, awk
|
|
8
16
|
# and sha256sum/shasum — nothing a scaffold has to install. Registered in
|
|
9
17
|
# .claude/settings.json and declared in .claude/cloudparity-repo-hooks.json;
|
|
10
18
|
# keep the two in step.
|
|
@@ -38,6 +46,140 @@ if [ ! -f "$record" ]; then
|
|
|
38
46
|
printf '%s\n' '{"systemMessage":"template-guard: warning — no .ailk-template-files.json, so template files cannot be told from site files and edits under apps/ are not guarded; run create-ailk update to write it"}'
|
|
39
47
|
exit 0
|
|
40
48
|
fi
|
|
49
|
+
# A glob, matched against $rel: `**` spans segments, `*` stays inside one and
|
|
50
|
+
# all else is literal. Shared by the awk programs below.
|
|
51
|
+
matches_awk='
|
|
52
|
+
function matches(pat, n, seg, i, j, c, re, s) {
|
|
53
|
+
if (pat !~ /^apps\//) return 0
|
|
54
|
+
n = split(pat, seg, "/")
|
|
55
|
+
re = "^"
|
|
56
|
+
for (i = 1; i <= n; i++) {
|
|
57
|
+
s = seg[i]
|
|
58
|
+
if (s == "**") { re = re (i == n ? ".*" : "([^/]+/)*"); continue }
|
|
59
|
+
for (j = 1; j <= length(s); j++) {
|
|
60
|
+
c = substr(s, j, 1)
|
|
61
|
+
if (c == "*") re = re "[^/]*"
|
|
62
|
+
else if (c == "]") re = re "[]]"
|
|
63
|
+
else if (c == "^") re = re "\\^"
|
|
64
|
+
else if (c == "\\") re = re "\\\\"
|
|
65
|
+
else if (index(".[()+?{}|$", c)) re = re "[" c "]"
|
|
66
|
+
else re = re c
|
|
67
|
+
}
|
|
68
|
+
if (i < n) re = re "/"
|
|
69
|
+
}
|
|
70
|
+
return rel ~ (re "$")
|
|
71
|
+
}
|
|
72
|
+
'
|
|
73
|
+
|
|
74
|
+
# The seed id (#9223's rule) and the issue title, percent-encoded byte by byte.
|
|
75
|
+
seed() {
|
|
76
|
+
out=$(awk -v rel="$rel" '
|
|
77
|
+
BEGIN {
|
|
78
|
+
id = tolower(rel); gsub(/[^a-z0-9]+/, "-", id); sub(/^-/, "", id); sub(/-$/, "", id)
|
|
79
|
+
for (i = 1; i < 256; i++) ord[sprintf("%c", i)] = i
|
|
80
|
+
s = "Template change: " rel
|
|
81
|
+
for (i = 1; i <= length(s); i++) {
|
|
82
|
+
c = substr(s, i, 1)
|
|
83
|
+
title = title (c ~ /[A-Za-z0-9._~-]/ ? c : sprintf("%%%02X", ord[c]))
|
|
84
|
+
}
|
|
85
|
+
print id; print title
|
|
86
|
+
}')
|
|
87
|
+
id=${out%%$'\n'*}
|
|
88
|
+
title=${out#*$'\n'}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
# A new routing file under app/[locale]/ needs a decided customizations.yaml
|
|
92
|
+
# entry (#11700): a package page or a generator covers most pages, and a site
|
|
93
|
+
# page is kept only on a recorded decision.
|
|
94
|
+
routing=
|
|
95
|
+
case $rel in
|
|
96
|
+
"apps/web/app/[locale]/page.tsx"|"apps/web/app/[locale]/layout.tsx"|"apps/web/app/[locale]/route.ts") routing=1 ;;
|
|
97
|
+
"apps/web/app/[locale]/"*/page.tsx|"apps/web/app/[locale]/"*/layout.tsx|"apps/web/app/[locale]/"*/route.ts) routing=1 ;;
|
|
98
|
+
esac
|
|
99
|
+
if [ -n "$routing" ] && [ ! -e "$rel" ] && ! grep -F -x -q -- " \"$rel\": {" "$record"; then
|
|
100
|
+
# On architecture.yaml's customizations.scaffold_paths: a generator's or a
|
|
101
|
+
# module bundle's file, never a site page.
|
|
102
|
+
if [ -f architecture.yaml ] && awk -v rel="$rel" -v sq="'" "$matches_awk"'
|
|
103
|
+
/^[^ \t-]/ { incust = ($0 ~ /^customizations:/); inlist = 0; next }
|
|
104
|
+
incust && /^ [^ \t]/ { inlist = ($0 ~ /^ scaffold_paths:[ \t]*$/); next }
|
|
105
|
+
inlist && match($0, /^ - /) {
|
|
106
|
+
item = substr($0, RLENGTH + 1); sub(/[ \t]+$/, "", item)
|
|
107
|
+
if (item ~ /^".*"$/ || item ~ ("^" sq ".*" sq "$")) item = substr(item, 2, length(item) - 2)
|
|
108
|
+
if (matches(item)) { found = 1; exit }
|
|
109
|
+
}
|
|
110
|
+
END { exit !found }
|
|
111
|
+
' architecture.yaml; then
|
|
112
|
+
exit 0
|
|
113
|
+
fi
|
|
114
|
+
# A customizations.yaml entry with an id, whose paths match and whose decision is one of
|
|
115
|
+
# the two decided forms. Under LC_ALL=C the em dash is three bytes, so the
|
|
116
|
+
# separator is matched as whole strings, never as a bracket.
|
|
117
|
+
if [ -f customizations.yaml ] && awk -v rel="$rel" -v sq="'" "$matches_awk"'
|
|
118
|
+
function unq(v) {
|
|
119
|
+
sub(/^[ \t]+/, "", v); sub(/[ \t]+$/, "", v)
|
|
120
|
+
if (v ~ /^".*"$/ || v ~ ("^" sq ".*" sq "$")) v = substr(v, 2, length(v) - 2)
|
|
121
|
+
return v
|
|
122
|
+
}
|
|
123
|
+
function decided(d) {
|
|
124
|
+
return d ~ /^build-in: ailk#[0-9]+$/ || d ~ /^build-in: ailk#[0-9]+( — | - ).+$/ ||
|
|
125
|
+
d ~ /^build-in: site( — | - )[^,]+, [0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9], .+$/
|
|
126
|
+
}
|
|
127
|
+
function close_entry() { if (hit && dec && hasid) found = 1; hit = 0; dec = 0; hasid = 0; inpaths = 0 }
|
|
128
|
+
/^[ \t]*#/ { next }
|
|
129
|
+
/^[^ \t-]/ { close_entry(); inlist = ($0 ~ /^customizations:/); next }
|
|
130
|
+
!inlist { next }
|
|
131
|
+
{
|
|
132
|
+
# YAML ends a value at " #" only outside quotes, so a quoted value keeps
|
|
133
|
+
# its " #12" and loses only what follows its closing quote.
|
|
134
|
+
line = $0
|
|
135
|
+
if (match(line, /:[ \t]*["\047]/)) {
|
|
136
|
+
q = substr(line, RSTART + RLENGTH - 1, 1); head = substr(line, 1, RSTART + RLENGTH - 1)
|
|
137
|
+
rest = substr(line, RSTART + RLENGTH); endq = index(rest, q)
|
|
138
|
+
if (endq > 0) line = head substr(rest, 1, endq)
|
|
139
|
+
} else sub(/[ \t]+#.*$/, "", line)
|
|
140
|
+
if (match(line, /^[ \t]*- [A-Za-z_]+:/) && match(line, /^[ \t]*- /) && (ind == "" || RLENGTH == ind)) {
|
|
141
|
+
close_entry(); ind = RLENGTH; line = substr(line, RLENGTH + 1)
|
|
142
|
+
}
|
|
143
|
+
if (line ~ /^[ \t]*paths:/) {
|
|
144
|
+
sub(/^[ \t]*paths:/, "", line)
|
|
145
|
+
if (line ~ /^[ \t]*\[/) {
|
|
146
|
+
sub(/^[ \t]*\[/, "", line); sub(/\][ \t]*$/, "", line)
|
|
147
|
+
n = split(line, items, ",")
|
|
148
|
+
for (i = 1; i <= n; i++) if (matches(unq(items[i]))) hit = 1
|
|
149
|
+
inpaths = 0
|
|
150
|
+
} else inpaths = 1
|
|
151
|
+
} else if (line ~ /^[ \t]*decision:/) {
|
|
152
|
+
sub(/^[ \t]*decision:/, "", line)
|
|
153
|
+
if (decided(unq(line))) dec = 1
|
|
154
|
+
inpaths = 0
|
|
155
|
+
} else if (line ~ /^[ \t]*[A-Za-z_]+:/) {
|
|
156
|
+
if (line ~ /^[ \t]*id:/) hasid = 1
|
|
157
|
+
inpaths = 0
|
|
158
|
+
} else if (inpaths && match(line, /^[ \t]*- /)) {
|
|
159
|
+
if (matches(unq(substr(line, RLENGTH + 1)))) hit = 1
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
END { close_entry(); exit !found }
|
|
163
|
+
' customizations.yaml; then
|
|
164
|
+
exit 0
|
|
165
|
+
fi
|
|
166
|
+
seed
|
|
167
|
+
printf '%s\n' >&2 \
|
|
168
|
+
"template-guard: $rel is a new routing file, and no customizations.yaml entry names it with a decided decision." \
|
|
169
|
+
"Before you add a page, look up its page type and the package route that serves it, and use that package page when it exists. Otherwise record the decision in customizations.yaml (build-in: site — <decider>, <YYYY-MM-DD>, <reason>) before you write the file." \
|
|
170
|
+
"Fix, one of:" \
|
|
171
|
+
" 1. A package page: if an installed page package ships this page, write nothing here; run create-ailk routes --write." \
|
|
172
|
+
" 2. A magnet page pair: create-ailk add-route magnet --path <path> --flow <slug>" \
|
|
173
|
+
" 3. Keep it as the site's own page: add this entry under customizations: in customizations.yaml, then retry." \
|
|
174
|
+
" - id: $id" \
|
|
175
|
+
" paths:" \
|
|
176
|
+
" - \"$rel\"" \
|
|
177
|
+
" request: \"<owner>/<repo>#<issue>\"" \
|
|
178
|
+
" decision: \"build-in: site — <decider>, <YYYY-MM-DD>, <reason>\"" \
|
|
179
|
+
" An undecided entry does not count for a page; create-ailk routes --check fails it."
|
|
180
|
+
exit 2
|
|
181
|
+
fi
|
|
182
|
+
|
|
41
183
|
# The record is written by serializeTemplateRecord only: one ` "<path>": {`
|
|
42
184
|
# line per file, its `"sha256"` on the next.
|
|
43
185
|
row=$(grep -F -x -A1 -- " \"$rel\": {" "$record") || exit 0
|
|
@@ -59,27 +201,7 @@ fi
|
|
|
59
201
|
# Named by a customizations.yaml pattern? Read lexically: every quoted scalar
|
|
60
202
|
# and every `- <plain>` item outside a comment that starts `apps/`, matched as
|
|
61
203
|
# a glob where `**` spans segments, `*` stays inside one and all else is literal.
|
|
62
|
-
if [ -f customizations.yaml ] && awk -v rel="$rel" -v sq="'" '
|
|
63
|
-
function matches(pat, n, seg, i, j, c, re, s) {
|
|
64
|
-
if (pat !~ /^apps\//) return 0
|
|
65
|
-
n = split(pat, seg, "/")
|
|
66
|
-
re = "^"
|
|
67
|
-
for (i = 1; i <= n; i++) {
|
|
68
|
-
s = seg[i]
|
|
69
|
-
if (s == "**") { re = re (i == n ? ".*" : "([^/]+/)*"); continue }
|
|
70
|
-
for (j = 1; j <= length(s); j++) {
|
|
71
|
-
c = substr(s, j, 1)
|
|
72
|
-
if (c == "*") re = re "[^/]*"
|
|
73
|
-
else if (c == "]") re = re "[]]"
|
|
74
|
-
else if (c == "^") re = re "\\^"
|
|
75
|
-
else if (c == "\\") re = re "\\\\"
|
|
76
|
-
else if (index(".[()+?{}|$", c)) re = re "[" c "]"
|
|
77
|
-
else re = re c
|
|
78
|
-
}
|
|
79
|
-
if (i < n) re = re "/"
|
|
80
|
-
}
|
|
81
|
-
return rel ~ (re "$")
|
|
82
|
-
}
|
|
204
|
+
if [ -f customizations.yaml ] && awk -v rel="$rel" -v sq="'" "$matches_awk"'
|
|
83
205
|
/^[ \t]*#/ { next }
|
|
84
206
|
{
|
|
85
207
|
line = $0; n = length(line); quote = ""; cut = n
|
|
@@ -106,20 +228,7 @@ if [ -f customizations.yaml ] && awk -v rel="$rel" -v sq="'" '
|
|
|
106
228
|
exit 0
|
|
107
229
|
fi
|
|
108
230
|
|
|
109
|
-
|
|
110
|
-
out=$(awk -v rel="$rel" '
|
|
111
|
-
BEGIN {
|
|
112
|
-
id = tolower(rel); gsub(/[^a-z0-9]+/, "-", id); sub(/^-/, "", id); sub(/-$/, "", id)
|
|
113
|
-
for (i = 1; i < 256; i++) ord[sprintf("%c", i)] = i
|
|
114
|
-
s = "Template change: " rel
|
|
115
|
-
for (i = 1; i <= length(s); i++) {
|
|
116
|
-
c = substr(s, i, 1)
|
|
117
|
-
title = title (c ~ /[A-Za-z0-9._~-]/ ? c : sprintf("%%%02X", ord[c]))
|
|
118
|
-
}
|
|
119
|
-
print id; print title
|
|
120
|
-
}')
|
|
121
|
-
id=${out%%$'\n'*}
|
|
122
|
-
title=${out#*$'\n'}
|
|
231
|
+
seed
|
|
123
232
|
|
|
124
233
|
printf '%s\n' >&2 \
|
|
125
234
|
"template-guard: $rel is a template file, unchanged since create-ailk wrote it, and no customizations.yaml entry names it." \
|
package/templates/CLAUDE.md
CHANGED
|
@@ -32,7 +32,7 @@ patch or pin it: a copy stops taking fixes. `pnpm architecture` refuses each.
|
|
|
32
32
|
|
|
33
33
|
Before you write a new source file under `apps/`, record it in `customizations.yaml`:
|
|
34
34
|
its paths, the request issue, and the build-in decision. AILK builds a customization
|
|
35
|
-
in unless it decides not to. `pnpm architecture` refuses site code with no entry.
|
|
35
|
+
in unless it decides not to. `pnpm architecture` refuses site code with no entry. Before you add a page, look up its page type and the package route that serves it, and use that package page when it exists. Otherwise record the decision in customizations.yaml (build-in: site — <decider>, <YYYY-MM-DD>, <reason>) before you write the file.
|
|
36
36
|
<!-- /ailk:template id="repo-shape" -->
|
|
37
37
|
|
|
38
38
|
<!-- ailk:template id="architecture" -->
|
|
@@ -91,6 +91,7 @@ Routes are versioned under `/v1/*`:
|
|
|
91
91
|
- `/v1/consent/cookie` (POST), `/v1/consent/unsubscribe` (POST), `/v1/consent/sign-up` (GET), `/v1/consent/account` (GET, POST), `/v1/consent/platform` (GET, POST), `/v1/member/consents` (GET, POST), `/v1/workspaces/:workspaceId/people/:personId/consents` (GET) — the consent ledger's routes (#8438, spec `docs/specs/8438-consent-registry-and-ledger-step-spec.md`; #8765, spec `docs/specs/8765-sign-up-refuses-without-the-spec.md`). `consent_grants` is THE ledger: append-only (the database refuses any change to a stored row, and any truncation, on it and on `consent_visitor_links`), every row naming its `source`, its `policyVersion` and, when known, its Person; it has two writers — `src/services/consent.ts` (`recordConsent`, `recordPersonConsent`, `recordCookieChoice`, `linkConsentVisitor`, `recordCheckoutConsent`; every source) and the web's sign-up hook `apps/web/lib/sign-up-agreements.ts` (#8765 D4), which writes only `sign_up` rows (subject `user`) of a user it creates in the same Better Auth transaction, from the evidence `GET /v1/consent/sign-up` built with `consent.ts`'s own functions — and every reader is `src/lib/consent-store.ts` (`DISTINCT ON` current-state reads, never a window). **Two readings of a Person's rows:** the OWN reading (`sign_up`, `account_settings`, `email_unsubscribe` — a verified caller or a signed link) is what the member's screens and any send read; the ANY-SOURCE reading (adds `magnet`, `api`, `cookie_banner`, `checkout`, and linked visitors' cookie rows) is the operator's, marked `unverified` — an anonymous form's row never changes a member's own answer. **The checkout grant (#8765 D13, D14):** `checkout` is the eighth source (the `consent_grants_source_known` CHECK names all eight). The hub webhook's `checkout.session.completed` arm, after the flow-checkout Person step, writes one `account_terms` row (subject `person`, source `checkout`, `sourceRef` the Checkout Session id, locale `en`, the current statement and version) through `recordCheckoutConsent` — one transaction under the `ailk:consent:<workspaceId>:checkout:<sessionId>` lock, nothing written when that Person already holds that session's row — only when `consent.terms_of_service` is `accepted` and `metadata.ailk_terms` is `account_terms@<current version>`; the Person is `services/checkout-buyer.ts`'s `checkoutBuyerPerson` (a proposal session → the piece's Person in its `ailk_workspace` through `lib/proposal-paid-store.ts`'s `proposalPersonId`; a flow checkout → the Person the Person step's `resolveCheckoutPerson` found or created, never created here; a signed-in buyer's `ailk_user_id` → the Person of that user's verified email in the site workspace, test mode included; else, for a paid live-mode session only, `customer_details.email`'s Person). **A spoke purchase records the same grant (#8778):** a spoke's checkout runs on the spoke's own Stripe account, so the hub webhook never sees it; instead the first write of a `spokeCheckout` lead with a Person (`services/lead-routing.ts`) whose `payload.termsAccepted` equals the current `account_terms@<version>` stamp (`currentAccountTermsStamp`) calls `recordCheckoutConsent` for the lead's Person, `sourceRef` the lead's `Idempotency-Key` (the Checkout Session id) — a `null` or absent value writes nothing (`consent_absent`), any other value nothing (`terms_unstamped`), a replay never reaches it (and `termsAccepted` is left out of the replay comparison, so a redelivery across a spoke's update still replays), and the store's per-session guard keeps it to one row; it logs `{ event: "checkout-consent", outcome, siteId }` only and never changes the lead's answer. A `checkout` row is unverified: the payer is not a signed-in user, so it never satisfies the account interstitial. It logs `{ event: "checkout-consent", outcome, eventIdPrefix }` only (`consent_absent`, `terms_unstamped`, `person_unresolved`, `recorded`, `unchanged`, `version_changed` — the site registry has moved past the stamped version, so nothing is written — and `failed`, which adds the error's `errName`) and never changes the 200. A write appends only when the answer changes the reading it is checked against, under an advisory lock on the (subject, purpose) pair. `POST /v1/consent/cookie` takes `{ visitorId, choice, locale }` and never a workspace (it comes from `resolvePublicWorkspace`); `POST /v1/consent/unsubscribe` takes a token signed with `AILK_CONSENT_LINK_SECRET` (≥ 32 bytes, optional; unset ⇒ `503 link_secret_not_configured`) and answers every defect as one `400 invalid_link`. Both are top-level, outside every module gate, in their own rate-limit scopes (`consent`, `unsubscribe`) and on `FORWARDED_VISITOR_ROUTES`. **A sign-up agreement is the account's (#8765 C3, D5, D6):** a `signUp` purpose (`account_terms`) is recorded once per `User`, subject `user` / the user id in the deployment's own site workspace (`resolveSiteWorkspaceId()`, the owner platform consents' footing, read by `userPlatformRows`), never per Person, so the hub and every spoke signed in through it read one row. `GET /v1/consent/sign-up` is anonymous: `{ workspaceId, agreements: [{ purposeId, policyVersion, locale, statement, statementHash }] }` for the site workspace (`locale` default `en`, `null` workspace `503 tenant_unresolved`, `Cache-Control: no-store`), top level beside the cookie route in its own rate-limit scope `signupevidence`, outside every module gate. **Its budget is per site key (#8805):** a request presenting a valid `x-ailk-spoke-key` (`resolveCallerSite` → a registered, unrevoked spoke) is counted against that key's `site,<spokeId>` bucket at `DEFAULT_SIGNUPEVIDENCE_PER_KEY_PER_MINUTE` (120; `AILK_RATE_LIMIT_SIGNUPEVIDENCE_PER_KEY_PER_MINUTE` overrides) and let through the server-wide per-IP ceiling, so a spoofed `X-Forwarded-For` cannot spend it; an invalid or absent key, or a failed lookup, keeps `DEFAULT_PER_IP_PER_MINUTE_STRICT` per IP. The key picks the bucket only — the workspace stays `resolveSiteWorkspaceId()` (`middleware/rate-limit.ts`'s `siteKeyReader`, `SITE_KEYED_ROUTES`). `GET /v1/consent/account` answers `{ agreements: [{ id, statement, policyVersion, acceptedVersion, acceptedAt, current }], complete }` for the caller (`memberCaller` — a cookie session or a hub credential; a personal token `401`); `POST` takes `{ purposeIds, locale? }`, refuses any id that is not a `signUp` agreement `404 purpose_unknown` before writing anything, writes each through `recordPersonConsent` (source `account_settings`, `sourceRef: spoke:<id>` for a hub credential) and answers the GET body; both register in `authScope` unconditionally and log `{ event: "account-agreements", outcome }` only. The member pair reads and writes that same row for a `signUp` purpose (no Person is created) and is unchanged for every other purpose; a `null` site workspace keeps the old per-Person reading; a hub credential's `via: "sign_up"` is `400 sign_up_window_closed` with nothing written (SEC-8765-B). The member pair and the account pair are in `HUB_SESSION_ROUTES` (26 entries since #8765); the anonymous `GET /v1/consent/sign-up` is not, and neither is `/v1/consent/platform` — it is the deployment owner's own consent to Working Theory, a cookie session holding `platform-consents`, under `multi-tenant`. The banner's visitor id travels in `x-ailk-consent-visitor` (only a v4 UUID counts) on the lead and flow routes and the member write, linking the visitor to the Person; the header is never echoed or logged. A `consent` flow field now stores `{ [purposeId]: boolean }` and writes the ledger at completion (source `magnet`, `sourceRef` the flow slug). The operator's `…/consents` answers `{ own, anySource, history, nextCursor }` (history 500 a page, `Cache-Control: private, no-store`, never a subject id). No MCP twin for any of them, recorded in `tests/parity/README.md`.
|
|
92
92
|
- `/v1/workspaces/:workspaceId/requests` (GET, `?limit=`), `/v1/workspaces/:workspaceId/requests/:requestId` (GET), `/v1/workspaces/:workspaceId/people/:personId/pieces/:pieceId/versions` (POST) — the provider routes (#8171, `src/routes/workspaces/{requests,pieces}.ts` over `tenantDb(tenant).memberArea`; spec `docs/specs/8171-provider-routes-the-workspace-requests-spec.md`). **The Requests read** lists the workspace's inbound member rows (#8170's messages, quote requests and reviews), newest first, `limit` 1–50 (default 50, no cursor), behind `inbox-read` (every role) checked with `can(tenant.role, …)`. It is tiered: a role holding `people-read` (owner, admin) gets the full row — the subject, body and the kind's own fields (a message's `link`, a quote's `items`, a review's `pieceId`, `version`, `review`); every other caller, every agent key included, gets `{ id, kind, person, createdAt }` and the content is never selected. A row whose payload fails its kind's schema, or whose Person is gone, is left out and counted in one `warn`. **Deliver a version** numbers version n+1 under the piece lock (`withPieceStagesLock`), behind `member-pieces-manage` through `allows` (an agent granted it delivers); the body is exactly one of an `https` link (`isHttpsLink`, else `400 link_not_https`) and a private attachable asset of this workspace (`400 asset_not_found` / `asset_not_attachable`), plus an optional note; `version`, `deliveredBy` and `deliveredAt` are the server's (a body naming one is `400 validation_failed`); a piece with `approvedAt` set is `409 piece_approved`; a malformed, absent or foreign Person or piece is `404 not_found`. There is no round count, limit or remaining count (#8140 disposition 3). It answers `201 { version: { id, pieceId, version, file, link, note, deliveredAt } }` — the file's download name, never an asset id or `deliveredBy` — and every call that reaches the store writes one `people.version.create` audit row. **The single Requests read (#9847, spec `docs/specs/9847-agent-reads-member-request-spec.md`):** `GET /v1/workspaces/:workspaceId/requests/:requestId` answers one inbound member row of the caller's workspace in the list's full shape (`workspaceRequestSchema`, `{ ok: true, data: <row> }`) through `tenantDb(tenant).memberArea.getRequest`. Gate: `inboxAllowed(tenant, "people-read")` before any read — a person whose role holds `people-read`, an agent holding BOTH the `people-read` and `inbox-act` grants (the reply grant, #9714 D5; `member-pieces-manage` is not an alternative); a refusal is `403`. A malformed, absent, outbound, other workspace's or unservable id (payload failing its kind's schema, Person gone — logged `dropped: 1` at `warn`) is one `404 not_found`. The subject, body and each quote answer pass `inbox-messages.ts`'s `stripHiddenText` (zero-width, bidi, BOM and tag characters, SEC-9847-1); the stored row is untouched. Every agent call writes exactly one `people.request.read` audit row — `refused`/`failed` against the workspace, `succeeded` against the interaction with summary `{ kind }` and thread `hub:<personId>` — carrying its session; a person's call writes none. The list's agent view stays the summary row. The thread's `request` entry carries `requestId`, the row's `intx_` id, so an agent can find it. Same registration, scope and tenant guard as the routes above (`workspace || multi-tenant`). No MCP twin, by decision — member-area MCP tools are a later phase of the CRM nucleus, recorded in `tests/parity/README.md`.
|
|
93
93
|
- `/v1/workspaces/:workspaceId/callbacks` (GET, `?limit=`) — the Inbox callbacks read (#9254, `src/routes/workspaces/callbacks.ts` over `tenantDb(tenant).callbacks`; spec `docs/specs/9254-callback-rows-inbox-spec.md`): the workspace's request-and-confirm `Callback` rows (#5970), newest first, `limit` 1–50 (default 50, the Requests read's own query; any other key `400 validation_failed`), behind `inbox-read` (every role, a member and an agent key included) through `permitted`, checked before any read. Same registration, scope and tenant guard as the Requests read (`workspace || multi-tenant`); the scope is always `request.tenant.workspaceId`. The row is `id`, `name`, `phone`, `preferredTime` (the window asked for, as typed), `personId` (`null` for a callback captured with no email), `confirmedAt`, `confirmedTime`, `paidAt` and `createdAt` — read through the fixed `CALLBACK_ROW_SELECT`, so never `payload`, the confirm digest or expiry, `buyerEmail`, `amountMinor`, `currency` or a Stripe id. The confirm state is the reader's to derive (`paidAt` → paid, else `confirmedAt` → confirmed, else awaiting). No item read, no cursor, no stamp, no audit row; the body is re-parsed against its own `.strict()` schema. The Admin Inbox lists each row under Interested. No MCP twin, recorded in `tests/parity/README.md`.
|
|
94
|
+
- `/v1/workspaces/:workspaceId/work-requests` (GET, POST), `/v1/workspaces/:workspaceId/work-requests/:requestId` (GET), `/v1/workspaces/:workspaceId/work-requests/:requestId/issue` (PATCH) — custom-work requests (#11756, `src/routes/workspaces/work-requests.ts` over `tenantDb(tenant).workRequests`; spec `docs/specs/11756-a-custom-work-request-can-spec.md`): an Inbox item an agent files that points to one `Document` of its workspace, and the GitHub issue a person links to it. Same registration, scope and tenant guard as the callbacks read (one `TENANCY` row in `tenant:settings`); the scope is always `request.tenant.workspaceId`, and the routes never set `mcpPinSwitch`, so an all-workspaces token writes only in its session's pinned workspace — the pin is an accident fence, and the authorization is the live per-workspace `inbox-act` check. **The create** takes a strict `{ documentSlug, summary }` (the content slug grammar; the summary trimmed, 1–280 visible characters, a hidden code point or line break refused) behind `inboxAllowed(tenant, "inbox-act")` — an agent needs the grant; no permission was added — then charges `chargeWriteBudget` scope `workrequest`, the person in this workspace first (`by,<workspaceId>:<userId>`, 5 an hour, shared by all of that person's agents and connected apps — an OAuth agent id is a client registration many people share), then the workspace (`ws,`, 10 an hour) only when the person passed (`429 rate_limited` with `Retry-After`), before the body is parsed. It stores the request only when the slug resolves to a `Document` of the workspace at the default locale that the caller may read (`docs-read` and the Audience/Disabled rule; any miss `404 document_not_found`) and answers `201`. **The reads** (`inbox-read`) serve `{ items, total }` — at most 200, newest first, no query — and one row; a malformed, absent or foreign id is one `404 not_found`. A row is `{ id, summary, document: { slug, title } | null, githubIssue: { owner, repo, number } | null, byAgent, createdAt, updatedAt }`: the document is resolved live, in one query scoped to the workspace and the `Document` type, and is `null` when deleted, archived, retyped or not readable by the caller, or when the caller lacks `docs-read`; the title is stripped of hidden characters and cut at 200. **The link** is a person's act — every agent is `403` — behind `inbox-act`: `{ issueUrl }` is a `https://github.com/<owner>/<repo>/issues/<n>` URL or `null` (`400 issue_url_invalid` for anything else), stored only as `<owner>/<repo>#<n>` (CHECKed in the database); nothing calls GitHub and no GitHub credential is read. An agent's create that passed the gate and the budget writes one `inbox.create_work_request` audit row (`succeeded`, or `failed` with `validation_failed` / `document_not_found`); a link change writes one `inbox.set_work_request_issue` row; a 401, 403 or 429 writes none. No row or log line carries the summary, slug, title, URL or ref. MCP parity: the create's twin is `create_work_request` on `/mcp/workspace`; the list, the item and the link have no tool, by decision (recorded in `tests/parity/README.md`).
|
|
94
95
|
- `/v1/workspaces/:workspaceId/submissions/:leadId/trial` (POST), `/v1/workspaces/:workspaceId/people/:personId/trial` (GET), `/v1/workspaces/:workspaceId/people/:personId/trial/extend` (POST) — the operator's Start, Get and Extend trial (#9287 C3, `src/routes/workspaces/trial.ts` over `src/services/trial.ts`; spec `docs/specs/9287-operator-started-trials-spec.md` DD2–DD7; Start trial since #9342, spec `docs/specs/9342-start-trial-needs-customers-and-spec.md` DD1–DD7). Same registration, scope and tenant guard as the callbacks read (`workspace || multi-tenant`); the scope is always `request.tenant`. All three need `billing-manage` by role — the owner alone; an admin, a member and every agent key are `403` before any read or Stripe call — and the two POSTs charge a write budget of 30 an hour per person (`chargeWriteBudget` scope `trial`, `429 rate_limited` with `Retry-After`) before their strict body (`bodyLimit` 4 KiB, `400 validation_failed`). The Stripe client is the tenant's own Organization's, `stripeClientForOrganization` only, never the env key (`409 stripe_not_connected`; unusable, or any thrown Stripe error, a fixed `502 stripe_unavailable`, logged by class name only). **Start trial** is a hosted Checkout trial (#9342): it accepts a lead only when it is a `flow:trial` submission of this workspace whose `trial` magnet is a `diagnostic` and names a Person (else one `404 not_found`); the `{ lookupKey }` must be a `plan` `listPlanOfferings` lists (`400 plan_unknown`; a failed read `503 offerings_unavailable`); with no usable `FRONTEND_URL` it is `503 checkout_not_configured` before any Stripe call. It then makes exactly three Stripe calls, all within the Offerings key contract (#8879 §3.3, unchanged): `prices.list` for exactly one active recurring Price under the key (`409 plan_unavailable`); `checkout.sessions.list` of the Person's email's completed sessions, where one tagged `ailk_origin: ailk-trial` is `409 trial_exists` with nothing created; and one session through `lib/stripe.ts`'s `createTrialCheckoutSession` (`@working-theory/stripe-client`) — subscription mode, `trial_period_days: 14`, `payment_method_collection: "if_required"`, `trial_settings.end_behavior.missing_payment_method: "pause"`, the terms box required (`409 terms_not_configured` when the account has no Terms of service URL), `customer_email` the Person's, `subscription_data.metadata` `{ ailk_origin: "ailk-trial", ailk_workspace, ailk_person, site }` with `site` the workspace id (`TRIAL_ORIGIN_TAG`), returning to `<FRONTEND_URL origin>/trial`, keyed `trial-checkout:<leadId>:<lookupKey>`. It calls no Customers or Subscriptions endpoint and writes nothing to the Person: Stripe creates the customer and the trialing subscription when the person completes Checkout, and the hub's licensing module (`@working-theory/api-hub`'s `src/licensing/`, #9383 DD3) mints from `customer.subscription.created` only for a subscription traced to the session Start trial recorded. A session URL `isStripeCheckoutUrl` refuses is `502 stripe_unavailable` with nothing sent. Before anyone is sent the link the session is recorded (`recordCheckoutSession`, #9383) with the workspace, the Organization, the Price and key it read and the connection's mode; a failed record expires the session on the same client and is `502 stripe_unavailable` with nothing sent, and a `conflict` whose stored record is equal in every field is the idempotent replay and succeeds. The person is then emailed the link (`@working-theory/email`'s `sendTrialCheckoutEmail`, from `deliverableSenderAddress()` named "<workspace> via <organization>"); a failed send is one `warn` with its kind and still a success. The answer is `201 { checkout: { url, emailed } }` with `Cache-Control: private, no-store`, re-parsed against `startTrialResponseSchema`. **Get trial** reads the Person's newest RECORDED Start-trial session (#8047 DD5): of the Person's email's ten newest complete sessions, those tagged `ailk-trial`, this workspace and this Person, the newest whose session record names this Organization, workspace and mode — never a customer found by email or stored on the Person — and serves its subscription as `{ subscriptionId, status, trialEnd, lookupKey }`, or `null`. **Extend trial** moves that trial's `trial_end` with `proration_behavior: "none"` only while it is `trialing` (`409 trial_not_active`), to a `trialEnd` strictly later than the current one and no later than 90 days after the request (`400 trial_end_invalid`), nothing written on a refusal. **Get and Extend trial need Subscriptions access, which a key that keeps §3.3 lacks** (#9342 DD7): on such a key Stripe refuses, the route answers `502 stripe_unavailable` and the Person page hides its Trial box; they work on a key that grants that access. Each success writes one `recordAuditAction` row naming the actor and the Person — `people.trial.start` (summary `{ emailed }`, `"true"` or `"false"`) and `people.trial.extend`; a refusal writes none, and Start trial does not mark the lead handled. No log line or audit summary carries the Checkout URL, and no response, log line or audit summary carries an email, a key or a `cus_`/`price_` id (the one `cs_` id served is inside Start trial's URL); Get and Extend's bodies are re-parsed against `trialResponseSchema` (`@working-theory/validation`'s `trial.ts`). No MCP twin — owner-only, recorded in `tests/parity/README.md`. **The managed-service licence** (#9402, spec `docs/specs/9402-managed-service-trials-deliver-the-spec.md` DD5): `/v1/workspaces/:workspaceId/people/:personId/trial/licence` (GET) and `…/trial/licence/reveal` (POST) sit in the same plugin and, like the trial routes, need `billing-manage` by role (#9841, narrowing #9402 DD5's staff audience) — the owner alone; an admin, a member and every agent key are `403` before any read. They read a managed-service trial's licence through the fulfilment seam's optional `readManagedLicence` (`services/offerings/fulfilment-hooks.ts`, built with `fulfilmentContextFor` from the tenant's own client): the GET answers `{ licence }` — `null`, `{ live: false }` or `{ live: true, tier, expiresAt }`, never a key — and the POST charges its own write budget (scope `licencereveal`, 30 an hour per person), takes a strict empty body, and answers `{ key }` only after one `people.trial.licence_reveal` audit row is written (`503 audit_unavailable` and no key when it is not). A licence the issuer recorded for the customer at mint reads as `none` (#9402 AC 5, entitlements#19), whatever the Product is today. `none`/`not_live` on the reveal, and an Organization whose hook has no staff read, are `404 licence_not_found`; a read that cannot be made is `502 licence_unavailable`. Both answer `Cache-Control: private, no-store`; no log line or audit row carries the key. No MCP twin, recorded in `tests/parity/README.md`.
|
|
95
96
|
- `/v1/workspaces/:workspaceId/members` (GET) — the org's member roster (`userId`, `name`, `email`, `role`), the Pro `workspace` module's Team tab (#5371). Read-only by design: granting a Membership is the invite flow, which is its own spec with a mandatory security review (§2.3), so no POST/PUT/DELETE is routed at this path. Scoped to `request.tenant.organizationId` — Membership is org-level — server-resolved from the validated session. Role floor: `members-read` (owner, admin — `@working-theory/validation`'s permission table (#7636 D2)): the roster carries every member's email, and who the other members are is not a member's job. No MCP twin — identity-bound tenant route (#3591 exception).
|
|
96
97
|
- `GET /v1/workspaces/:workspaceId/knowledge` — the workspace knowledge read (#9683, spec `docs/specs/9683-agent-session-audit-knowledge-spec.md`; `packages-paid/api-workspace/src/routes/workspaces/knowledge.ts`, `// oss: false`): what the business offers, runs and serves, as `workspaceKnowledgeSchema` — `offerings` (the shown offering set, only while the commerce claim is held), `magnets` (the newest flows page's `live` rows), `meetingTypes` (the enabled slugs minus `privateSlugs`, titled by slug), `sitesServed` (the installed hub's live spokes for this workspace, read only when the hub's own gate answers `claimed`, through the optional `HubRegistry.listLiveSpokesForWorkspace`) and `strategyDocs` (`lib/strategy-docs.ts`, `[]` until a store exists) — every key always present, each entry an id, a title and a summary (`null` when it fails its check; an entry whose id or title fails is skipped and counted). Takes no query. Gate: `allows(people-read) || allows(people-memory-propose)` — a person member holds both; an agent only by grant. Every authenticated call writes one `workspace.knowledge.read` audit row (counts only; an agent's carries its session, thread `workspace:<workspaceId>`); `Cache-Control: private, no-store`. Same registration scope as the routes above (`workspace || multi-tenant`, `tenant:settings`). MCP twin: `get_workspace_knowledge` on `/mcp/workspace`.
|
|
@@ -99,6 +100,7 @@ Routes are versioned under `/v1/*`:
|
|
|
99
100
|
- `GET /v1/workspaces/:workspaceId/discovery` and `PUT /v1/workspaces/:workspaceId/discovery` — the owner's discovery switch, whether AI and search tools can find the workspace's site (#10510, `src/routes/workspaces/discovery.ts`, `// oss: false`, over `packages/api/src/services/site-discovery.ts`). Both parse `:workspaceId` with `inboxWorkspaceParamsSchema` (`400 validation_failed`) and act on `request.tenant.workspaceId` only. The GET needs any tenant, an agent included, and answers `{ ok: true, data: { discoverable } }`; the PUT needs `workspace-settings` (owner, admin — an agent is refused, `403`), checked before the strict `{ discoverable: boolean }` body (`400 validation_failed` on anything else), and answers the stored value. The GET's MCP twin is `get_site_discovery`; the PUT has no tool, by decision. Same registration scope as the routes above (`workspace || multi-tenant`, one `tenant:settings` row).
|
|
100
101
|
- `/v1/workspaces/:workspaceId/content` (GET, POST), `/v1/workspaces/:workspaceId/content/:type/:slug` (GET, PATCH), `/v1/workspaces/:workspaceId/content/:type/:slug/{publish,unpublish}` (POST) — the tenant-guarded content editor's write surface (#5853, `src/routes/workspaces/content.ts`): list, create, read/save the draft tip (under `X-Draft-Version`; `If-Match` still accepted for one release, #10264), and publish/unpublish, all over `Artifact`/`ArtifactVersion`. `:type` is validated against the page-type registry (`z.enum(SCHEMA_ORG_TYPES)`) rather than accepted as a free string on every addressed operation — an unregistered type is a 400 before any lookup, since it is echoed back and passed to `notifyRevalidate` as the site's cache tag. Role floors from `@working-theory/validation`'s permission table (#7636 D2): publish and unpublish need `content-publish`, and create, read and save need `content-edit` (both owner, admin — an admin builds, a member operates). The list serves `content-edit` the editor's full view and a caller holding only `docs-read` (a member) a published-only projection (D4): draft rows dropped, every row `status: "published"`, `version: null`, `valid: true`, and a `published_with_draft` page's `type`/`tags` read from its PUBLISHED version — applied before every filter, so a member's `?status=draft` or a draft tip's `?tag=` matches nothing. **The GET list is a UNION of page artifacts and DOCUMENT assets** (#6093, D1/D9 — "one store, two views"): every row carries `tags: string[]` (never null, read from the draft tip's stored content for a page, from `Asset.tags` for a file) and a DERIVED `kind: "page" | "post" | "file"` (`BlogPosting` alone maps to `"post"`; an asset row is always `"file"`) — an optional `?tag=<slug>` filters the union AFTER it is built, so a file is returned under either its own tag or a shared one. The asset half of the union (`DOCUMENT_CONTENT_TYPES`, i.e. `application/pdf`) is skipped entirely when `locale`/`type` is supplied or `status` names anything but `"published"`, since a file row can never satisfy those. A foreign `:workspaceId` costs zero artifact **and** zero asset queries. MCP parity: on `/mcp/workspace`, the create's twin is `create_page` (#10956), the draft read and save are `read_report` and `save_draft` (#10336), and the publish is `publish_draft` (#10661); the list and unpublish have none, as `tests/parity/README.md` and the registry record.
|
|
101
102
|
- `/v1/workspaces/:workspaceId/library/pages` (GET, `?type=&status=&limit=&page=`) and `/v1/workspaces/:workspaceId/library/assets` (GET, `?tag=&type=&limit=&page=`) — the library reads, each answering `{ workspace: { id, name }, items, total, page, nextPage }` newest first (`limit` 1–200, default 50; `page` from 1; `libraryPageListQuerySchema` / `libraryAssetListQuerySchema` in `@working-theory/validation`). The page list (`packages-paid/api-content-write/src/routes/workspaces/library-pages.ts`, in the content-write tenant scope) serves every page, drafts included, as `{ id, type, slug, locale, title, status, updatedAt }`; `status` is the Docs list's rule — `disabled` when switched off, else `live` when a version is published (a newer draft included), else `draft` — and the route needs `content-edit` (`allows`, so an agent needs the grant). A disabled page is asked for only on a person's behalf: `tenantDb` keeps every disabled row from an agent. The asset list (`packages-paid/api-workspace/src/routes/assets/manage.ts`, beside the manage list, `assets-read`) serves `{ id, key, filename, type, tags, url, updatedAt }` — `type` is the content type, `url` the public read's path, `updatedAt` when the current file was uploaded — the `createdAt` of the version `currentVersion` names (`tenantDb.assets.currentVersionTimes`), so a replace moves it, a restore takes the restored version's upload time, and a metadata edit does not move it; the list is ordered by it, newest first — narrowed by an exact `tag` and a `type` that is a whole content type (`image/png`) or its top-level part (`image`); a file tagged `private` never lists, `?tag=private` included. MCP parity: `list_workspace_pages` and `list_assets` on `/mcp/workspace`.
|
|
103
|
+
- `/v1/workspaces/:workspaceId/page-types` (GET) and `/v1/workspaces/:workspaceId/tag-vocabulary` (GET) — the site-vocabulary reads (#11680; `packages-paid/api-content-write/src/routes/workspaces/site-vocabulary.ts`, in the content-write tenant scope), any tenant of the workspace, no query, no row read. `page-types` answers `{ types: [{ type, route, fixed, template, headings }] }`: every page-type registry entry that is a page, in registry order, with its template's headings as `PAGE_TEMPLATES` states them (`key`, `text`, `required`, `section`, `hint`), filtered per request by the module map `pageTypeModule` in `@working-theory/validation` (the one create-ailk's page-types reference generator reads): `marketing` types always, `scheduling` and `signal-collectors` types when `isModuleEnabled`, and `docs-blog` types when `AILK_ENABLED_MODULES` names `docs-blog` — a site that carries the blog and docs sets that key, since `docs-blog` has no API module. `tag-vocabulary` answers `tagVocabulary()`: `{ classes, topics, status }`, each a list of `{ tag, means, setBy }`. MCP parity: `list_page_types` and `get_tag_vocabulary` on `/mcp/workspace`.
|
|
102
104
|
- `/v1/workspaces/:workspaceId/assets` (GET, POST), `/v1/workspaces/:workspaceId/assets/:assetId` (PATCH, DELETE), `/v1/assets/:assetId` (GET, public/anonymous) — the workspace asset store (#5854 upload/read; #6093 list/PATCH/DELETE, `src/routes/assets/{index,upload,read,manage}.ts`). Upload accepts an allowlisted union of three named classes (`src/routes/assets/index.ts`): five RASTER images (`image/png`, `image/jpeg`, `image/gif`, `image/webp`, `image/avif`), one VECTOR image (`image/svg+xml`, admitted under the operator's 2026-09-18 `allow-svg-assets` ruling — issue #6093 comment `5731573595` — superseding #5854's original SVG exclusion) and one DOCUMENT type (`application/pdf`), all under the existing 20 MB cap; `?tags=<slug>[,<slug>…]` stores tags on the row. The public read serves a RASTER type `inline` exactly as before; every OTHER admitted type (SVG, PDF) is served `attachment`, with the filename's extension pinned to the stored content type (closing extension spoofing) and a five-directive `Content-Security-Policy` (`default-src 'none'; sandbox; frame-ancestors 'none'; form-action 'none'; base-uri 'none'`) that makes the bytes never a document on this origin — this is what makes admitting SVG safe with NO server-side sanitizer. `GET …/assets` (`assets-read` — every role, a member included) lists a workspace's assets, metadata only, never `bytes`, with an optional `?tag=<slug>` filter; this is what narrows the store's prior "nothing lists assets" premise to its precise form — no ANONYMOUS and no CROSS-TENANT enumeration, both still true. `PATCH …/assets/:assetId` updates `title`/`description`/`tags` (`assets-write`, owner and admin, the upload's permission too; `null` clears a text field to SQL `NULL`, `""` stores empty; the asset's `id` and public URL are untouched). `DELETE …/assets/:assetId` (`assets-write`) removes the row and the bytes at the ORIGIN only — already-cached copies elsewhere are not recallable under the year-long `immutable` promise, and no reference check protects a page that still embeds the URL; absent and foreign ids both take the same 404. Every tenant route here is identity-bound; no MCP twin (#3591 exception). The public read has no MCP twin either — it serves bytes to an `<img>`/download, the same boundary `upload.ts` records for its own sibling. **A client's file is never in the library's public life (#7877 D18):** the default `GET …/assets` listing leaves out every asset tagged `private` — only `?tag=private` lists them (the Admin's Compose) — and the public read answers its uniform 404 for an asset tagged `private`, attached to any member-area message, or (#8171 D3) named by a delivered piece version (one `pieceVersion.count`, since the tag can be removed after delivery), so such a file's bytes are served only by its owner's member reads.
|
|
103
105
|
- `/v1/subscription/me` (GET) — `?include=billing` (#8171 D7), from a cookie session only, adds the optional `planName` and `paymentMethod` (brand, last four, expiry) read from Stripe through `lib/stripe.ts`'s `readCustomerBillingSummary` for the caller's own resolved customer: cached per customer for 60 s (a failure too), one read in flight per customer, bounded at 3 s; a failure leaves both keys absent, a value outside the schema's bounds is `null`, and no id is served or logged. A bearer token, another value or none answers exactly as before.
|
|
104
106
|
- `/v1/billing` (GET), `/v1/billing/portal-session` (POST) — org-scoped billing read + Stripe customer-portal session creation. The read stays open to every member (the Admin's plan gate reads it); the portal needs `billing-manage` — the owner alone (`@working-theory/validation`'s permission table (#7636 D2); an admin is refused before any Stripe call). `/v1/billing/usage` (GET) needs `billing-read` (owner, admin). **The read's `commerce` field (#8907 D14)** is the deployment's commerce claim, `claimed | unclaimed | undetermined` (`resolveCommerceClaim()`; a rejected read is `undetermined` and the answer stays `200`) — what the Admin's Billing card reads (#8908 D10). **`?include=billing` (#9067 D1)** — exactly that string, never an array — adds `details` only for a caller holding `billing-manage` (the owner; an agent never qualifies): `licenseExpiresAt` (`checkLicense().expiresAt`, `null` on a failed read) always, and for an Organization with a Stripe customer `renewsAt` (the current subscription's first item's `current_period_end`, only while it will renew), `sites` (its quantity) and `paymentMethod` (brand, last four, expiry), read through `lib/stripe.ts`'s `readCustomerBillingSummary` by `services/entitlements.ts`'s `readOrgBillingSummary` — cached per customer for 60 s (a failure too), one read in flight per customer, bounded at 3 s; a failure answers `details: { licenseExpiresAt }` and still `200`, a value outside `orgBillingDetailsSchema`'s bounds is `null`, no id is served or logged, and the reply carries `Cache-Control: private, no-store`. Every other request is answered exactly as before, with no Stripe or licence read. **`POST /v1/billing/plan-checkout` (#9067 D3, `routes/billing/plan-checkout.ts`)** is the Billing tab's Purchase plan: a subscription Checkout for the caller's own Organization's plan (`planPurchaseLookupKey` — `ailk-pro_monthly` / `ailk-pro-plus_monthly`, `PLAN_PURCHASE_LOOKUP_KEYS` built by the Offerings lookup-key grammar, #9338 DD1), on the admitted key like the portal (#8463). **It sells only an Offerings plan (#9338 DD4):** `createCheckoutSession` gets a `refuseProduct` that refuses every Product whose `metadata.ailk_group` is not exactly `plan` (`isOfferingsPlanProduct`, `services/offerings/catalog.ts`), checked on the same expanded Price it sells; a refused or unexpanded Product answers `500 plan_price_missing`. Check order: tenant → `billing-manage` (403 before any lookup) → write budget (`chargeWriteBudget` scope `plancheckout`, 10 an hour per Organization and per person, `429` with `Retry-After`) → the commerce claim (`409 purchase_unavailable`, `503 license_undetermined`) → a strict `{ returnUrl }` (`bodyLimit` 4 KiB, `400 validation_failed`) → the return URL (canonical, no userinfo, query, fragment or `//` path, `https:` or a local `http:`, on `config.TRUSTED_ORIGINS`; `400 return_url_refused`, `500 config-error` when none is trusted) → no customer yet (`409 billing_customer_exists`) and a purchasable tier (`409 plan_not_purchasable`) → `STRIPE_SECRET_KEY` and `assertAdmittedStripeKey` → one payable session (an open earlier one is expired first, a completed one is `409 purchase_pending`) → `createCheckoutSession` with `mode: "subscription"`, 1–50 sites, `metadata` and `subscriptionMetadata` `{ organizationId, ...siteStamp() }` and `PLATFORM_TERMS_OF_SERVICE`, never a `buyer` → a Checkout URL only → the session id recorded on `Organization.planCheckoutSessionId` by compare-and-set (a lost race or a failed write expires the new session). It answers `{ url }` with `Cache-Control: private, no-store`; no body or log line carries the return URL, an id or a Stripe message. **The webhook's Organization arm binds only that recorded session (#9067 D13):** a `checkout.session.completed` with `metadata.organizationId` links `session.customer` through one guarded `updateMany` on `{ id, planCheckoutSessionId: session.id, billingCustomerId: null }` (clearing the session); anything else — an unrecorded session, a bound customer, every `customer.created` — writes nothing and logs `org_bind_unproven`. No MCP twin for the purchase — owner-only, recorded in `tests/parity/README.md`.
|
|
@@ -209,7 +209,7 @@ here. Spec: `docs/specs/3591-tenant-scoped-agent-auth-secure-spec.md` D13–D16.
|
|
|
209
209
|
tools, `list_proposals` and `create_proposal`, twinning `GET`/`POST
|
|
210
210
|
/v1/workspaces/:workspaceId/people/:personId/proposals` with the same grant: a proposal is
|
|
211
211
|
private to one client, `payments` says whether approval leads to a Stripe page, and an agent's
|
|
212
|
-
price is refused `proposal_needs_person` (a person prices) — and (#10957) `send_person_message`, twinning `POST …/people/:personId/messages`: one message on a client's member feed, saved then emailed (an agent's only to a proved address), needing `inbox-act` with `people-read` or `member-pieces-manage`, and `assets-write` for a file; the operator's message list has no tool, by decision — and (#9681) the four person-thread tools, `get_person_thread`, `set_person_thread_state`, `list_external_threads` and `add_external_thread`, twinning `GET`/`PATCH …/people/:personId/thread` and `GET`/`POST …/people/:personId/external-threads`: a client's whole thread page by page with its read/archived/resolved state, and pointers to email and Slack threads (never message text); reading needs the `people-read` grant, writing also `inbox-act`, and the client erasure route has no tool, by decision — and (#9682) the three person-memory tools, `list_person_memories`, `get_person_memory` and `propose_person_memory`, twinning `GET …/people/:personId/memories`, `GET …/memories/:path` and `POST …/memories`: an agent reads only live, unexpired memories (confirmed by a person, read within 180 days) and its proposal is never live — a new path is a draft, a confirmed one gets a pending version — needing the `people-read` or `people-memory-propose` grant to read and `people-memory-propose` to propose; the six person-only memory routes (edit, delete, confirm, redact, the versions list, restore) have no tool, by decision — and (#9749) `get_slack_connection_status`, twin of `GET /v1/workspaces/:workspaceId/slack-connection` (registered with `workspace`/`multi-tenant`, its route's `TENANCY` row: whether the Organization's Slack is connected, its team name and the date, never a credential; connect and disconnect are a person's act and have no tool, by decision), and `get_prospect_channel_settings` / `set_prospect_channel_settings`, twins of `GET`/`PUT …/prospect-channel` (registered with `scheduling`, their routes' module): the update replaces every field, needs the `meeting-types-manage` grant, is refused `slack_not_connected` while the Organization has no Slack connection, and an agent may change only `enabled`, `channelPrefix` and `archiveDays` — a change to `memberIds` or `welcomeTemplate` is refused `prospect_channel_needs_person` — and (#10950) the three meeting tools, `list_meeting_types`, `save_meeting_types` and `list_appointments`, twinning `GET`/`PUT …/meetings` and `GET /v1/schedule/appointments` (registered with `scheduling`): the meeting types from the connected calendar, each with whether it is Live (`enabled`) and who can book it (`visibility`: `public`, `private` or `authenticated`), the provider's `providerEventTypeId` and `createdAt` when it serves them, and, with the `meeting-types-manage` grant, `providerEditUrl` — the read takes no `include` (#11122 D4); the save needs that grant and its required `enabledSlugs` replaces the Live list, while `customerSlugs` (Authenticated) and `privateSlugs` (Private) are exclusive — a slug in both is refused — and an omitted one keeps the stored list less the sent list's slugs, and no price is set there; the appointments read is every role's, and an agent's only with the `people-read` grant (#10986), takes `eventTypeId` for one type's bookings (#11122 D12), and its attendee names and emails are public-written text; the three scheduling-connection routes have no tool, by decision — and (#10218) the content-suggestion pair, `draft_page_suggestions` and `decide_page_suggestion` — and (#10336) the draft pair, `save_draft` and `read_report`, twinning `PATCH`/`GET …/content/:type/:slug` with the `content-edit` grant: `save_draft` takes the page's `content` whole as the PATCH body and its `version` as `X-Draft-Version`, writes a draft version that never goes live, and answers 409 `conflict` with `currentVersion` when the draft moved; `read_report` returns the draft tip, the version a save must send, the page's stored layout (`structure`, #10962) and the token `save_structure` must send, its open suggestions and the route's check report (`ready`, `needs repair` or `needs your words`), computed by the route and never by the tool — and (#10956) `create_page`, twinning `POST …/content` with the `content-edit` grant: it creates a page and its first draft from `content` sent whole (its `type` and `slug` are the address), never publishes, and answers 409 `conflict` when the page exists and 409 `slug_taken` when another page holds the link — and (#10661) `publish_draft`, twinning `POST …/content/:type/:slug/publish` with the `content-publish` grant: it publishes the draft tip (or a named version) exactly as a person holding that permission does, an agent without the grant is refused 403 `agent_refused` before anything is read, and it never widens Audience or re-enables a doc — and (#10345) the knowledge-base pair, `read_knowledge` and `read_knowledge_doc`, twinning `GET …/knowledge-base` and `GET …/knowledge-base/:type/:slug` with no grant (`docs-read` is every role's): the docs a named member may read (`userId`, by default the agent's own person), at the lower of the agent's person's role and that member's, so naming someone only narrows; Live does not gate them and a disabled doc never appears; `filter: "workspace-memory"` answers the always-loaded set with its `totalTokens` and an 8000-token `warning` — and (#10951) `get_workspace_settings`, twin of `GET /v1/workspaces/:workspaceId/general` (`mcp-workspace`'s `workspace_settings.ts`, no grant): the workspace's name, its own logo (`null` when the organization's applies) and the deployment's deliverable sender (`null` when none is configured, so a magnet's results and completion emails do not go out); the PUT, which renames the workspace and sets its logo, has no tool, by decision — it needs `workspace-settings`, which is never agent-grantable — and the six site-profile tools, `get_site_identity`, `set_site_identity`, `get_site_seo`, `set_site_seo`, `get_welcome_email` and `set_welcome_email` (`mcp-workspace`'s `site_profile.ts`), twinning `GET`/`PUT …/identity`, `…/seo` and `…/welcome-email`: any member reads; each write needs the `site-profile` grant (`ailk:site-profile`), under which every logo and every SEO field but the description — robots and indexing above all — must be sent as read, else `site_profile_field_locked`; the theme pair has no tool, by decision — and (#10733, issue 10905, #10952) the seven Language tools, `list_language_items`, `get_language_item`, `save_language_item`, `set_language_item_live`, `delete_language_item`, `list_language_item_pages` and `get_topic_brief`, twinning `GET …/language`, `GET`/`PUT`/`DELETE …/language/:kind/:slug`, `POST …/language/:kind/:slug/live`, `GET …/language/:kind/:slug/appears-on` and `GET …/language/topic/:slug/brief` (`mcp-workspace`'s `language.ts`): a workspace's glossary terms, FAQs and topics; reading needs no grant, saving the `content-edit` grant (`version: null` creates, a tip id updates, 409 `slug_taken` / `stale` otherwise), the Live switch `content-publish` with the `version` the person reviewed, and the delete `content-publish` too — it removes the item from every Live page, no route restores it, and its slug stays taken; tags are the hub's and never written by a tool; a topic is a keyword cluster for agents and is never shown to visitors, and `get_topic_brief` reads it as a writing brief — its kept rows scored best bets first, from the Live version when Live; the Topic's Keyword Planner import and the value-thresholds pair are a person's and have no tool, by decision — and (#10948) the three magnet tools, `list_magnets`, `get_magnet` and `save_magnet`, twinning `GET …/magnets`, `GET …/magnets/:id` and `PATCH …/magnets/:id` (`mcp-workspace`'s `magnets.ts`, registered with `multi-tenant` or `signal-collectors`): with the `magnets-manage` grant every magnet in full, without it only live ones as `{ id, slug, kind, title, landingPage, tags }`; `save_magnet` takes the PATCH body whole, so going live is `status: "live"` and the route alone refuses it (`402 plan_required`, `409 conversion_needs_email`), and an agent cannot change what a magnet charges (`403 magnet_pricing_needs_person`); create and the four captured-people lists have no tool, by decision — and (#10949) `get_workspace_offerings`, twin of `GET /v1/workspaces/:workspaceId/offerings` (registered with `multi-tenant` alone, its route's module; `mcp-workspace`'s `offerings.ts`): the Offerings tab's view — unavailable with `no_commerce` or `no_connection`, or the Organization's enabled products with this workspace's shown Prices and Recommended — read with no grant; its PUT, which switches a Price on or off, needs `workspace-settings`, which is never agent-grantable, and has no tool, by decision — and the two library reads, `list_workspace_pages` and `list_assets` (`mcp-workspace`'s `library.ts`, registered with `workspace` or `multi-tenant`), twinning `GET …/library/pages` and `GET …/library/assets`: every page with drafts included and its status (`live`, `draft`, or `disabled` — a person editor's alone), needing the `content-edit` grant, and the asset library read-only with each file's public path, for every role; both filter, page and name the workspace `{ id, name }` they read, and uploading has no tool. No workspace tool widens Audience or re-enables a doc, and only `publish_draft` and `set_language_item_live`, with the `content-publish` grant, set Live (and `delete_language_item`, with the same grant, clears it) — the access route answers every agent 403 `agent_refused`, and the publish, Live and Language delete routes an agent without the grant, which reaches a tool as the code and status. Each takes its route's params, query and body and returns the route's
|
|
212
|
+
price is refused `proposal_needs_person` (a person prices) — and (#10957) `send_person_message`, twinning `POST …/people/:personId/messages`: one message on a client's member feed, saved then emailed (an agent's only to a proved address), needing `inbox-act` with `people-read` or `member-pieces-manage`, and `assets-write` for a file; the operator's message list has no tool, by decision — and (#9681) the four person-thread tools, `get_person_thread`, `set_person_thread_state`, `list_external_threads` and `add_external_thread`, twinning `GET`/`PATCH …/people/:personId/thread` and `GET`/`POST …/people/:personId/external-threads`: a client's whole thread page by page with its read/archived/resolved state, and pointers to email and Slack threads (never message text); reading needs the `people-read` grant, writing also `inbox-act`, and the client erasure route has no tool, by decision — and (#9682) the three person-memory tools, `list_person_memories`, `get_person_memory` and `propose_person_memory`, twinning `GET …/people/:personId/memories`, `GET …/memories/:path` and `POST …/memories`: an agent reads only live, unexpired memories (confirmed by a person, read within 180 days) and its proposal is never live — a new path is a draft, a confirmed one gets a pending version — needing the `people-read` or `people-memory-propose` grant to read and `people-memory-propose` to propose; the six person-only memory routes (edit, delete, confirm, redact, the versions list, restore) have no tool, by decision — and (#9749) `get_slack_connection_status`, twin of `GET /v1/workspaces/:workspaceId/slack-connection` (registered with `workspace`/`multi-tenant`, its route's `TENANCY` row: whether the Organization's Slack is connected, its team name and the date, never a credential; connect and disconnect are a person's act and have no tool, by decision), and `get_prospect_channel_settings` / `set_prospect_channel_settings`, twins of `GET`/`PUT …/prospect-channel` (registered with `scheduling`, their routes' module): the update replaces every field, needs the `meeting-types-manage` grant, is refused `slack_not_connected` while the Organization has no Slack connection, and an agent may change only `enabled`, `channelPrefix` and `archiveDays` — a change to `memberIds` or `welcomeTemplate` is refused `prospect_channel_needs_person` — and (#10950) the three meeting tools, `list_meeting_types`, `save_meeting_types` and `list_appointments`, twinning `GET`/`PUT …/meetings` and `GET /v1/schedule/appointments` (registered with `scheduling`): the meeting types from the connected calendar, each with whether it is Live (`enabled`) and who can book it (`visibility`: `public`, `private` or `authenticated`), the provider's `providerEventTypeId` and `createdAt` when it serves them, and, with the `meeting-types-manage` grant, `providerEditUrl` — the read takes no `include` (#11122 D4); the save needs that grant and its required `enabledSlugs` replaces the Live list, while `customerSlugs` (Authenticated) and `privateSlugs` (Private) are exclusive — a slug in both is refused — and an omitted one keeps the stored list less the sent list's slugs, and no price is set there; the appointments read is every role's, and an agent's only with the `people-read` grant (#10986), takes `eventTypeId` for one type's bookings (#11122 D12) and `workspaceId` when the connection reaches several workspaces (#11753), and its attendee names and emails are public-written text; the three scheduling-connection routes have no tool, by decision — and (#10218) the content-suggestion pair, `draft_page_suggestions` and `decide_page_suggestion` — and (#10336) the draft pair, `save_draft` and `read_report`, twinning `PATCH`/`GET …/content/:type/:slug` with the `content-edit` grant: `save_draft` takes the page's `content` whole as the PATCH body and its `version` as `X-Draft-Version`, writes a draft version that never goes live, and answers 409 `conflict` with `currentVersion` when the draft moved; `read_report` returns the draft tip, the version a save must send, the page's stored layout (`structure`, #10962) and the token `save_structure` must send, its open suggestions and the route's check report (`ready`, `needs repair` or `needs your words`), computed by the route and never by the tool — and (#10956) `create_page`, twinning `POST …/content` with the `content-edit` grant: it creates a page and its first draft from `content` sent whole (its `type` and `slug` are the address), never publishes, and answers 409 `conflict` when the page exists and 409 `slug_taken` when another page holds the link — and (#10661) `publish_draft`, twinning `POST …/content/:type/:slug/publish` with the `content-publish` grant: it publishes the draft tip (or a named version) exactly as a person holding that permission does, an agent without the grant is refused 403 `agent_refused` before anything is read, and it never widens Audience or re-enables a doc — and (#10345) the knowledge-base pair, `read_knowledge` and `read_knowledge_doc`, twinning `GET …/knowledge-base` and `GET …/knowledge-base/:type/:slug` with no grant (`docs-read` is every role's): the docs a named member may read (`userId`, by default the agent's own person), at the lower of the agent's person's role and that member's, so naming someone only narrows; Live does not gate them and a disabled doc never appears; `filter: "workspace-memory"` answers the always-loaded set with its `totalTokens` and an 8000-token `warning` — and (#10951) `get_workspace_settings`, twin of `GET /v1/workspaces/:workspaceId/general` (`mcp-workspace`'s `workspace_settings.ts`, no grant): the workspace's name, its own logo (`null` when the organization's applies) and the deployment's deliverable sender (`null` when none is configured, so a magnet's results and completion emails do not go out); the PUT, which renames the workspace and sets its logo, has no tool, by decision — it needs `workspace-settings`, which is never agent-grantable — and the six site-profile tools, `get_site_identity`, `set_site_identity`, `get_site_seo`, `set_site_seo`, `get_welcome_email` and `set_welcome_email` (`mcp-workspace`'s `site_profile.ts`), twinning `GET`/`PUT …/identity`, `…/seo` and `…/welcome-email`: any member reads; each write needs the `site-profile` grant (`ailk:site-profile`), under which every logo and every SEO field but the description — robots and indexing above all — must be sent as read, else `site_profile_field_locked`; the theme pair has no tool, by decision — and (#10733, issue 10905, #10952) the seven Language tools, `list_language_items`, `get_language_item`, `save_language_item`, `set_language_item_live`, `delete_language_item`, `list_language_item_pages` and `get_topic_brief`, twinning `GET …/language`, `GET`/`PUT`/`DELETE …/language/:kind/:slug`, `POST …/language/:kind/:slug/live`, `GET …/language/:kind/:slug/appears-on` and `GET …/language/topic/:slug/brief` (`mcp-workspace`'s `language.ts`): a workspace's glossary terms, FAQs and topics; reading needs no grant, saving the `content-edit` grant (`version: null` creates, a tip id updates, 409 `slug_taken` / `stale` otherwise), the Live switch `content-publish` with the `version` the person reviewed, and the delete `content-publish` too — it removes the item from every Live page, no route restores it, and its slug stays taken; tags are the hub's and never written by a tool; a topic is a keyword cluster for agents and is never shown to visitors, and `get_topic_brief` reads it as a writing brief — its kept rows scored best bets first, from the Live version when Live; the Topic's Keyword Planner import and the value-thresholds pair are a person's and have no tool, by decision — and (#10948) the three magnet tools, `list_magnets`, `get_magnet` and `save_magnet`, twinning `GET …/magnets`, `GET …/magnets/:id` and `PATCH …/magnets/:id` (`mcp-workspace`'s `magnets.ts`, registered with `multi-tenant` or `signal-collectors`): with the `magnets-manage` grant every magnet in full, without it only live ones as `{ id, slug, kind, title, landingPage, tags }`; `save_magnet` takes the PATCH body whole, so going live is `status: "live"` and the route alone refuses it (`402 plan_required`, `409 conversion_needs_email`), and an agent cannot change what a magnet charges (`403 magnet_pricing_needs_person`); create and the four captured-people lists have no tool, by decision — and (#10949) `get_workspace_offerings`, twin of `GET /v1/workspaces/:workspaceId/offerings` (registered with `multi-tenant` alone, its route's module; `mcp-workspace`'s `offerings.ts`): the Offerings tab's view — unavailable with `no_commerce` or `no_connection`, or the Organization's enabled products with this workspace's shown Prices and Recommended — read with no grant; its PUT, which switches a Price on or off, needs `workspace-settings`, which is never agent-grantable, and has no tool, by decision — and the two library reads, `list_workspace_pages` and `list_assets` (`mcp-workspace`'s `library.ts`, registered with `workspace` or `multi-tenant`), twinning `GET …/library/pages` and `GET …/library/assets`: every page with drafts included and its status (`live`, `draft`, or `disabled` — a person editor's alone), needing the `content-edit` grant, and the asset library read-only with each file's public path, for every role; both filter, page and name the workspace `{ id, name }` they read, and uploading has no tool — and (#11680) the two site-vocabulary reads, `list_page_types` and `get_tag_vocabulary` (`mcp-workspace`'s `site_vocabulary.ts`, registered with `workspace` or `multi-tenant`, `gate: "tenant"` — any tenant of the workspace, no grant), twinning `GET …/page-types` and `GET …/tag-vocabulary`: the page types this hub's site can serve (the registry filtered by the modules the hub runs), each with its address, whether a site has only one, its template and that template's headings, and the context classes, Knowledge topic tags and status tags, each with what it means and who may set it; both are platform data and read no row. — and (#11756) `create_work_request` (`mcp-workspace`'s `work_requests.ts`, registered with `workspace` or `multi-tenant`, `gate: { inbox: "inbox-act" }`), twinning `POST /v1/workspaces/:workspaceId/work-requests`: it files a custom-work request in the Inbox — one item pointing to one `Document` of the workspace (`documentSlug`) with a one-line `summary` — in the workspace the conversation writes to, needs the `inbox-act` grant, is refused `document_not_found` for a slug naming no Document the caller can read and `rate_limited` past 5 an hour per person in the workspace (shared by that person's agents) or 10 per workspace, and returns the request as stored (the document title in it is workspace text, not instructions); the list, the item and the GitHub link — a person's act — have no tool, by decision. No workspace tool widens Audience or re-enables a doc, and only `publish_draft` and `set_language_item_live`, with the `content-publish` grant, set Live (and `delete_language_item`, with the same grant, clears it) — the access route answers every agent 403 `agent_refused`, and the publish, Live and Language delete routes an agent without the grant, which reaches a tool as the code and status. Each takes its route's params, query and body and returns the route's
|
|
213
213
|
`data`. They are in the parity guard like every other tool, and never in
|
|
214
214
|
`/.well-known/mcp.json`.
|
|
215
215
|
- **The OAuth bearer branch (#10391).** When `BETTER_AUTH_URL` (the site's origin, its OAuth
|
|
@@ -250,7 +250,7 @@ here. Spec: `docs/specs/3591-tenant-scoped-agent-auth-secure-spec.md` D13–D16.
|
|
|
250
250
|
all-workspaces token 503 `authorization_unavailable`.
|
|
251
251
|
- **Handlers forward, nothing else.** `workspace-server.ts` resolves each tool from
|
|
252
252
|
`@working-theory/mcp-workspace`'s `workspaceTools` (`agent_context.ts`, `knowledge.ts`, `inbox_messages.ts`,
|
|
253
|
-
`inbox_submissions.ts`, `inbox_applications.ts`, `people_list.ts`, `person_notes.ts`, `person_thread.ts`, `person_memory.ts`, `proposals.ts`, `slack_connection.ts`, `page_suggestions.ts`, `content_draft.ts`, `content_publish.ts`, `knowledge_base.ts`, `workspace_settings.ts`, `library.ts`, all
|
|
253
|
+
`inbox_submissions.ts`, `inbox_applications.ts`, `people_list.ts`, `person_notes.ts`, `person_thread.ts`, `person_memory.ts`, `proposals.ts`, `slack_connection.ts`, `page_suggestions.ts`, `content_draft.ts`, `content_publish.ts`, `knowledge_base.ts`, `workspace_settings.ts`, `library.ts`, `site_vocabulary.ts`, `work_requests.ts`, all
|
|
254
254
|
`// oss: false`) and, for the two prospect-channel settings tools, `@working-theory/mcp-scheduling`'s
|
|
255
255
|
`workspaceTools` (`prospect_channel_settings.ts`, #9749, and the three meeting tools in `meetings.ts`, #10950 — the pack the scheduling module carries, so a
|
|
256
256
|
scheduling-only build serves what it lists), loaded through the site's generated registry, as `server.ts` resolves the
|
|
@@ -334,7 +334,13 @@ Example (lead routing):
|
|
|
334
334
|
- Don't add a tool without the matching `apps/api` endpoint.
|
|
335
335
|
- Don't put business logic in tool handlers — they're adapters.
|
|
336
336
|
|
|
337
|
-
Last updated: 2026-11-
|
|
337
|
+
Last updated: 2026-11-16 — #11756: `create_work_request` (`mcp-workspace`'s `work_requests.ts`) twins `POST /v1/workspaces/:workspaceId/work-requests` under the `inbox-act` grant; the list, item and issue-link routes have no tool — verified against `packages/metadata/src/mcp-tool-catalog.ts`, `packages-paid/mcp-workspace/src/index.ts`, `packages-paid/api-workspace/src/routes/workspaces/work-requests.ts` and `tests/parity/api-parity/kinds/site.ts`.
|
|
338
|
+
|
|
339
|
+
Prior: 2026-11-16 — #11753: `list_appointments` takes an optional `workspaceId`, sent in the query and as `x-ailk-workspace-scope`, so a connection that reaches several workspaces can read one's bookings; the route refuses a named workspace that is not the admitted one — verified against `packages/metadata/src/mcp-tool-catalog.ts`, `packages/api-client/src/schedule.ts` and `packages-paid/api-scheduling/src/routes/schedule/appointments.ts`.
|
|
340
|
+
|
|
341
|
+
Prior: 2026-11-14 — #11680: `list_page_types` and `get_tag_vocabulary` added to the signed-in workspace surface (`gate: "tenant"`, `site_vocabulary.ts`) — verified against `packages/metadata/src/mcp-tool-catalog.ts` and `packages-paid/api-content-write/src/routes/workspaces/site-vocabulary.ts`.
|
|
342
|
+
|
|
343
|
+
Prior: 2026-11-12 — #10986: `list_appointments` needs the `people-read` grant for an agent (its gate is the `appointments-read` role floor and that grant, the route's own check) — verified against `packages/metadata/src/mcp-tool-catalog.ts` and `packages-paid/api-scheduling/src/routes/schedule/appointments.ts`.
|
|
338
344
|
|
|
339
345
|
Prior: 2026-11-08 — #11122 (D4, D5, D12): `list_meeting_types` loses `include` and its rows carry `visibility`, `providerEventTypeId`, `createdAt` and (manage view) `providerEditUrl`; `save_meeting_types`' two lists are exclusive; `list_appointments` takes `eventTypeId` — verified against `packages/metadata/src/mcp-tool-catalog.ts` and `tests/parity/api-parity/fixtures/site-wire.ts`.
|
|
340
346
|
|