@superbee/core 0.2.0-pre.41 → 0.2.0-pre.42
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 +50 -9
- package/dist/backend.d.ts +17 -1
- package/dist/backend.d.ts.map +1 -1
- package/dist/backend.js +41 -6
- package/dist/backend.js.map +1 -1
- package/dist/body-pages.d.ts +20 -0
- package/dist/body-pages.d.ts.map +1 -0
- package/dist/body-pages.js +56 -0
- package/dist/body-pages.js.map +1 -0
- package/dist/body-replace-guards.d.ts +29 -3
- package/dist/body-replace-guards.d.ts.map +1 -1
- package/dist/body-replace-guards.js +112 -19
- package/dist/body-replace-guards.js.map +1 -1
- package/dist/bounded-yaml.d.ts +28 -0
- package/dist/bounded-yaml.d.ts.map +1 -0
- package/dist/bounded-yaml.js +182 -0
- package/dist/bounded-yaml.js.map +1 -0
- package/dist/builtin-recipes/site.d.ts +5 -0
- package/dist/builtin-recipes/site.d.ts.map +1 -0
- package/dist/builtin-recipes/site.js +83 -0
- package/dist/builtin-recipes/site.js.map +1 -0
- package/dist/builtin-recipes.d.ts.map +1 -1
- package/dist/builtin-recipes.js +22 -0
- package/dist/builtin-recipes.js.map +1 -1
- package/dist/bundle-health/index.d.ts +2 -2
- package/dist/bundle-health/index.d.ts.map +1 -1
- package/dist/bundle-health/index.js +1 -1
- package/dist/bundle-health/index.js.map +1 -1
- package/dist/bundle-health/legacy-page.d.ts +8 -26
- package/dist/bundle-health/legacy-page.d.ts.map +1 -1
- package/dist/bundle-health/legacy-page.js +10 -35
- package/dist/bundle-health/legacy-page.js.map +1 -1
- package/dist/bundle-health/report.d.ts +0 -16
- package/dist/bundle-health/report.d.ts.map +1 -1
- package/dist/bundle-health/report.js +24 -54
- package/dist/bundle-health/report.js.map +1 -1
- package/dist/bundle-ops.d.ts +4 -1
- package/dist/bundle-ops.d.ts.map +1 -1
- package/dist/bundle-ops.js +6 -2
- package/dist/bundle-ops.js.map +1 -1
- package/dist/bundle.d.ts +1 -1
- package/dist/bundle.d.ts.map +1 -1
- package/dist/bundle.js +1 -1
- package/dist/bundle.js.map +1 -1
- package/dist/cross-bundle.d.ts +2 -2
- package/dist/cross-bundle.js +2 -2
- package/dist/document-codec.d.ts +3 -1
- package/dist/document-codec.d.ts.map +1 -1
- package/dist/document-codec.js +3 -1
- package/dist/document-codec.js.map +1 -1
- package/dist/document-mutation.d.ts.map +1 -1
- package/dist/document-mutation.js +39 -9
- package/dist/document-mutation.js.map +1 -1
- package/dist/document-scan.d.ts +23 -0
- package/dist/document-scan.d.ts.map +1 -0
- package/dist/document-scan.js +70 -0
- package/dist/document-scan.js.map +1 -0
- package/dist/document-transfer.d.ts +110 -4
- package/dist/document-transfer.d.ts.map +1 -1
- package/dist/document-transfer.js +490 -30
- package/dist/document-transfer.js.map +1 -1
- package/dist/engine.d.ts +4 -19
- package/dist/engine.d.ts.map +1 -1
- package/dist/engine.js +7 -47
- package/dist/engine.js.map +1 -1
- package/dist/errors.d.ts +37 -1
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +75 -3
- package/dist/errors.js.map +1 -1
- package/dist/file-journaled-backend.d.ts.map +1 -1
- package/dist/file-journaled-backend.js +2 -2
- package/dist/file-journaled-backend.js.map +1 -1
- package/dist/filesystem-identity.d.ts +9 -0
- package/dist/filesystem-identity.d.ts.map +1 -1
- package/dist/filesystem-identity.js +186 -64
- package/dist/filesystem-identity.js.map +1 -1
- package/dist/filesystem-lock.d.ts +2 -2
- package/dist/filesystem-lock.d.ts.map +1 -1
- package/dist/filesystem-lock.js +81 -14
- package/dist/filesystem-lock.js.map +1 -1
- package/dist/filesystem-temp-name.d.ts +9 -0
- package/dist/filesystem-temp-name.d.ts.map +1 -0
- package/dist/filesystem-temp-name.js +20 -0
- package/dist/filesystem-temp-name.js.map +1 -0
- package/dist/filesystem.d.ts +6 -0
- package/dist/filesystem.d.ts.map +1 -1
- package/dist/filesystem.js +2 -1
- package/dist/filesystem.js.map +1 -1
- package/dist/frontmatter-contract.d.ts +14 -0
- package/dist/frontmatter-contract.d.ts.map +1 -1
- package/dist/frontmatter-contract.js +22 -0
- package/dist/frontmatter-contract.js.map +1 -1
- package/dist/frontmatter-splitter.d.ts +6 -0
- package/dist/frontmatter-splitter.d.ts.map +1 -1
- package/dist/frontmatter-splitter.js +8 -0
- package/dist/frontmatter-splitter.js.map +1 -1
- package/dist/frontmatter.d.ts +8 -1
- package/dist/frontmatter.d.ts.map +1 -1
- package/dist/frontmatter.js +43 -7
- package/dist/frontmatter.js.map +1 -1
- package/dist/hosted-client/client.d.ts +22 -5
- package/dist/hosted-client/client.d.ts.map +1 -1
- package/dist/hosted-client/client.js +57 -10
- package/dist/hosted-client/client.js.map +1 -1
- package/dist/hosted-client/index.d.ts +1 -0
- package/dist/hosted-client/index.d.ts.map +1 -1
- package/dist/hosted-client/index.js +1 -0
- package/dist/hosted-client/index.js.map +1 -1
- package/dist/hosted-client/view-content.d.ts +107 -0
- package/dist/hosted-client/view-content.d.ts.map +1 -0
- package/dist/hosted-client/view-content.js +155 -0
- package/dist/hosted-client/view-content.js.map +1 -0
- package/dist/hosted-transport/carrier.d.ts +1 -1
- package/dist/hosted-transport/carrier.d.ts.map +1 -1
- package/dist/hosted-transport/carrier.js +27 -18
- package/dist/hosted-transport/carrier.js.map +1 -1
- package/dist/hosted-transport/read-adapter.d.ts +1 -2
- package/dist/hosted-transport/read-adapter.d.ts.map +1 -1
- package/dist/hosted-transport/read-adapter.js.map +1 -1
- package/dist/identity-fold.d.ts +12 -14
- package/dist/identity-fold.d.ts.map +1 -1
- package/dist/identity-fold.js +17 -15
- package/dist/identity-fold.js.map +1 -1
- package/dist/index-projection.d.ts +2 -1
- package/dist/index-projection.d.ts.map +1 -1
- package/dist/index-projection.js +14 -5
- package/dist/index-projection.js.map +1 -1
- package/dist/index.d.ts +24 -15
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +19 -15
- package/dist/index.js.map +1 -1
- package/dist/indexeddb-backend.d.ts.map +1 -1
- package/dist/indexeddb-backend.js +2 -2
- package/dist/indexeddb-backend.js.map +1 -1
- package/dist/json-data.d.ts +3 -0
- package/dist/json-data.d.ts.map +1 -0
- package/dist/json-data.js +19 -0
- package/dist/json-data.js.map +1 -0
- package/dist/kind-authoring.d.ts +18 -0
- package/dist/kind-authoring.d.ts.map +1 -1
- package/dist/kind-authoring.js +54 -4
- package/dist/kind-authoring.js.map +1 -1
- package/dist/kind-coverage.d.ts +1 -0
- package/dist/kind-coverage.d.ts.map +1 -1
- package/dist/kind-coverage.js +4 -5
- package/dist/kind-coverage.js.map +1 -1
- package/dist/kind-undeclared-fields.d.ts +70 -0
- package/dist/kind-undeclared-fields.d.ts.map +1 -0
- package/dist/kind-undeclared-fields.js +120 -0
- package/dist/kind-undeclared-fields.js.map +1 -0
- package/dist/kinds-load.d.ts.map +1 -1
- package/dist/kinds-load.js +4 -1
- package/dist/kinds-load.js.map +1 -1
- package/dist/kinds.d.ts +9 -0
- package/dist/kinds.d.ts.map +1 -1
- package/dist/kinds.js +20 -0
- package/dist/kinds.js.map +1 -1
- package/dist/link-findings.d.ts +130 -0
- package/dist/link-findings.d.ts.map +1 -0
- package/dist/link-findings.js +272 -0
- package/dist/link-findings.js.map +1 -0
- package/dist/link-types.d.ts +7 -0
- package/dist/link-types.d.ts.map +1 -1
- package/dist/link-types.js +17 -2
- package/dist/link-types.js.map +1 -1
- package/dist/memory-backend.d.ts.map +1 -1
- package/dist/memory-backend.js +2 -2
- package/dist/memory-backend.js.map +1 -1
- package/dist/page.d.ts +3 -7
- package/dist/page.d.ts.map +1 -1
- package/dist/page.js +3 -7
- package/dist/page.js.map +1 -1
- package/dist/path-fold.d.ts +29 -16
- package/dist/path-fold.d.ts.map +1 -1
- package/dist/path-fold.js +30 -17
- package/dist/path-fold.js.map +1 -1
- package/dist/paths.d.ts +28 -0
- package/dist/paths.d.ts.map +1 -1
- package/dist/paths.js +82 -1
- package/dist/paths.js.map +1 -1
- package/dist/platform.d.ts +9 -0
- package/dist/platform.d.ts.map +1 -1
- package/dist/platform.js.map +1 -1
- package/dist/portable-frontmatter.d.ts +6 -0
- package/dist/portable-frontmatter.d.ts.map +1 -1
- package/dist/portable-frontmatter.js +26 -2
- package/dist/portable-frontmatter.js.map +1 -1
- package/dist/recipe-lifecycle/install.d.ts +4 -7
- package/dist/recipe-lifecycle/install.d.ts.map +1 -1
- package/dist/recipe-lifecycle/install.js +3 -20
- package/dist/recipe-lifecycle/install.js.map +1 -1
- package/dist/recipe-lifecycle/legacy-aliases.d.ts +1 -13
- package/dist/recipe-lifecycle/legacy-aliases.d.ts.map +1 -1
- package/dist/recipe-lifecycle/legacy-aliases.js +5 -34
- package/dist/recipe-lifecycle/legacy-aliases.js.map +1 -1
- package/dist/record-overlay/apply.d.ts.map +1 -1
- package/dist/record-overlay/apply.js +0 -4
- package/dist/record-overlay/apply.js.map +1 -1
- package/dist/record-overlay/findings.d.ts.map +1 -1
- package/dist/record-overlay/findings.js +4 -1
- package/dist/record-overlay/findings.js.map +1 -1
- package/dist/record-overlay/plan.js +3 -3
- package/dist/record-overlay/plan.js.map +1 -1
- package/dist/record-overlay/signal-text.d.ts +9 -2
- package/dist/record-overlay/signal-text.d.ts.map +1 -1
- package/dist/record-overlay/signal-text.js +21 -11
- package/dist/record-overlay/signal-text.js.map +1 -1
- package/dist/remote-backend.d.ts +9 -19
- package/dist/remote-backend.d.ts.map +1 -1
- package/dist/remote-backend.js +17 -5
- package/dist/remote-backend.js.map +1 -1
- package/dist/remote-operations.d.ts.map +1 -1
- package/dist/remote-operations.js +2 -0
- package/dist/remote-operations.js.map +1 -1
- package/dist/remote-parsers.d.ts +19 -0
- package/dist/remote-parsers.d.ts.map +1 -1
- package/dist/remote-parsers.js.map +1 -1
- package/dist/remote.d.ts +2 -4
- package/dist/remote.d.ts.map +1 -1
- package/dist/remote.js +2 -3
- package/dist/remote.js.map +1 -1
- package/dist/reserved-write.d.ts +9 -0
- package/dist/reserved-write.d.ts.map +1 -0
- package/dist/reserved-write.js +15 -0
- package/dist/reserved-write.js.map +1 -0
- package/dist/search/backend-source.d.ts +2 -2
- package/dist/search/backend-source.d.ts.map +1 -1
- package/dist/search/backend-source.js +30 -6
- package/dist/search/backend-source.js.map +1 -1
- package/dist/search/contract.d.ts +3 -0
- package/dist/search/contract.d.ts.map +1 -1
- package/dist/search/contract.js.map +1 -1
- package/dist/search/search.d.ts.map +1 -1
- package/dist/search/search.js +4 -1
- package/dist/search/search.js.map +1 -1
- package/dist/search/source.d.ts +3 -0
- package/dist/search/source.d.ts.map +1 -1
- package/dist/site-manifest.d.ts +49 -0
- package/dist/site-manifest.d.ts.map +1 -0
- package/dist/site-manifest.js +113 -0
- package/dist/site-manifest.js.map +1 -0
- package/dist/skip-reasons.d.ts +12 -0
- package/dist/skip-reasons.d.ts.map +1 -0
- package/dist/skip-reasons.js +15 -0
- package/dist/skip-reasons.js.map +1 -0
- package/dist/source-engine/driver.d.ts +1 -3
- package/dist/source-engine/driver.d.ts.map +1 -1
- package/dist/source-engine/driver.js +2 -18
- package/dist/source-engine/driver.js.map +1 -1
- package/dist/source-profiles/index.d.ts +1 -1
- package/dist/source-profiles/index.js +1 -1
- package/dist/string-identity-agreement.d.ts +1 -1
- package/dist/string-identity-agreement.d.ts.map +1 -1
- package/dist/string-identity-agreement.js +6 -0
- package/dist/string-identity-agreement.js.map +1 -1
- package/dist/system-documents.d.ts +13 -0
- package/dist/system-documents.d.ts.map +1 -0
- package/dist/system-documents.js +44 -0
- package/dist/system-documents.js.map +1 -0
- package/dist/types.d.ts +7 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/validation.d.ts +5 -0
- package/dist/validation.d.ts.map +1 -1
- package/package.json +19 -7
|
@@ -1,8 +1,17 @@
|
|
|
1
1
|
/** Storage-neutral body replacement policy and portable preview identity. */
|
|
2
2
|
import { normalizeDocumentBodyForStorage } from "./frontmatter.js";
|
|
3
|
-
import {
|
|
3
|
+
import { extractMarkdownLinkSpans, resolveConceptId } from "./links.js";
|
|
4
|
+
import { isQualifiedHref, parseQualifiedHref } from "./qualified-links.js";
|
|
4
5
|
import { InvalidInputError } from "./errors.js";
|
|
6
|
+
import { bodyPage } from "./body-pages.js";
|
|
7
|
+
/** The preview bound, in characters, for records that may list many bodies (`doc history`,
|
|
8
|
+
* `sync show-incoming`). */
|
|
5
9
|
export const BODY_PREVIEW_LIMIT = 1000;
|
|
10
|
+
/** The `doc read` record's body bound, in UTF-8 bytes: a body this size or smaller arrives whole.
|
|
11
|
+
* Agents mostly read through a shell tool, and Claude Code reads back at most 30,000 characters of
|
|
12
|
+
* a command's output by default (`BASH_MAX_OUTPUT_LENGTH`); 20 KiB of body leaves room for the
|
|
13
|
+
* frontmatter, string escaping and help inside that. */
|
|
14
|
+
export const DOC_READ_PREVIEW_BYTES = 20_480;
|
|
6
15
|
export const BODY_PREVIEW_TRUNCATION_MARKER = "[superbee:body-preview-truncated]";
|
|
7
16
|
function previewTruncationNotice(omitted) {
|
|
8
17
|
return `${BODY_PREVIEW_TRUNCATION_MARKER} ${omitted} more character(s) are NOT shown`;
|
|
@@ -16,25 +25,64 @@ export const BODY_PREVIEW_RESERVED_KEYS = [
|
|
|
16
25
|
"body_chars",
|
|
17
26
|
"help",
|
|
18
27
|
];
|
|
19
|
-
|
|
20
|
-
|
|
28
|
+
/** Record fields a truncated preview adds that a document's own frontmatter may also use. They are
|
|
29
|
+
* claimed only on a truncated record; a document value already there moves to `frontmatter_<key>`,
|
|
30
|
+
* so the document's field stays visible. */
|
|
31
|
+
function truncatedRecordKeys(paged) {
|
|
32
|
+
return paged ? ["warning", "next_offset"] : ["warning"];
|
|
33
|
+
}
|
|
34
|
+
/** The leading slice of `body` a preview shows, or undefined when the whole body fits. Without
|
|
35
|
+
* `pageBytes` the bound is BODY_PREVIEW_LIMIT characters; with it, the preview is exactly the first
|
|
36
|
+
* `doc read --offset 0 --max-bytes <pageBytes>` page, so `--offset <next_offset>` continues it. */
|
|
37
|
+
function previewSlice(body, pageBytes) {
|
|
38
|
+
if (pageBytes === undefined)
|
|
39
|
+
return body.length > BODY_PREVIEW_LIMIT ? body.slice(0, BODY_PREVIEW_LIMIT) : undefined;
|
|
40
|
+
const page = bodyPage(body, 0, pageBytes);
|
|
41
|
+
return page.range.complete ? undefined : page.body;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Put `body` on `rec` whole, or, when it is over the bound, as a marked `body_preview`. A truncated
|
|
45
|
+
* record leads with a `warning` sentence and `body_truncated`, so a reader who stops at the first
|
|
46
|
+
* line still learns the value is partial.
|
|
47
|
+
*/
|
|
48
|
+
export function attachBodyPreview(rec, body, fullBodyHelp, options = {}) {
|
|
49
|
+
const shown = previewSlice(body, options.pageBytes);
|
|
50
|
+
if (shown === undefined) {
|
|
21
51
|
rec.body = body;
|
|
22
52
|
return;
|
|
23
53
|
}
|
|
24
|
-
const
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
54
|
+
const cut = { shownChars: shown.length, nextOffset: shown.length };
|
|
55
|
+
const omitted = body.length - shown.length;
|
|
56
|
+
const claimed = truncatedRecordKeys(options.pageBytes !== undefined);
|
|
57
|
+
const rest = {};
|
|
58
|
+
for (const [key, value] of Object.entries(rec)) {
|
|
59
|
+
rest[claimed.includes(key) ? `frontmatter_${key}` : key] = value;
|
|
60
|
+
delete rec[key];
|
|
61
|
+
}
|
|
62
|
+
rec.warning =
|
|
63
|
+
`body truncated: body_preview shows the first ${shown.length} of ${body.length} characters and is ` +
|
|
64
|
+
`not the document body. Read the complete body with the first help command before judging or ` +
|
|
28
65
|
`rewriting it.`;
|
|
29
66
|
rec.body_truncated = true;
|
|
30
67
|
rec.body_chars = body.length;
|
|
31
|
-
rec
|
|
68
|
+
Object.assign(rec, rest);
|
|
69
|
+
rec[BODY_PREVIEW_KEY] =
|
|
70
|
+
`${shown}\n\n${previewTruncationNotice(omitted)}. This value is a preview, not the document ` +
|
|
71
|
+
`body; read the complete body with this record's help before rewriting it.`;
|
|
72
|
+
if (options.pageBytes !== undefined)
|
|
73
|
+
rec.next_offset = cut.nextOffset;
|
|
74
|
+
rec.help = [...(typeof fullBodyHelp === "function" ? fullBodyHelp(cut) : fullBodyHelp)];
|
|
75
|
+
}
|
|
76
|
+
/** Spellings that change no text a reader sees: a byte-order mark, CRLF or CR line endings, and
|
|
77
|
+
* surrounding whitespace. */
|
|
78
|
+
function previewComparable(text) {
|
|
79
|
+
return text.replace(/^\uFEFF/, "").replace(/\r\n?/g, "\n").trim();
|
|
32
80
|
}
|
|
33
81
|
function matchesPreviewSlice(candidate, preview) {
|
|
34
82
|
if (candidate === preview)
|
|
35
83
|
return true;
|
|
36
|
-
const
|
|
37
|
-
return
|
|
84
|
+
const comparable = previewComparable(preview);
|
|
85
|
+
return comparable !== "" && previewComparable(candidate) === comparable;
|
|
38
86
|
}
|
|
39
87
|
function firstForeignNotice(storedBody, nextBody) {
|
|
40
88
|
const preservesStoredBody = nextBody.includes(storedBody.trimEnd());
|
|
@@ -55,8 +103,11 @@ export function bodyPreviewFinding(existing, nextBody) {
|
|
|
55
103
|
const notice = firstForeignNotice(existing.body, nextBody);
|
|
56
104
|
if (notice !== undefined)
|
|
57
105
|
return { reason: "preview_marker", marker: BODY_PREVIEW_TRUNCATION_MARKER, notice };
|
|
58
|
-
|
|
59
|
-
|
|
106
|
+
for (const pageBytes of [undefined, DOC_READ_PREVIEW_BYTES]) {
|
|
107
|
+
const preview = previewSlice(existing.body, pageBytes);
|
|
108
|
+
if (preview !== undefined && matchesPreviewSlice(nextBody, preview)) {
|
|
109
|
+
return { reason: "stored_body_preview", preview_limit: preview.length, supplied_body_chars: nextBody.length, stored_body_chars: existing.body.length };
|
|
110
|
+
}
|
|
60
111
|
}
|
|
61
112
|
}
|
|
62
113
|
export class BodyReplaceError extends InvalidInputError {
|
|
@@ -89,12 +140,17 @@ export function captureBodyReplacePosture(value) {
|
|
|
89
140
|
}
|
|
90
141
|
return captured;
|
|
91
142
|
}
|
|
92
|
-
/**
|
|
93
|
-
|
|
143
|
+
/** A cross-bundle edge is a different target from a local one with the same id. */
|
|
144
|
+
function targetKey(l) {
|
|
145
|
+
return l.bundle === undefined ? l.to : `okf://${l.bundle}/${l.to}`;
|
|
146
|
+
}
|
|
147
|
+
/** Exact pairs consume first; target mode then admits retext (a standalone edge only by another
|
|
148
|
+
* standalone link) while preserving occurrence counts. Exact-edge mode is available to authorities that protect
|
|
149
|
+
* relationship text as well. */
|
|
94
150
|
export function computeDroppedLinks(existingLinks, nextLinks, mode = "target") {
|
|
95
151
|
const nextByTarget = new Map();
|
|
96
152
|
for (const l of nextLinks) {
|
|
97
|
-
const key = mode === "exact-edge" ? JSON.stringify([l.from, l
|
|
153
|
+
const key = mode === "exact-edge" ? JSON.stringify([l.from, targetKey(l)]) : targetKey(l);
|
|
98
154
|
const bucket = nextByTarget.get(key);
|
|
99
155
|
if (bucket)
|
|
100
156
|
bucket.push(l);
|
|
@@ -103,7 +159,7 @@ export function computeDroppedLinks(existingLinks, nextLinks, mode = "target") {
|
|
|
103
159
|
}
|
|
104
160
|
const existingByTarget = new Map();
|
|
105
161
|
for (const l of existingLinks) {
|
|
106
|
-
const key = mode === "exact-edge" ? JSON.stringify([l.from, l
|
|
162
|
+
const key = mode === "exact-edge" ? JSON.stringify([l.from, targetKey(l)]) : targetKey(l);
|
|
107
163
|
const bucket = existingByTarget.get(key);
|
|
108
164
|
if (bucket)
|
|
109
165
|
bucket.push(l);
|
|
@@ -125,16 +181,53 @@ export function computeDroppedLinks(existingLinks, nextLinks, mode = "target") {
|
|
|
125
181
|
// Pass 2: retext — any leftover old occurrence pairs with any leftover same-target occurrence,
|
|
126
182
|
// regardless of text; anything still left over after that is a real drop.
|
|
127
183
|
for (const old of unmatchedExact) {
|
|
128
|
-
|
|
129
|
-
|
|
184
|
+
// A prose link prefers a prose stand-in, leaving standalone links for standalone edges.
|
|
185
|
+
const prose = available.findIndex((n) => !n.standalone);
|
|
186
|
+
const idx = mode !== "target" ? -1
|
|
187
|
+
: old.standalone ? available.findIndex((n) => n.standalone) : prose >= 0 ? prose : 0;
|
|
188
|
+
if (idx >= 0 && idx < available.length)
|
|
189
|
+
available.splice(idx, 1);
|
|
130
190
|
else
|
|
131
191
|
dropped.push(old);
|
|
132
192
|
}
|
|
133
193
|
}
|
|
134
194
|
return dropped;
|
|
135
195
|
}
|
|
196
|
+
function aloneOnLine(body, span) {
|
|
197
|
+
const lineStart = body.lastIndexOf("\n", span.start - 1) + 1;
|
|
198
|
+
const newline = body.indexOf("\n", span.end);
|
|
199
|
+
const lineEnd = newline < 0 ? body.length : newline;
|
|
200
|
+
return body.slice(lineStart, span.start).trim() === "" && body.slice(span.end, lineEnd).trim() === "";
|
|
201
|
+
}
|
|
202
|
+
/**
|
|
203
|
+
* Every outbound cross-link a body carries, as the guard compares them: local document links (as
|
|
204
|
+
* `parseLinksFromDoc` reads them) and well-formed `okf:` links into another bundle outside code (as
|
|
205
|
+
* `parseQualifiedLinks` reads them). Web links are not cross-links.
|
|
206
|
+
*/
|
|
207
|
+
export function outboundLinks(doc) {
|
|
208
|
+
const live = new Set(extractMarkdownLinkSpans(doc.body, { skipCode: true }).map((span) => span.start));
|
|
209
|
+
const links = [];
|
|
210
|
+
for (const span of extractMarkdownLinkSpans(doc.body)) {
|
|
211
|
+
if (span.image)
|
|
212
|
+
continue;
|
|
213
|
+
const standalone = aloneOnLine(doc.body, span);
|
|
214
|
+
if (isQualifiedHref(span.href)) {
|
|
215
|
+
if (!live.has(span.start))
|
|
216
|
+
continue;
|
|
217
|
+
const parsed = parseQualifiedHref(span.href);
|
|
218
|
+
if (parsed.ok)
|
|
219
|
+
links.push({ from: doc.id, to: parsed.ref.id, text: span.text, href: span.href, bundle: parsed.ref.alias, standalone });
|
|
220
|
+
continue;
|
|
221
|
+
}
|
|
222
|
+
const to = resolveConceptId(doc.id, span.href);
|
|
223
|
+
if (to !== null)
|
|
224
|
+
links.push({ from: doc.id, to, text: span.text, href: span.href, standalone });
|
|
225
|
+
}
|
|
226
|
+
return links;
|
|
227
|
+
}
|
|
136
228
|
export function droppedLinks(_bundle, existing, nextBody) {
|
|
137
|
-
return computeDroppedLinks(
|
|
229
|
+
return computeDroppedLinks(outboundLinks(existing), outboundLinks({ ...existing, body: nextBody }))
|
|
230
|
+
.map(({ standalone: _standalone, ...link }) => link);
|
|
138
231
|
}
|
|
139
232
|
export function guardTruncatedBodyPreview(existing, nextBody, acceptTruncatedBody) {
|
|
140
233
|
if (acceptTruncatedBody)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"body-replace-guards.js","sourceRoot":"","sources":["../src/body-replace-guards.ts"],"names":[],"mappings":"AAAA,6EAA6E;AAC7E,OAAO,EAAE,+BAA+B,EAAE,MAAM,kBAAkB,CAAC;AACnE,OAAO,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAC/C,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAIhD,MAAM,CAAC,MAAM,kBAAkB,GAAG,IAAI,CAAC;AAEvC,MAAM,CAAC,MAAM,8BAA8B,GAAG,mCAAmC,CAAC;AAElF,SAAS,uBAAuB,CAAC,OAAe;IAC9C,OAAO,GAAG,8BAA8B,IAAI,OAAO,kCAAkC,CAAC;AACxF,CAAC;AAED,MAAM,CAAC,MAAM,iCAAiC,GAC5C,6FAA6F,CAAC;AAEhG,MAAM,CAAC,MAAM,gBAAgB,GAAG,cAAc,CAAC;AAE/C,MAAM,CAAC,MAAM,0BAA0B,GAAsB;IAC3D,MAAM;IACN,gBAAgB;IAChB,gBAAgB;IAChB,YAAY;IACZ,MAAM;CACP,CAAC;AAEF,MAAM,UAAU,iBAAiB,CAC/B,GAA4B,EAC5B,IAAY,EACZ,YAA+B;IAE/B,IAAI,IAAI,CAAC,MAAM,IAAI,kBAAkB,EAAE,CAAC;QACtC,GAAG,CAAC,IAAI,GAAG,IAAI,CAAC;QAChB,OAAO;IACT,CAAC;IACD,MAAM,OAAO,GAAG,IAAI,CAAC,MAAM,GAAG,k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AE,OAAO,CAAC,OAAO,EAAE,mBAAmB,CAAC,CAAC,CAAC;IACrF,iBAAiB,CAAC,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,OAAO,CAAC,OAAO,EAAE,YAAY,CAAC,CAAC,CAAC;AAChF,CAAC;AAED,2FAA2F;AAC3F,MAAM,OAAO,mBAAoB,SAAQ,iBAAiB;IAC/C,KAAK,CAAS;IACd,SAAS,CAAmC;IACrD,YAAY,KAAa,EAAE,SAA2C;QACpE,KAAK,CAAC,IAAI,KAAK,UAAU,SAAS,iDAAiD,CAAC,CAAC;QACrF,IAAI,CAAC,IAAI,GAAG,qBAAqB,CAAC;QAClC,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QAAC,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;IACjD,CAAC;CACF;AACD,MAAM,UAAU,oBAAoB,CAAC,IAAoB,EAAE,YAAoB;IAC7E,MAAM,KAAK,GAAG,IAAI,CAAC,MAAM,CAAC,KAAK,IAAI,EAAE,CAAC;IACtC,MAAM,IAAI,GAAG,MAAM,CAAC,MAAM,CAAC,KAAK,EAAE,YAAY,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;IAClF,IAAI,IAAI,KAAK,aAAa,IAAI,IAAI,KAAK,gBAAgB;QAAE,MAAM,IAAI,mBAAmB,CAAC,YAAY,EAAE,IAAI,CAAC,CAAC;AAC7G,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/** The one runtime-neutral YAML loader for frontmatter and other untrusted YAML values. */
|
|
2
|
+
/**
|
|
3
|
+
* Limits every YAML load applies, all measured on the loaded value with aliases expanded.
|
|
4
|
+
* `sourceChars` counts UTF-16 code units of the YAML source. `depth` counts nested mappings and
|
|
5
|
+
* sequences, the root included, whether written in block or flow style. `aliases` counts alias
|
|
6
|
+
* uses of any node. `expandedNodes` counts every node and `expandedChars` the string and mapping
|
|
7
|
+
* key characters a full traversal visits. A loaded value never contains a cycle.
|
|
8
|
+
*/
|
|
9
|
+
export declare const FRONTMATTER_LIMITS: Readonly<{
|
|
10
|
+
sourceChars: number;
|
|
11
|
+
depth: 32;
|
|
12
|
+
aliases: 1000;
|
|
13
|
+
expandedNodes: 100000;
|
|
14
|
+
expandedChars: number;
|
|
15
|
+
}>;
|
|
16
|
+
export interface BoundedYamlOptions {
|
|
17
|
+
/**
|
|
18
|
+
* A js-yaml schema, or `json` for the JSON schema; the safe default schema when omitted. Typed
|
|
19
|
+
* as `object` so the published declarations do not require js-yaml's type package.
|
|
20
|
+
*/
|
|
21
|
+
schema?: object | "json";
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Load one YAML document within {@link FRONTMATTER_LIMITS}. A refusal throws
|
|
25
|
+
* {@link FrontmatterLimitError}; other YAML errors propagate from js-yaml unchanged.
|
|
26
|
+
*/
|
|
27
|
+
export declare function loadBoundedYaml(source: string, options?: BoundedYamlOptions): unknown;
|
|
28
|
+
//# sourceMappingURL=bounded-yaml.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bounded-yaml.d.ts","sourceRoot":"","sources":["../src/bounded-yaml.ts"],"names":[],"mappings":"AAAA,2FAA2F;AAM3F;;;;;;GAMG;AACH,eAAO,MAAM,kBAAkB;;;;;;EAM7B,CAAC;AAKH,MAAM,WAAW,kBAAkB;IACjC;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;CAC1B;AA0ID;;;GAGG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,GAAE,kBAAuB,GAAG,OAAO,CAuCzF"}
|
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
/** The one runtime-neutral YAML loader for frontmatter and other untrusted YAML values. */
|
|
2
|
+
import yaml from "js-yaml";
|
|
3
|
+
import { FrontmatterLimitError } from "./frontmatter-contract.js";
|
|
4
|
+
/**
|
|
5
|
+
* Limits every YAML load applies, all measured on the loaded value with aliases expanded.
|
|
6
|
+
* `sourceChars` counts UTF-16 code units of the YAML source. `depth` counts nested mappings and
|
|
7
|
+
* sequences, the root included, whether written in block or flow style. `aliases` counts alias
|
|
8
|
+
* uses of any node. `expandedNodes` counts every node and `expandedChars` the string and mapping
|
|
9
|
+
* key characters a full traversal visits. A loaded value never contains a cycle.
|
|
10
|
+
*/
|
|
11
|
+
export const FRONTMATTER_LIMITS = Object.freeze({
|
|
12
|
+
sourceChars: 256 * 1024,
|
|
13
|
+
depth: 32,
|
|
14
|
+
aliases: 1_000,
|
|
15
|
+
expandedNodes: 100_000,
|
|
16
|
+
expandedChars: 1024 * 1024,
|
|
17
|
+
});
|
|
18
|
+
/** Parser nesting allowed before the value can be measured; a stack guard, not the depth rule. */
|
|
19
|
+
const PARSE_NESTING_GUARD = FRONTMATTER_LIMITS.depth * 4;
|
|
20
|
+
function tooDeep() {
|
|
21
|
+
return new FrontmatterLimitError("FRONTMATTER_TOO_DEEP", `YAML nesting is deeper than ${FRONTMATTER_LIMITS.depth} levels`);
|
|
22
|
+
}
|
|
23
|
+
function tooLarge() {
|
|
24
|
+
return new FrontmatterLimitError("FRONTMATTER_ALIAS_LIMIT", `YAML aliases expand to more than ${FRONTMATTER_LIMITS.expandedNodes} nodes or ${FRONTMATTER_LIMITS.expandedChars} characters`);
|
|
25
|
+
}
|
|
26
|
+
function cycle() {
|
|
27
|
+
return new FrontmatterLimitError("FRONTMATTER_CYCLE", "YAML aliases form a cycle");
|
|
28
|
+
}
|
|
29
|
+
function scalarExtent(value) {
|
|
30
|
+
// Binary scalars serialize at least one character per byte, so they count against the same cap.
|
|
31
|
+
const chars = typeof value === "string" ? value.length : ArrayBuffer.isView(value) ? value.byteLength : 0;
|
|
32
|
+
return { nodes: 1, chars, depth: 0 };
|
|
33
|
+
}
|
|
34
|
+
function isCollection(value) {
|
|
35
|
+
if (Array.isArray(value))
|
|
36
|
+
return true;
|
|
37
|
+
if (value === null || typeof value !== "object")
|
|
38
|
+
return false;
|
|
39
|
+
const prototype = Object.getPrototypeOf(value);
|
|
40
|
+
return prototype === Object.prototype || prototype === null;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Measures values with aliases expanded, reusing the extent of a collection that is referenced
|
|
44
|
+
* more than once. Mapping keys count toward characters. A reference to a collection on the current
|
|
45
|
+
* path, or to an anchored collection the parser is still filling, is a cycle and is refused.
|
|
46
|
+
*/
|
|
47
|
+
class ExtentMeter {
|
|
48
|
+
known = new Map();
|
|
49
|
+
path = new Set();
|
|
50
|
+
unfinished;
|
|
51
|
+
constructor(unfinished = new Set()) {
|
|
52
|
+
this.unfinished = unfinished;
|
|
53
|
+
}
|
|
54
|
+
measure(value) {
|
|
55
|
+
if (!isCollection(value))
|
|
56
|
+
return scalarExtent(value);
|
|
57
|
+
const known = this.known.get(value);
|
|
58
|
+
if (known !== undefined)
|
|
59
|
+
return known;
|
|
60
|
+
if (this.path.has(value) || this.unfinished.has(value))
|
|
61
|
+
throw cycle();
|
|
62
|
+
return this.walk(value);
|
|
63
|
+
}
|
|
64
|
+
walk(value) {
|
|
65
|
+
if (this.path.size >= FRONTMATTER_LIMITS.depth)
|
|
66
|
+
throw tooDeep();
|
|
67
|
+
this.path.add(value);
|
|
68
|
+
const keyed = !Array.isArray(value);
|
|
69
|
+
const extent = { nodes: 1, chars: 0, depth: 1 };
|
|
70
|
+
for (const [key, child] of Object.entries(value)) {
|
|
71
|
+
const inner = this.measure(child);
|
|
72
|
+
extent.nodes += inner.nodes;
|
|
73
|
+
extent.chars += inner.chars + (keyed ? key.length : 0);
|
|
74
|
+
extent.depth = Math.max(extent.depth, inner.depth + 1);
|
|
75
|
+
if (extent.nodes > FRONTMATTER_LIMITS.expandedNodes || extent.chars > FRONTMATTER_LIMITS.expandedChars)
|
|
76
|
+
throw tooLarge();
|
|
77
|
+
if (extent.depth > FRONTMATTER_LIMITS.depth)
|
|
78
|
+
throw tooDeep();
|
|
79
|
+
}
|
|
80
|
+
this.path.delete(value);
|
|
81
|
+
this.known.set(value, extent);
|
|
82
|
+
return extent;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Charges each alias as the parser resolves it, so expansion work done while parsing (merge keys,
|
|
87
|
+
* collection keys) stays within the same budget as the loaded value.
|
|
88
|
+
*/
|
|
89
|
+
class AliasBudget {
|
|
90
|
+
unfinished = new Set();
|
|
91
|
+
finished = new Set();
|
|
92
|
+
meter = new ExtentMeter(this.unfinished);
|
|
93
|
+
aliases = 0;
|
|
94
|
+
nodes = 0;
|
|
95
|
+
chars = 0;
|
|
96
|
+
/** Wrap the parser's anchor table; the parser reads it only to resolve an alias. */
|
|
97
|
+
watch(state) {
|
|
98
|
+
state.anchorMap = new Proxy(state.anchorMap, {
|
|
99
|
+
get: (target, name, receiver) => {
|
|
100
|
+
const value = Reflect.get(target, name, receiver);
|
|
101
|
+
if (typeof name === "string")
|
|
102
|
+
this.charge(name, value);
|
|
103
|
+
return value;
|
|
104
|
+
},
|
|
105
|
+
set: (target, name, value, receiver) => {
|
|
106
|
+
if (typeof name === "string") {
|
|
107
|
+
this.finished.delete(name);
|
|
108
|
+
if (isCollection(value))
|
|
109
|
+
this.unfinished.add(value);
|
|
110
|
+
}
|
|
111
|
+
return Reflect.set(target, name, value, receiver);
|
|
112
|
+
},
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
/** Called when an anchored node closes: its anchor now names a complete value. */
|
|
116
|
+
close(anchor, value) {
|
|
117
|
+
this.finished.add(anchor);
|
|
118
|
+
if (isCollection(value))
|
|
119
|
+
this.unfinished.delete(value);
|
|
120
|
+
}
|
|
121
|
+
charge(name, value) {
|
|
122
|
+
this.aliases += 1;
|
|
123
|
+
if (this.aliases > FRONTMATTER_LIMITS.aliases) {
|
|
124
|
+
throw new FrontmatterLimitError("FRONTMATTER_ALIAS_LIMIT", `YAML aliases are used more than ${FRONTMATTER_LIMITS.aliases} times`);
|
|
125
|
+
}
|
|
126
|
+
// An alias to an anchor still being filled names one of its own ancestors.
|
|
127
|
+
if (!this.finished.has(name) && isCollection(value))
|
|
128
|
+
throw cycle();
|
|
129
|
+
const extent = this.meter.measure(value);
|
|
130
|
+
this.nodes += extent.nodes;
|
|
131
|
+
this.chars += extent.chars;
|
|
132
|
+
if (this.nodes > FRONTMATTER_LIMITS.expandedNodes || this.chars > FRONTMATTER_LIMITS.expandedChars)
|
|
133
|
+
throw tooLarge();
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
const MERGE_KEY_LIMIT_REASON = "merge keys exceeded maxTotalMergeKeys";
|
|
137
|
+
/**
|
|
138
|
+
* Load one YAML document within {@link FRONTMATTER_LIMITS}. A refusal throws
|
|
139
|
+
* {@link FrontmatterLimitError}; other YAML errors propagate from js-yaml unchanged.
|
|
140
|
+
*/
|
|
141
|
+
export function loadBoundedYaml(source, options = {}) {
|
|
142
|
+
if (source.length > FRONTMATTER_LIMITS.sourceChars) {
|
|
143
|
+
throw new FrontmatterLimitError("FRONTMATTER_TOO_LARGE", `YAML source is longer than ${FRONTMATTER_LIMITS.sourceChars} characters`);
|
|
144
|
+
}
|
|
145
|
+
const schema = options.schema === "json" ? yaml.JSON_SCHEMA : options.schema;
|
|
146
|
+
const budget = new AliasBudget();
|
|
147
|
+
let watched;
|
|
148
|
+
let nesting = 0;
|
|
149
|
+
let value;
|
|
150
|
+
try {
|
|
151
|
+
value = yaml.safeLoad(source, {
|
|
152
|
+
...(schema ? { schema } : {}),
|
|
153
|
+
listener(event, rawState) {
|
|
154
|
+
const state = rawState;
|
|
155
|
+
if (state.anchorMap !== watched) {
|
|
156
|
+
budget.watch(state);
|
|
157
|
+
watched = state.anchorMap;
|
|
158
|
+
}
|
|
159
|
+
if (event === "open") {
|
|
160
|
+
nesting += 1;
|
|
161
|
+
if (nesting > PARSE_NESTING_GUARD)
|
|
162
|
+
throw tooDeep();
|
|
163
|
+
}
|
|
164
|
+
else {
|
|
165
|
+
nesting -= 1;
|
|
166
|
+
if (state.anchor !== null)
|
|
167
|
+
budget.close(state.anchor, state.result);
|
|
168
|
+
}
|
|
169
|
+
},
|
|
170
|
+
});
|
|
171
|
+
}
|
|
172
|
+
catch (error) {
|
|
173
|
+
const reason = error.reason;
|
|
174
|
+
if (typeof reason === "string" && reason.startsWith(MERGE_KEY_LIMIT_REASON)) {
|
|
175
|
+
throw new FrontmatterLimitError("FRONTMATTER_ALIAS_LIMIT", reason);
|
|
176
|
+
}
|
|
177
|
+
throw error;
|
|
178
|
+
}
|
|
179
|
+
new ExtentMeter().measure(value);
|
|
180
|
+
return value;
|
|
181
|
+
}
|
|
182
|
+
//# sourceMappingURL=bounded-yaml.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bounded-yaml.js","sourceRoot":"","sources":["../src/bounded-yaml.ts"],"names":[],"mappings":"AAAA,2FAA2F;AAE3F,OAAO,IAAI,MAAM,SAAS,CAAC;AAE3B,OAAO,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAElE;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,MAAM,CAAC,MAAM,CAAC;IAC9C,WAAW,EAAE,GAAG,GAAG,IAAI;IACvB,KAAK,EAAE,EAAE;IACT,OAAO,EAAE,KAAK;IACd,aAAa,EAAE,OAAO;IACtB,aAAa,EAAE,IAAI,GAAG,IAAI;CAC3B,CAAC,CAAC;AAEH,kGAAkG;AAClG,MAAM,mBAAmB,GAAG,kBAAkB,CAAC,KAAK,GAAG,CAAC,CAAC;AAqBzD,SAAS,OAAO;IACd,OAAO,IAAI,qBAAqB,CAAC,sBAAsB,EAAE,+BAA+B,kBAAkB,CAAC,KAAK,SAAS,CAAC,CAAC;AAC7H,CAAC;AAED,SAAS,QAAQ;IACf,OAAO,IAAI,qBAAqB,CAC9B,yBAAyB,EACzB,oCAAoC,kBAAkB,CAAC,aAAa,aAAa,kBAAkB,CAAC,aAAa,aAAa,CAC/H,CAAC;AACJ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AAK,EAAE,CAAC;QACf,MAAM,MAAM,GAAI,KAA8B,CAAC,MAAM,CAAC;QACtD,IAAI,OAAO,MAAM,KAAK,QAAQ,IAAI,MAAM,CAAC,UAAU,CAAC,sBAAsB,CAAC,EAAE,CAAC;YAC5E,MAAM,IAAI,qBAAqB,CAAC,yBAAyB,EAAE,MAAM,CAAC,CAAC;QACrE,CAAC;QACD,MAAM,KAAK,CAAC;IACd,CAAC;IACD,IAAI,WAAW,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;IACjC,OAAO,KAAK,CAAC;AACf,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { KindConvention } from "../kinds.js";
|
|
2
|
+
export declare const SITE_KIND: KindConvention;
|
|
3
|
+
export declare const SITE_CONVENTION_BODY = "# Site\n\nDescribe one private content site at sites/<site>, with the site label matching the hosting contract.\nThis convention helps author and inspect declarations. The portable Site validator owns the full\ngrammar and frozen-publication reference checks; editing this convention cannot relax that contract.\nReader grants, builder authorization and activation are separate hosting decisions.\n\nSee [Site authoring](../references/site-authoring.md) for a complete no-View declaration.\n";
|
|
4
|
+
export declare const SITE_AUTHORING_BODY = "# Site authoring\n\nIn a local or Git bundle, install this recipe with `superbee recipe add site`.\nIt installs a convention and this reference, not a Site instance, builder, reader grant or running\nsite. Writing or syncing a declaration is\nnot, by itself, proof that a builder published it or that a recipient can read it.\n\nHosted checkouts do not install this recipe: the Site Kind is reserved by the platform, and\ncheckout recipes do not install References. A Hosted author instead writes a complete Site\ndocument and syncs it, without installing a Kind. The host requires current model-write permission;\nrecipe installation is not a prerequisite or permission grant.\n\nAuthor a complete document at `sites/<site>.md`, using the site's label and one exact presentation\nversion. For example, a declaration at `sites/example.md` can contain:\n\n```yaml\n---\ntype: Site\ntitle: Example briefing\npresentation: \"@superbee/portal-document@0.1.1\"\naudience: restricted\nviews: []\ncapabilities: []\noptions: {}\n---\n```\n\nFor Hosted, write this complete YAML to the canonical checkout file, then run `superbee sync`.\nAlternatively use `superbee promote <file.md> --doc-key sites/<site>.md` in the selected checkout,\nthen sync. A new promote is create-only; for updates use the observed expected-version token or\nedit the tracked checkout file through its existing sync conflict flow. Pull/promote also preserves\nstructured YAML. `doc import` transfers between local/Git bundles and refuses Hosted targets.\nDo not pass `[]` as a string-list CLI flag: that is a string item, not an empty list.\nThe convention leaves views optional because generic Kind-required arrays must be nonempty;\nthe trusted Site validator still requires an explicit list, including `views: []` for no Views.\n\n`superbee/publication/site-manifest` exposes the shared declaration validator and the frozen\npublication reference validator. A declaration requires one Site at `sites/<site>`, an exact\npackage version or repository presentation reference, and the restricted audience. Views, the\noptional landing document and optional brand blobs must resolve in that publication. The selected\npresentation validates its own options; declaring a package does not install or execute it.\n\nDo not put credentials, reader lists, origins or builder settings in the declaration. Hosted\nmodel-write permissions, trusted builder admission, grants, entitlements and release checks remain\nauthoritative. Local creation never registers an app or grants publication or recipient access.\n";
|
|
5
|
+
//# sourceMappingURL=site.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"site.d.ts","sourceRoot":"","sources":["../../src/builtin-recipes/site.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAGlD,eAAO,MAAM,SAAS,EAAE,cAyBvB,CAAC;AAEF,eAAO,MAAM,oBAAoB,gfAQhC,CAAC;AAEF,eAAO,MAAM,mBAAmB,8gFA6C/B,CAAC"}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { SITE_TYPE, SITES_PREFIX } from "../site-manifest.js";
|
|
2
|
+
export const SITE_KIND = {
|
|
3
|
+
id: "conventions/site",
|
|
4
|
+
title: SITE_TYPE,
|
|
5
|
+
governs: SITE_TYPE,
|
|
6
|
+
description: "A private content site's presentation and publication inputs, without reader grants or builder authority.",
|
|
7
|
+
path: SITES_PREFIX,
|
|
8
|
+
fields: {
|
|
9
|
+
required: ["title", "presentation", "audience"],
|
|
10
|
+
// Kind-required arrays must be nonempty; the trusted Site grammar also admits views: [].
|
|
11
|
+
optional: ["description", "landing", "views", "capabilities", "options", "brand"],
|
|
12
|
+
values: { audience: ["restricted"] },
|
|
13
|
+
terminal: {},
|
|
14
|
+
types: { views: "string-list", capabilities: "string-list" },
|
|
15
|
+
descriptions: {
|
|
16
|
+
title: "The site's display title.",
|
|
17
|
+
description: "A short description for the presentation.",
|
|
18
|
+
presentation: "An exact package version (name@version) or repo:owner/name; declaration does not admit code execution.",
|
|
19
|
+
audience: "Restricted to the readers admitted by the hosting authority; this is not a reader list.",
|
|
20
|
+
landing: "A canonical document or registered View id in this publication.",
|
|
21
|
+
views: "Registered View ids. Complete Site YAML must explicitly provide views: [] when there are no Views.",
|
|
22
|
+
capabilities: "Product capability names; hosting separately checks support, entitlements and reader permission.",
|
|
23
|
+
options: "A JSON object validated by the selected presentation; author structured values in complete YAML.",
|
|
24
|
+
brand: "Optional logo and font blob references in the publication; author structured values in complete YAML.",
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
};
|
|
28
|
+
export const SITE_CONVENTION_BODY = `# Site
|
|
29
|
+
|
|
30
|
+
Describe one private content site at sites/<site>, with the site label matching the hosting contract.
|
|
31
|
+
This convention helps author and inspect declarations. The portable Site validator owns the full
|
|
32
|
+
grammar and frozen-publication reference checks; editing this convention cannot relax that contract.
|
|
33
|
+
Reader grants, builder authorization and activation are separate hosting decisions.
|
|
34
|
+
|
|
35
|
+
See [Site authoring](../references/site-authoring.md) for a complete no-View declaration.
|
|
36
|
+
`;
|
|
37
|
+
export const SITE_AUTHORING_BODY = `# Site authoring
|
|
38
|
+
|
|
39
|
+
In a local or Git bundle, install this recipe with \`superbee recipe add site\`.
|
|
40
|
+
It installs a convention and this reference, not a Site instance, builder, reader grant or running
|
|
41
|
+
site. Writing or syncing a declaration is
|
|
42
|
+
not, by itself, proof that a builder published it or that a recipient can read it.
|
|
43
|
+
|
|
44
|
+
Hosted checkouts do not install this recipe: the Site Kind is reserved by the platform, and
|
|
45
|
+
checkout recipes do not install References. A Hosted author instead writes a complete Site
|
|
46
|
+
document and syncs it, without installing a Kind. The host requires current model-write permission;
|
|
47
|
+
recipe installation is not a prerequisite or permission grant.
|
|
48
|
+
|
|
49
|
+
Author a complete document at \`sites/<site>.md\`, using the site's label and one exact presentation
|
|
50
|
+
version. For example, a declaration at \`sites/example.md\` can contain:
|
|
51
|
+
|
|
52
|
+
\`\`\`yaml
|
|
53
|
+
---
|
|
54
|
+
type: Site
|
|
55
|
+
title: Example briefing
|
|
56
|
+
presentation: "@superbee/portal-document@0.1.1"
|
|
57
|
+
audience: restricted
|
|
58
|
+
views: []
|
|
59
|
+
capabilities: []
|
|
60
|
+
options: {}
|
|
61
|
+
---
|
|
62
|
+
\`\`\`
|
|
63
|
+
|
|
64
|
+
For Hosted, write this complete YAML to the canonical checkout file, then run \`superbee sync\`.
|
|
65
|
+
Alternatively use \`superbee promote <file.md> --doc-key sites/<site>.md\` in the selected checkout,
|
|
66
|
+
then sync. A new promote is create-only; for updates use the observed expected-version token or
|
|
67
|
+
edit the tracked checkout file through its existing sync conflict flow. Pull/promote also preserves
|
|
68
|
+
structured YAML. \`doc import\` transfers between local/Git bundles and refuses Hosted targets.
|
|
69
|
+
Do not pass \`[]\` as a string-list CLI flag: that is a string item, not an empty list.
|
|
70
|
+
The convention leaves views optional because generic Kind-required arrays must be nonempty;
|
|
71
|
+
the trusted Site validator still requires an explicit list, including \`views: []\` for no Views.
|
|
72
|
+
|
|
73
|
+
\`superbee/publication/site-manifest\` exposes the shared declaration validator and the frozen
|
|
74
|
+
publication reference validator. A declaration requires one Site at \`sites/<site>\`, an exact
|
|
75
|
+
package version or repository presentation reference, and the restricted audience. Views, the
|
|
76
|
+
optional landing document and optional brand blobs must resolve in that publication. The selected
|
|
77
|
+
presentation validates its own options; declaring a package does not install or execute it.
|
|
78
|
+
|
|
79
|
+
Do not put credentials, reader lists, origins or builder settings in the declaration. Hosted
|
|
80
|
+
model-write permissions, trusted builder admission, grants, entitlements and release checks remain
|
|
81
|
+
authoritative. Local creation never registers an app or grants publication or recipient access.
|
|
82
|
+
`;
|
|
83
|
+
//# sourceMappingURL=site.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"site.js","sourceRoot":"","sources":["../../src/builtin-recipes/site.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAE9D,MAAM,CAAC,MAAM,SAAS,GAAmB;IACvC,EAAE,EAAE,kBAAkB;IACtB,KAAK,EAAE,SAAS;IAChB,OAAO,EAAE,SAAS;IAClB,WAAW,EAAE,2GAA2G;IACxH,IAAI,EAAE,YAAY;IAClB,MAAM,EAAE;QACN,QAAQ,EAAE,CAAC,OAAO,EAAE,cAAc,EAAE,UAAU,CAAC;QAC/C,yFAAyF;QACzF,QAAQ,EAAE,CAAC,aAAa,EAAE,SAAS,EAAE,OAAO,EAAE,cAAc,EAAE,SAAS,EAAE,OAAO,CAAC;QACjF,MAAM,EAAE,EAAE,QAAQ,EAAE,CAAC,YAAY,CAAC,EAAE;QACpC,QAAQ,EAAE,EAAE;QACZ,KAAK,EAAE,EAAE,KAAK,EAAE,aAAa,EAAE,YAAY,EAAE,aAAa,EAAE;QAC5D,YAAY,EAAE;YACZ,KAAK,EAAE,2BAA2B;YAClC,WAAW,EAAE,2CAA2C;YACxD,YAAY,EAAE,wGAAwG;YACtH,QAAQ,EAAE,yFAAyF;YACnG,OAAO,EAAE,iEAAiE;YAC1E,KAAK,EAAE,oGAAoG;YAC3G,YAAY,EAAE,kGAAkG;YAChH,OAAO,EAAE,kGAAkG;YAC3G,KAAK,EAAE,uGAAuG;SAC/G;KACF;CACF,CAAC;AAEF,MAAM,CAAC,MAAM,oBAAoB,GAAG;;;;;;;;CAQnC,CAAC;AAEF,MAAM,CAAC,MAAM,mBAAmB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA6ClC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"builtin-recipes.d.ts","sourceRoot":"","sources":["../src/builtin-recipes.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,gBAAgB,EAAE,KAAK,YAAY,EAAE,KAAK,UAAU,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"builtin-recipes.d.ts","sourceRoot":"","sources":["../src/builtin-recipes.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,gBAAgB,EAAE,KAAK,YAAY,EAAE,KAAK,UAAU,EAAE,MAAM,cAAc,CAAC;AA4HpF,wBAAgB,YAAY,IAAI,MAAM,EAAE,CAEvC;AAED,6FAA6F;AAC7F,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,UAAU,CAAC,OAAO,gBAAgB,CAAC,GAAG,IAAI,CAK1F;AAED,mGAAmG;AACnG,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,UAAU,EAAE,GAAG,SAAS,CAEzE;AAED,6FAA6F;AAC7F,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,YAAY,CAM7D;AAED,OAAO,EACL,iBAAiB,EACjB,8BAA8B,EAC9B,sBAAsB,EACtB,qBAAqB,EACrB,gBAAgB,EAChB,SAAS,EACT,cAAc,EACd,qBAAqB,EACrB,uBAAuB,EACvB,YAAY,EACZ,iBAAiB,EACjB,iBAAiB,EACjB,sBAAsB,EACtB,eAAe,EACf,iBAAiB,EAClB,MAAM,8BAA8B,CAAC"}
|
package/dist/builtin-recipes.js
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
import { kindConventionDoc } from "./kinds.js";
|
|
4
4
|
import { stringifyDoc } from "./frontmatter.js";
|
|
5
5
|
import { parseRecipeFiles } from "./recipes.js";
|
|
6
|
+
import { SITE_KIND, SITE_CONVENTION_BODY, SITE_AUTHORING_BODY } from "./builtin-recipes/site.js";
|
|
6
7
|
import { CONTEXT_NOTE_KIND, CONTEXT_NOTE_SEED_BODY_LOGICAL, CONTEXT_NOTES_SUMMARY, RECIPE_DESC_BODY, TASK_KIND, TASK_SEED_BODY, WORK_TRACKING_SUMMARY, WORK_TRACKING_DESC_BODY, ROADMAP_KIND, ROADMAP_SEED_BODY, ROADMAP_ITEM_KIND, ROADMAP_ITEM_SEED_BODY, ROADMAP_SUMMARY, ROADMAP_DESC_BODY, } from "./builtin-recipes/content.js";
|
|
7
8
|
/** Used only to call the shared serializer; built-in source bytes discard it before parsing. */
|
|
8
9
|
const PLACEHOLDER_TIMESTAMP = "1970-01-01T00:00:00.000Z";
|
|
@@ -64,10 +65,31 @@ function buildRoadmapFiles() {
|
|
|
64
65
|
{ path: "conventions/roadmap-item.md", bytes: stringifyDoc(item.frontmatter, item.body) },
|
|
65
66
|
];
|
|
66
67
|
}
|
|
68
|
+
function buildSiteFiles() {
|
|
69
|
+
const convention = unstampedConvention(SITE_KIND, SITE_CONVENTION_BODY);
|
|
70
|
+
return [
|
|
71
|
+
{
|
|
72
|
+
path: "recipe.md",
|
|
73
|
+
bytes: stringifyDoc({
|
|
74
|
+
type: "Recipe",
|
|
75
|
+
id: "site",
|
|
76
|
+
title: "Site",
|
|
77
|
+
version: "1",
|
|
78
|
+
summary: "Declares a private content site's presentation and publication inputs",
|
|
79
|
+
offer: "describe a private content site using a shared presentation",
|
|
80
|
+
content_policy: "definitions-only",
|
|
81
|
+
references: ["references/site-authoring.md"],
|
|
82
|
+
}, "# Site\n\nInstalls Site authoring scaffolding; publication and access remain separately authorized.\n"),
|
|
83
|
+
},
|
|
84
|
+
{ path: "conventions/site.md", bytes: stringifyDoc(convention.frontmatter, convention.body) },
|
|
85
|
+
{ path: "references/site-authoring.md", bytes: stringifyDoc({ type: "Reference", title: "Site authoring" }, SITE_AUTHORING_BODY) },
|
|
86
|
+
];
|
|
87
|
+
}
|
|
67
88
|
const BUILTIN_FILES = {
|
|
68
89
|
"context-notes": buildContextNotesFiles(),
|
|
69
90
|
"work-tracking": buildWorkTrackingFiles(),
|
|
70
91
|
roadmap: buildRoadmapFiles(),
|
|
92
|
+
site: buildSiteFiles(),
|
|
71
93
|
};
|
|
72
94
|
export function builtinNames() {
|
|
73
95
|
return Object.keys(BUILTIN_FILES);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"builtin-recipes.js","sourceRoot":"","sources":["../src/builtin-recipes.ts"],"names":[],"mappings":"AAAA,+FAA+F;AAC/F,kFAAkF;AAClF,OAAO,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAC/C,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAAE,gBAAgB,EAAsC,MAAM,cAAc,CAAC;AACpF,OAAO,EACL,iBAAiB,EACjB,8BAA8B,EAC9B,qBAAqB,EACrB,gBAAgB,EAChB,SAAS,EACT,cAAc,EACd,qBAAqB,EACrB,uBAAuB,EACvB,YAAY,EACZ,iBAAiB,EACjB,iBAAiB,EACjB,sBAAsB,EACtB,eAAe,EACf,iBAAiB,GAClB,MAAM,8BAA8B,CAAC;AAEtC,gGAAgG;AAChG,MAAM,qBAAqB,GAAG,0BAA0B,CAAC;AAEzD,SAAS,mBAAmB,CAAC,IAA6C,EAAE,IAAY;IACtF,MAAM,GAAG,GAAG,iBAAiB,CAAC,IAAI,EAAE,IAAI,EAAE,qBAAqB,CAAC,CAAC;IACjE,MAAM,EAAE,SAAS,EAAE,UAAU,EAAE,GAAG,WAAW,EAAE,GAAG,GAAG,CAAC,WAAW,CAAC;IAClE,OAAO,EAAE,GAAG,GAAG,EAAE,WAAW,EAAE,CAAC;AACjC,CAAC;AAED,SAAS,sBAAsB;IAC7B,MAAM,IAAI,GAAG,mBAAmB,CAAC,iBAAiB,EAAE,8BAA8B,CAAC,CAAC;IACpF,OAAO;QACL;YACE,IAAI,EAAE,WAAW;YACjB,KAAK,EAAE,YAAY,CACjB;gBACE,IAAI,EAAE,QAAQ;gBACd,EAAE,EAAE,eAA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