@pipelex/mthds-form 0.25.0 → 0.27.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-QWHUUMSB.js → chunk-4VAO6BDE.js} +4 -4
- package/dist/{chunk-QWHUUMSB.js.map → chunk-4VAO6BDE.js.map} +1 -1
- package/dist/{chunk-QINLJ5RM.js → chunk-56WECFBD.js} +6 -3
- package/dist/chunk-56WECFBD.js.map +1 -0
- package/dist/{chunk-NA7SIQOH.js → chunk-AZIUFSIQ.js} +692 -100
- package/dist/chunk-AZIUFSIQ.js.map +1 -0
- package/dist/{chunk-JSPF4BQP.js → chunk-QQK6Y55E.js} +96 -3
- package/dist/chunk-QQK6Y55E.js.map +1 -0
- package/dist/core/index.d.ts +1 -1
- package/dist/core/index.js +3 -3
- package/dist/core/native-content.d.ts +103 -1
- package/dist/core/native-content.js +1 -1
- package/dist/core/save-plan.js +3 -3
- package/dist/core/stuff-files.js +2 -2
- package/dist/generative/index.js +4 -4
- package/dist/react/index.d.ts +118 -3
- package/dist/react/index.js +4 -4
- package/dist/styles.css +1 -1
- package/package.json +1 -1
- package/dist/chunk-JSPF4BQP.js.map +0 -1
- package/dist/chunk-NA7SIQOH.js.map +0 -1
- package/dist/chunk-QINLJ5RM.js.map +0 -1
|
@@ -53,6 +53,7 @@ var NATIVE_PAGE_CONCEPT_REF = "native.Page";
|
|
|
53
53
|
var NATIVE_YES_NO_CONCEPT_REF = "native.YesNo";
|
|
54
54
|
var NATIVE_RATING_CONCEPT_REF = "native.Rating";
|
|
55
55
|
var NATIVE_CHOICE_CONCEPT_REF = "native.Choice";
|
|
56
|
+
var NATIVE_SEARCH_RESULT_CONCEPT_REF = "native.SearchResult";
|
|
56
57
|
function readPageContent(value) {
|
|
57
58
|
if (!isRecord(value)) return void 0;
|
|
58
59
|
const textAndImages = ownProp(value, "text_and_images");
|
|
@@ -100,6 +101,95 @@ function readChoiceContent(value) {
|
|
|
100
101
|
const confidence = readUnitInterval(value, "confidence");
|
|
101
102
|
return { choice, ...confidence !== void 0 ? { confidence } : {} };
|
|
102
103
|
}
|
|
104
|
+
function readWebUrl(candidate) {
|
|
105
|
+
const judged = viewableUrl(candidate);
|
|
106
|
+
if (judged === void 0) return void 0;
|
|
107
|
+
let parsed;
|
|
108
|
+
try {
|
|
109
|
+
parsed = new URL(judged);
|
|
110
|
+
} catch {
|
|
111
|
+
return void 0;
|
|
112
|
+
}
|
|
113
|
+
return parsed.protocol === "http:" || parsed.protocol === "https:" ? { parsed, written: stripUrlWhitespace(candidate ?? "") } : void 0;
|
|
114
|
+
}
|
|
115
|
+
function webHref(candidate) {
|
|
116
|
+
return readWebUrl(candidate)?.parsed.href;
|
|
117
|
+
}
|
|
118
|
+
function readSearchResultContent(value) {
|
|
119
|
+
if (!isRecord(value)) return void 0;
|
|
120
|
+
const answer = ownProp(value, "answer");
|
|
121
|
+
if (typeof answer !== "string") return void 0;
|
|
122
|
+
const given = ownProp(value, "sources");
|
|
123
|
+
if (given !== void 0 && !Array.isArray(given)) return void 0;
|
|
124
|
+
const sources = [];
|
|
125
|
+
const kept = /* @__PURE__ */ new Map();
|
|
126
|
+
for (const [index, entry] of (given ?? []).entries()) {
|
|
127
|
+
const document = readDocumentContent(entry);
|
|
128
|
+
if (!document) return void 0;
|
|
129
|
+
const web = readWebUrl(document.url) ?? readWebUrl(document.publicUrl);
|
|
130
|
+
const key = web ? `web ${samePageKey(web.written)}` : `as written ${document.url}`;
|
|
131
|
+
const citation = index + 1;
|
|
132
|
+
const existing = kept.get(key);
|
|
133
|
+
if (existing !== void 0) {
|
|
134
|
+
sources[existing]?.citations.push(citation);
|
|
135
|
+
continue;
|
|
136
|
+
}
|
|
137
|
+
kept.set(key, sources.length);
|
|
138
|
+
const host = web?.parsed.hostname.replace(/^www\./, "");
|
|
139
|
+
const title = document.title === void 0 ? void 0 : decodeTitle(document.title).trim();
|
|
140
|
+
sources.push({
|
|
141
|
+
address: web?.parsed.href ?? document.url,
|
|
142
|
+
...web ? { href: web.parsed.href } : {},
|
|
143
|
+
...host ? { host } : {},
|
|
144
|
+
...title ? { title } : {},
|
|
145
|
+
...document.snippet !== void 0 ? { snippet: document.snippet } : {},
|
|
146
|
+
citations: [citation]
|
|
147
|
+
});
|
|
148
|
+
}
|
|
149
|
+
return { answer, sources };
|
|
150
|
+
}
|
|
151
|
+
var TITLE_NAMED_REFERENCES = /* @__PURE__ */ new Map([
|
|
152
|
+
["amp", "&"],
|
|
153
|
+
["lt", "<"],
|
|
154
|
+
["gt", ">"],
|
|
155
|
+
["quot", '"'],
|
|
156
|
+
["apos", "'"],
|
|
157
|
+
["nbsp", "\xA0"]
|
|
158
|
+
]);
|
|
159
|
+
var TITLE_REFERENCE = /&(?:#([0-9]+)|#[xX]([0-9a-fA-F]+)|([a-z]+));/g;
|
|
160
|
+
function decodeTitle(title) {
|
|
161
|
+
return title.replace(TITLE_REFERENCE, (reference, decimal, hex, name) => {
|
|
162
|
+
if (name !== void 0) return TITLE_NAMED_REFERENCES.get(name) ?? reference;
|
|
163
|
+
const codePoint = decimal !== void 0 ? Number(decimal) : parseInt(hex ?? "", 16);
|
|
164
|
+
const isCharacter = codePoint > 0 && codePoint <= 1114111 && !(codePoint >= 55296 && codePoint <= 57343);
|
|
165
|
+
return isCharacter ? String.fromCodePoint(codePoint) : reference;
|
|
166
|
+
}).replace(/\u00a0/g, " ");
|
|
167
|
+
}
|
|
168
|
+
var URI_PARTS = /^(?:([^:/?#]+):)?(?:\/\/([^/?#]*))?([^?#]*)(?:\?([^#]*))?(?:#([\s\S]*))?$/;
|
|
169
|
+
function samePageKey(written) {
|
|
170
|
+
const parts = URI_PARTS.exec(written);
|
|
171
|
+
if (!parts) return written;
|
|
172
|
+
const [, , authority = "", path = "", query = ""] = parts;
|
|
173
|
+
const at = authority.lastIndexOf("@");
|
|
174
|
+
const host = authority.slice(at + 1).toLowerCase().replace(/^www\./, "");
|
|
175
|
+
const page = path === "" ? "/" : path.length > 1 && path.endsWith("/") ? path.slice(0, -1) : path;
|
|
176
|
+
return `${authority.slice(0, at + 1)}${host}${page}${query === "" ? "" : `?${query}`}`;
|
|
177
|
+
}
|
|
178
|
+
function citedSource(content, citation) {
|
|
179
|
+
return content.sources.find((source) => source.citations.includes(citation));
|
|
180
|
+
}
|
|
181
|
+
function splitCitations(text) {
|
|
182
|
+
const segments = [];
|
|
183
|
+
let last = 0;
|
|
184
|
+
for (const match of text.matchAll(/\[([1-9][0-9]*)\]/g)) {
|
|
185
|
+
const at = match.index;
|
|
186
|
+
if (at > last) segments.push({ text: text.slice(last, at) });
|
|
187
|
+
segments.push({ citation: Number(match[1]), text: match[0] });
|
|
188
|
+
last = at + match[0].length;
|
|
189
|
+
}
|
|
190
|
+
if (last < text.length) segments.push({ text: text.slice(last) });
|
|
191
|
+
return segments;
|
|
192
|
+
}
|
|
103
193
|
function readCompositeContent(value) {
|
|
104
194
|
if (!isRecord(value)) return void 0;
|
|
105
195
|
return Object.entries(value).map(([name, member]) => ({ name, value: member }));
|
|
@@ -122,6 +212,9 @@ function nativeVerdictOf(node) {
|
|
|
122
212
|
if (refinesNative(node, NATIVE_CHOICE_CONCEPT_REF)) return "choice";
|
|
123
213
|
return void 0;
|
|
124
214
|
}
|
|
215
|
+
function isNativeSearchResultNode(node) {
|
|
216
|
+
return refinesNative(node, NATIVE_SEARCH_RESULT_CONCEPT_REF);
|
|
217
|
+
}
|
|
125
218
|
function isNativeValueNode(node) {
|
|
126
219
|
return isNativeDateNode(node) || isNativeHtmlNode(node) || isNativeCompositeNode(node);
|
|
127
220
|
}
|
|
@@ -256,6 +349,6 @@ function hasTypedScalarMarkers(value) {
|
|
|
256
349
|
return isRecord(value) && TYPED_SCALAR_MARKERS.every((marker) => hasOwnProp(value, marker));
|
|
257
350
|
}
|
|
258
351
|
|
|
259
|
-
export { NATIVE_CHOICE_CONCEPT_REF, NATIVE_COMPOSITE_CONCEPT_REF, NATIVE_DATE_CONCEPT_REF, NATIVE_HTML_CONCEPT_REF, NATIVE_PAGE_CONCEPT_REF, NATIVE_RATING_CONCEPT_REF, NATIVE_YES_NO_CONCEPT_REF, TYPED_SCALAR_MARKERS, dataUrlExtensions, formatDateContent, hasTypedScalarMarkers, isNativeCompositeNode, isNativeDateNode, isNativeHtmlNode, isNativePageNode, isNativeValueNode, isViewableUrl, nativeVerdictOf, readChoiceContent, readCompositeContent, readDataUrl, readDateContent, readDocumentContent, readHtmlContent, readImageContent, readPageContent, readRatingContent, readYesNoContent, viewableUrl };
|
|
260
|
-
//# sourceMappingURL=chunk-
|
|
261
|
-
//# sourceMappingURL=chunk-
|
|
352
|
+
export { NATIVE_CHOICE_CONCEPT_REF, NATIVE_COMPOSITE_CONCEPT_REF, NATIVE_DATE_CONCEPT_REF, NATIVE_HTML_CONCEPT_REF, NATIVE_PAGE_CONCEPT_REF, NATIVE_RATING_CONCEPT_REF, NATIVE_SEARCH_RESULT_CONCEPT_REF, NATIVE_YES_NO_CONCEPT_REF, TYPED_SCALAR_MARKERS, citedSource, dataUrlExtensions, formatDateContent, hasTypedScalarMarkers, isNativeCompositeNode, isNativeDateNode, isNativeHtmlNode, isNativePageNode, isNativeSearchResultNode, isNativeValueNode, isViewableUrl, nativeVerdictOf, readChoiceContent, readCompositeContent, readDataUrl, readDateContent, readDocumentContent, readHtmlContent, readImageContent, readPageContent, readRatingContent, readSearchResultContent, readYesNoContent, splitCitations, viewableUrl, webHref };
|
|
353
|
+
//# sourceMappingURL=chunk-QQK6Y55E.js.map
|
|
354
|
+
//# sourceMappingURL=chunk-QQK6Y55E.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/core/native-content.ts"],"names":["parsed"],"mappings":";;;AA4CA,SAAS,SAAS,KAAA,EAAkD;AAClE,EAAA,OAAO,OAAO,UAAU,QAAA,IAAY,KAAA,KAAU,QAAQ,CAAC,KAAA,CAAM,QAAQ,KAAK,CAAA;AAC5E;AAGA,SAAS,QAAA,CAAS,QAA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;AAAA,MAChB,KAAK,OAAA;AACH,QAAA,OAAO,0BAA0B,GAAA,CAAI,gBAAA,CAAiBA,OAAM,CAAC,CAAA,GAAIA,QAAO,IAAA,GAAO,MAAA;AAAA,MACjF;AACE,QAAA,OAAO,MAAA;AAAA;AACX,EACF;AAIA,EAAA,IAAI,CAAC,QAAA,CAAS,UAAA,CAAW,GAAG,GAAG,OAAO,MAAA;AAItC,EAAA,MAAM,UAAA,GAAa,QAAA,CAAS,UAAA,CAAW,CAAC,CAAA;AACxC,EAAA,IAAI,UAAA,KAAe,EAAA,IAAQ,UAAA,KAAe,EAAA,EAAM,OAAO,MAAA;AACvD,EAAA,IAAI,MAAA;AACJ,EAAA,IAAI;AACF,IAAA,MAAA,GAAS,IAAI,GAAA,CAAI,QAAA,EAAU,wBAAwB,CAAA;AAAA,EACrD,CAAA,CAAA,MAAQ;AACN,IAAA,OAAO,MAAA;AAAA,EACT;AACA,EAAA,OAAO,MAAA,CAAO,MAAA,KAAW,wBAAA,GAA2B,QAAA,GAAW,MAAA;AACjE;AASO,SAAS,cAAc,GAAA,EAAwC;AACpE,EAAA,OAAO,WAAA,CAAY,GAAG,CAAA,KAAM,MAAA;AAC9B;AASO,IAAM,oBAAA,GAAuB,CAAC,WAAA,EAAa,YAAY;AAGvD,SAAS,sBAAsB,KAAA,EAAyB;AAC7D,EAAA,OAAO,QAAA,CAAS,KAAK,CAAA,IAAK,oBAAA,CAAqB,KAAA,CAAM,CAAC,MAAA,KAAW,UAAA,CAAW,KAAA,EAAO,MAAM,CAAC,CAAA;AAC5F","file":"chunk-QQK6Y55E.js","sourcesContent":["/**\n * How to READ the native content models — the result side's twin of\n * `./file-formats`.\n *\n * A renderer handed a result knows the field's `kind` from the descriptor, and\n * for the kinds whose value is a structured content model rather than a bare\n * scalar (`document`, `image`, `date`) it must then read that model's members.\n * **That is reading the standard, not sniffing at it.** The distinction is the\n * whole reason this module exists as data rather than as heuristics inside a\n * control: a reader keyed by a STATED kind consults a pinned definition, where\n * a reader that works out *which* kind it is holding by counting properties is\n * guessing — and guessing is exactly what [../../docs/derivation-swap.md]\n * records removing from the input side.\n *\n * ## Where each shape comes from\n *\n * `native.Image` and `native.Document` are pinned by the standard, in\n * `docs/spec/native-concepts.md` § \"The Pinned Set (MTHDS 1.0.0)\". Both carry a\n * required `url` — a storage URI, an HTTP(S) URL, or a base64 data URL — and\n * optional presentation members beside it. Nothing here adds a member the spec\n * does not state.\n *\n * `native.Date` is pinned the same way (`{date, time}`), but a `date` FIELD\n * inside a structured concept is not a `native.Date` value: it is a python\n * `datetime.date`, and the serialization layer stamps it with its class. So a\n * date arrives in one of three legal shapes, all three of which a run really\n * produces:\n *\n * \"2026-03-14\" a plain ISO string\n * { date: \"2026-03-14\", __class__: \"date\", … } a typed scalar\n * { date: \"2026-03-14\", time: \"15:40:00\" } native.Date\n *\n * The typed-scalar envelope is the one shape the standard does NOT pin — it is\n * a serialization fact, measured off a real run rather than read off a spec —\n * and it is called out as such here so nobody mistakes it for normative.\n *\n * This module lives in core, not beside the control that renders it, for the\n * reason `file-formats.ts` established: a host that shows a result its own way\n * needs the same answer the control uses, and two copies of an answer is two\n * places for it to drift. Pure data and pure functions — no React.\n */\n\nimport { hasOwnProp, ownProp } from './own-property';\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return typeof value === 'object' && value !== null && !Array.isArray(value);\n}\n\n/** A member the content models declare as `type = \"text\"`, when it is one. */\nfunction readText(record: Record<string, unknown>, key: string): string | undefined {\n const value = ownProp(record, key);\n return typeof value === 'string' && value.length > 0 ? value : undefined;\n}\n\nfunction readNumber(record: Record<string, unknown>, key: string): number | undefined {\n const value = ownProp(record, key);\n return typeof value === 'number' && Number.isFinite(value) ? value : undefined;\n}\n\n/**\n * `native.Document`, read.\n *\n * `url` is the only required member; everything else is a producer's courtesy,\n * so a reader that demands any of them describes a value the standard permits\n * as malformed.\n */\nexport interface DocumentContentView {\n url: string;\n publicUrl?: string;\n mimeType?: string;\n filename?: string;\n title?: string;\n snippet?: string;\n}\n\n/** `native.Image`, read. `width`/`height` are optional but PAIRED by the spec. */\nexport interface ImageContentView {\n url: string;\n publicUrl?: string;\n caption?: string;\n mimeType?: string;\n filename?: string;\n width?: number;\n height?: number;\n sourcePrompt?: string;\n}\n\n/** `native.Date` (and the typed-scalar envelope a nested `date` field arrives in). */\nexport interface DateContentView {\n /** ISO 8601 calendar date, `YYYY-MM-DD`. */\n date: string;\n /** ISO 8601 time of day, present only when the source stated one. */\n time?: string;\n}\n\n/**\n * Read a `document`-kind value. `undefined` when the value carries no `url`,\n * which is the one member the standard requires — a caller renders its own\n * absence rather than being handed a half-value to test.\n */\nexport function readDocumentContent(value: unknown): DocumentContentView | undefined {\n if (!isRecord(value)) return undefined;\n const url = readText(value, 'url');\n if (url === undefined) return undefined;\n return {\n url,\n publicUrl: readText(value, 'public_url'),\n mimeType: readText(value, 'mime_type'),\n filename: readText(value, 'filename'),\n title: readText(value, 'title'),\n snippet: readText(value, 'snippet'),\n };\n}\n\n/** Read an `image`-kind value. Same contract as `readDocumentContent`. */\nexport function readImageContent(value: unknown): ImageContentView | undefined {\n if (!isRecord(value)) return undefined;\n const url = readText(value, 'url');\n if (url === undefined) return undefined;\n return {\n url,\n publicUrl: readText(value, 'public_url'),\n caption: readText(value, 'caption'),\n mimeType: readText(value, 'mime_type'),\n filename: readText(value, 'filename'),\n width: readNumber(value, 'width'),\n height: readNumber(value, 'height'),\n sourcePrompt: readText(value, 'source_prompt'),\n };\n}\n\n/**\n * `native.Html`, read.\n *\n * The only content model here that is NOT reached by a field kind, and the\n * reason is a deliberate decision of the standard: the kind vocabulary has no\n * `html` member, so a `native.Html` value is an `object` node over its two\n * declared fields. That is right for the descriptor — the kinds name how a value\n * is ENTERED, and markup is entered as text — and wrong for a result view, which\n * would otherwise print a page's source at a reader.\n *\n * So this one is keyed by CONCEPT rather than by kind, through\n * `isNativeHtmlNode` below. That is a membership test on facts the descriptor\n * states (`concept_ref`, `refines`), which the standard's own page calls out as\n * the supported way to ask \"does this refine `native.X`?\" — the opposite of\n * inspecting a value to guess what it is.\n */\nexport interface HtmlContentView {\n /** The markup itself. The one required member. */\n innerHtml: string;\n /** A class name for a wrapper a consumer may put around it, when stated. */\n cssClass?: string;\n}\n\n/** Read an `native.Html` value. `undefined` when it carries no markup. */\nexport function readHtmlContent(value: unknown): HtmlContentView | undefined {\n if (!isRecord(value)) return undefined;\n const innerHtml = readText(value, 'inner_html');\n if (innerHtml === undefined) return undefined;\n return { innerHtml, cssClass: readText(value, 'css_class') };\n}\n\n/** The concept refs whose content model is multi-property, spelled once each. */\nexport const NATIVE_HTML_CONCEPT_REF = 'native.Html';\nexport const NATIVE_DATE_CONCEPT_REF = 'native.Date';\nexport const NATIVE_COMPOSITE_CONCEPT_REF = 'native.Composite';\nexport const NATIVE_PAGE_CONCEPT_REF = 'native.Page';\nexport const NATIVE_YES_NO_CONCEPT_REF = 'native.YesNo';\nexport const NATIVE_RATING_CONCEPT_REF = 'native.Rating';\nexport const NATIVE_CHOICE_CONCEPT_REF = 'native.Choice';\nexport const NATIVE_SEARCH_RESULT_CONCEPT_REF = 'native.SearchResult';\n\n/**\n * `native.Page`, read: what one page of an extracted document holds.\n *\n * The model is `{text_and_images: {text, images, raw_html}, page_view}`, where\n * `text` is a `TextContent` (`{text}`) and the images and the page view are\n * `ImageContent`s. A reader of a page wants its TEXT first, and the structural\n * renderer never reached it: the descriptor states the page as an `object`\n * over two members, and the text sits two levels down, under a member named\n * `text` inside a member named `text_and_images`. Keyed by the concept, this\n * reads the documented model and nothing else.\n */\nexport interface PageContentView {\n /** The page's extracted text, as the extractor wrote it, when it wrote any. */\n text?: string;\n /** The images extracted from the page, each an `ImageContent`, unread. */\n images: readonly unknown[];\n /**\n * The page's markup as the extractor fetched it, when it kept any. It is the\n * page's content a second time when the page has text, and its only content\n * when it has none, which is when a renderer shows it, framed, never injected.\n */\n rawHtml?: string;\n /** The rendering of the whole page, an `ImageContent`, when one was made. */\n pageView?: unknown;\n}\n\n/**\n * Read a `native.Page` value. `undefined` for anything that is not a record,\n * so the caller renders its own absence.\n */\nexport function readPageContent(value: unknown): PageContentView | undefined {\n if (!isRecord(value)) return undefined;\n const textAndImages = ownProp(value, 'text_and_images');\n const holder = isRecord(textAndImages) ? textAndImages : undefined;\n const textContent = holder ? ownProp(holder, 'text') : undefined;\n // `text` is a `TextContent`. A plain string is read too, since a page whose\n // runner rendered it raw would carry one, and both name the same text.\n const text =\n typeof textContent === 'string'\n ? textContent\n : isRecord(textContent)\n ? readText(textContent, 'text')\n : undefined;\n const images = holder ? ownProp(holder, 'images') : undefined;\n const rawHtml = holder ? readText(holder, 'raw_html') : undefined;\n const pageView = ownProp(value, 'page_view');\n return {\n ...(text !== undefined && text.trim() !== '' ? { text } : {}),\n images: Array.isArray(images) ? images : [],\n ...(rawHtml !== undefined && rawHtml.trim() !== '' ? { rawHtml } : {}),\n ...(isRecord(pageView) ? { pageView } : {}),\n };\n}\n\n/**\n * A verdict's measures, as the judging runtime states them: each is a number\n * from 0 to 1, present only when the producer reported one. A measure outside\n * that range is the payload disagreeing with its own model, and is read as\n * absent rather than shown as a percentage above a hundred.\n */\nfunction readUnitInterval(record: Record<string, unknown>, key: string): number | undefined {\n const value = readNumber(record, key);\n return value !== undefined && value >= 0 && value <= 1 ? value : undefined;\n}\n\n/** `native.YesNo`, read. */\nexport interface YesNoContentView {\n /** The answer: yes is `true`. */\n yesNo: boolean;\n /** The probability that the answer is yes, from 0 to 1, when the producer reported one. */\n probability?: number;\n}\n\n/**\n * Read a `native.YesNo` value: `{yes_no, probability}`, or the bare boolean a\n * single-member YesNo is unwrapped to by its content key. Both are the model\n * the concept states, so reading either is reading the standard.\n */\nexport function readYesNoContent(value: unknown): YesNoContentView | undefined {\n if (typeof value === 'boolean') return { yesNo: value };\n if (!isRecord(value)) return undefined;\n const yesNo = ownProp(value, 'yes_no');\n if (typeof yesNo !== 'boolean') return undefined;\n const probability = readUnitInterval(value, 'probability');\n return { yesNo, ...(probability !== undefined ? { probability } : {}) };\n}\n\n/** `native.Rating`, read. */\nexport interface RatingContentView {\n /** The index of the selected level, 0 being the first level declared. */\n level: number;\n /** The name the scale gives the selected level, when it names its levels. */\n label?: string;\n /** The producer's confidence in the level, from 0 to 1, when it reported one. */\n confidence?: number;\n}\n\n/** Read a `native.Rating` value. `undefined` when it carries no whole `level`. */\nexport function readRatingContent(value: unknown): RatingContentView | undefined {\n if (!isRecord(value)) return undefined;\n const level = readNumber(value, 'level');\n if (level === undefined || !Number.isInteger(level) || level < 0) return undefined;\n const label = readText(value, 'label');\n const confidence = readUnitInterval(value, 'confidence');\n return {\n level,\n ...(label !== undefined ? { label } : {}),\n ...(confidence !== undefined ? { confidence } : {}),\n };\n}\n\n/** `native.Choice`, read. */\nexport interface ChoiceContentView {\n /** The key of the selected option, as the method declared it. */\n choice: string;\n /** The producer's confidence in the choice, from 0 to 1, when it reported one. */\n confidence?: number;\n}\n\n/**\n * Read a `native.Choice` value. `undefined` when it carries no `choice`, or an\n * empty one: the content model types `choice` as any text, but a choice\n * question's options are keyed by non-empty strings and its `Choice` names one\n * of them, so an empty key names no option and leaves no answer to draw.\n */\nexport function readChoiceContent(value: unknown): ChoiceContentView | undefined {\n if (!isRecord(value)) return undefined;\n const choice = readText(value, 'choice');\n if (choice === undefined) return undefined;\n const confidence = readUnitInterval(value, 'confidence');\n return { choice, ...(confidence !== undefined ? { confidence } : {}) };\n}\n\n/**\n * One source of a search result, read: a document the answer was written from,\n * which a search returns as a web page rather than as a file.\n */\nexport interface SearchSourceView {\n /**\n * The source's address as a reader is shown it: the web address when it has\n * one (normalised, as `href`), else its `url` as the payload states it.\n */\n address: string;\n /**\n * The web address, normalised, when the source has one: an `http:` or\n * `https:` URL, read from `url`, else from `public_url`. It is the only kind\n * of address a renderer links; any other is shown as text.\n */\n href?: string;\n /** The web address's host name, a leading `www.` dropped: the site a reader recognises. */\n host?: string;\n title?: string;\n snippet?: string;\n /**\n * The citations that name this source, each counted from one over the\n * sources as the payload lists them. More than one when the payload listed\n * the same address more than once: a later copy is not kept, and its number\n * names the copy that is.\n */\n citations: readonly number[];\n}\n\n/** `native.SearchResult`, read: the answer, and each of its sources once. */\nexport interface SearchResultContentView {\n /** The answer, as written: Markdown with inline citations (`[2]`, `[2][3]`). */\n answer: string;\n /** Each source once, in the order the payload first lists it. */\n sources: readonly SearchSourceView[];\n}\n\n/**\n * An address a renderer may link: a URL the gate admits whose protocol, as\n * the parser reports it, is `http:` or `https:`. Parsed rather than matched,\n * as the gate itself is: the gate strips what the parser strips and returns\n * the string it judged, and a root-relative path, which it admits, has no\n * origin of its own and does not parse alone.\n */\nfunction readWebUrl(candidate: string | undefined): WebAddress | undefined {\n const judged = viewableUrl(candidate);\n if (judged === undefined) return undefined;\n let parsed: URL;\n try {\n parsed = new URL(judged);\n } catch {\n return undefined;\n }\n return parsed.protocol === 'http:' || parsed.protocol === 'https:'\n ? { parsed, written: stripUrlWhitespace(candidate ?? '') }\n : undefined;\n}\n\n/**\n * A web address, both ways: as the parser reads it, which is what a renderer\n * links and names the site by, and as the payload wrote it, less only the\n * whitespace and controls the parser strips before it reads, which is what two\n * sources are compared by. The gate returns the parser's normalised string, so\n * the address as written is taken from the payload, not from the gate.\n */\ninterface WebAddress {\n parsed: URL;\n written: string;\n}\n\n/**\n * A web address a renderer may link, normalised: `http:` or `https:`, read by\n * parsing, and `undefined` for any other address. Not re-exported: the\n * Markdown walker reads it to check an address a host hands it for a\n * citation, as the search reader checks a source's.\n */\nexport function webHref(candidate: string | undefined): string | undefined {\n return readWebUrl(candidate)?.parsed.href;\n}\n\n/**\n * Read a `native.SearchResult` value: `{answer, sources}`, each source a\n * `native.Document`. `undefined` when the value is not that model (no string\n * `answer`, a `sources` that is not a list, or a source that is not a document\n * with a `url`), which leaves the node to the structural arms. A missing\n * `sources` reads as none, since the runtime's model defaults it to an empty\n * list.\n *\n * **A source listed twice is kept once.** Two sources with web addresses are\n * the same page when `samePageKey` reads the two alike: it sets aside what does\n * not change the page (`http` or `https`, the host's case and a leading\n * `www.`, the fragment, a trailing `/`) and keeps the query as written. Two\n * sources whose addresses are not web ones, or that the parser refuses, are\n * the same when the two strings are. The first is kept, where the payload\n * first lists it, under its own title and at its own address, and the\n * citations of every copy name it.\n *\n * **A source's title is decoded, once** (`decodeTitle`): a run made before the\n * runtime decoded the page's title kept it escaped (`Requirements & SAP\n * Integration`), and it keeps it so for good. The snippet is left as written,\n * and so is the answer, which is Markdown and decoded as Markdown.\n */\nexport function readSearchResultContent(value: unknown): SearchResultContentView | undefined {\n if (!isRecord(value)) return undefined;\n const answer = ownProp(value, 'answer');\n if (typeof answer !== 'string') return undefined;\n const given = ownProp(value, 'sources');\n if (given !== undefined && !Array.isArray(given)) return undefined;\n const sources: (Omit<SearchSourceView, 'citations'> & { citations: number[] })[] = [];\n const kept = new Map<string, number>();\n for (const [index, entry] of (given ?? []).entries()) {\n const document = readDocumentContent(entry);\n if (!document) return undefined;\n const web = readWebUrl(document.url) ?? readWebUrl(document.publicUrl);\n const key = web ? `web ${samePageKey(web.written)}` : `as written ${document.url}`;\n const citation = index + 1;\n const existing = kept.get(key);\n if (existing !== undefined) {\n sources[existing]?.citations.push(citation);\n continue;\n }\n kept.set(key, sources.length);\n const host = web?.parsed.hostname.replace(/^www\\./, '');\n const title = document.title === undefined ? undefined : decodeTitle(document.title).trim();\n sources.push({\n address: web?.parsed.href ?? document.url,\n ...(web ? { href: web.parsed.href } : {}),\n ...(host ? { host } : {}),\n ...(title ? { title } : {}),\n ...(document.snippet !== undefined ? { snippet: document.snippet } : {}),\n citations: [citation],\n });\n }\n return { answer, sources };\n}\n\n/**\n * The named references a page's title is decoded from: the ones an escaper\n * writes. A `Map`, so a name such as `constructor` finds nothing inherited.\n */\nconst TITLE_NAMED_REFERENCES: ReadonlyMap<string, string> = new Map([\n ['amp', '&'],\n ['lt', '<'],\n ['gt', '>'],\n ['quot', '\"'],\n ['apos', \"'\"],\n ['nbsp', '\\u00a0'],\n]);\n\n/** A complete character reference: decimal, hexadecimal or named, closed by `;`. */\nconst TITLE_REFERENCE = /&(?:#([0-9]+)|#[xX]([0-9a-fA-F]+)|([a-z]+));/g;\n\n/**\n * A page's title, its character references decoded, as a reader is meant to\n * see it. Only a complete reference is read: a decimal `'`, a hexadecimal\n * `'`, or a name of `TITLE_NAMED_REFERENCES`, each closed by `;`. Anything\n * else stays exactly as written, a semicolonless look-alike such as `¬able`\n * or `R&D © editing` among it, and so does a reference to a code point\n * that is not a character (zero, a surrogate, or one past U+10FFFF). It is one\n * pass, so `&amp;` reads as `&`, never as `&`. A no-break space, the\n * one ` ` decodes to, reads as an ordinary space.\n */\nfunction decodeTitle(title: string): string {\n return title\n .replace(TITLE_REFERENCE, (reference, decimal?: string, hex?: string, name?: string) => {\n if (name !== undefined) return TITLE_NAMED_REFERENCES.get(name) ?? reference;\n const codePoint = decimal !== undefined ? Number(decimal) : parseInt(hex ?? '', 16);\n const isCharacter =\n codePoint > 0 && codePoint <= 0x10ffff && !(codePoint >= 0xd800 && codePoint <= 0xdfff);\n return isCharacter ? String.fromCodePoint(codePoint) : reference;\n })\n .replace(/\\u00a0/g, ' ');\n}\n\n/**\n * An address split into its parts as written, by the expression RFC 3986 gives\n * for it (appendix B): scheme, authority, path, query and fragment. Every part\n * is optional, so it matches any string.\n */\nconst URI_PARTS = /^(?:([^:/?#]+):)?(?:\\/\\/([^/?#]*))?([^?#]*)(?:\\?([^#]*))?(?:#([\\s\\S]*))?$/;\n\n/**\n * What two web addresses of one page have in common, so a search that lists\n * the page twice lists it once. It is the runtime's rule, which deduplicates a\n * search's sources the same way, so it reads the address as written, split as\n * RFC 3986 splits it (`URI_PARTS`), rather than as the parser normalises it:\n *\n * - the scheme is left out: `http` and `https` serve the same page, and a\n * search lists either (the address is a web one, the parser has said so);\n * - the host is lowercased and has one leading `www.` dropped, since\n * `www.example.com` and `example.com` are one site to a reader; the user\n * information and the port stay as written, a scheme's default port too;\n * - the fragment is left out: `#section` names a place in the page, not\n * another page;\n * - a path not written is the path `/`, so `https://example.com` and\n * `https://example.com/` are one page; one trailing `/` is dropped from any\n * other path (`/guide/` is `/guide`), and its case is kept;\n * - the query stays, as written, since `?id=445` may be all that tells two\n * pages apart; an empty one is none.\n */\nfunction samePageKey(written: string): string {\n const parts = URI_PARTS.exec(written);\n if (!parts) return written;\n const [, , authority = '', path = '', query = ''] = parts;\n const at = authority.lastIndexOf('@');\n const host = authority\n .slice(at + 1)\n .toLowerCase()\n .replace(/^www\\./, '');\n const page = path === '' ? '/' : path.length > 1 && path.endsWith('/') ? path.slice(0, -1) : path;\n return `${authority.slice(0, at + 1)}${host}${page}${query === '' ? '' : `?${query}`}`;\n}\n\n/**\n * The source an inline citation names, counted from one over the sources as\n * the payload lists them: `[2]` names the second, or the copy kept for it.\n * `undefined` for a number that names no source, which a renderer leaves as\n * the text it is.\n */\nexport function citedSource(\n content: SearchResultContentView,\n citation: number,\n): SearchSourceView | undefined {\n return content.sources.find((source) => source.citations.includes(citation));\n}\n\n/** A run of text, or an inline citation in it: `[2]`, its number and its text. */\nexport type CitationSegment = { text: string } | { citation: number; text: string };\n\n/**\n * A run of text cut at its inline citations: every `[n]`, `n` a whole number\n * from one written with no leading zero, is a segment of its own, and a run\n * such as `[2][3]` is two. Text between them is kept as written, so joining\n * the segments' text gives the run back.\n *\n * It reads plain text only. Which runs of an answer are plain text (not a link,\n * an image or code, where a bracketed number is the author's own) is the\n * Markdown reader's question, and it hands this only those.\n */\nexport function splitCitations(text: string): CitationSegment[] {\n const segments: CitationSegment[] = [];\n let last = 0;\n for (const match of text.matchAll(/\\[([1-9][0-9]*)\\]/g)) {\n const at = match.index;\n if (at > last) segments.push({ text: text.slice(last, at) });\n segments.push({ citation: Number(match[1]), text: match[0] });\n last = at + match[0].length;\n }\n if (last < text.length) segments.push({ text: text.slice(last) });\n return segments;\n}\n\n/** One member of a composite: the name it was composed under, and its content. */\nexport interface CompositeMember {\n name: string;\n value: unknown;\n}\n\n/**\n * Read a `native.Composite` — a named composition of contents.\n *\n * The members are returned in the order the payload states them, which is the\n * order the method composed them in and the only order there is: a composite\n * declares no fields, so there is no authored order to prefer over it.\n *\n * `undefined` for anything that is not a record, so the caller falls back.\n */\nexport function readCompositeContent(value: unknown): CompositeMember[] | undefined {\n if (!isRecord(value)) return undefined;\n return Object.entries(value).map(([name, member]) => ({ name, value: member }));\n}\n\n/**\n * Whether a descriptor node carries markup — its concept IS `native.Html`, or\n * refines it.\n *\n * The refinement chain is checked, not just the leaf, because a method may\n * declare `legal.ClauseMarkup` refining `native.Html` and a reader of that result\n * wants the markup rendered just the same. `refines` is on the wire for exactly\n * this question.\n */\nexport function isNativeHtmlNode(node: NativeNode): boolean {\n return refinesNative(node, NATIVE_HTML_CONCEPT_REF);\n}\n\n/**\n * Whether a node IS a `native.Date` — the other content model the kind\n * vocabulary cannot name.\n *\n * `native.Date` is `{date, time}`, two properties, so nothing unwraps it and its\n * node is an `object`. Correct for the descriptor and wrong for a reader: a date\n * result rendered structurally is a two-field card whose second field says \"not\n * provided\", where the answer is a date. The `date` ARM already reads exactly\n * this model — `readDateContent` takes `{date, time}` — it just never fires,\n * because the kind says `object`.\n *\n * A `date` FIELD inside a structure is a different thing and needs none of this:\n * it carries `kind: \"date\"` already.\n */\nexport function isNativeDateNode(node: NativeNode): boolean {\n return refinesNative(node, NATIVE_DATE_CONCEPT_REF);\n}\n\n/**\n * Whether a node is a `native.Composite` — a named bag of contents.\n *\n * The third concept the kind vocabulary cannot name, and the one where it is\n * least able to: a composite declares no members at all, so its descriptor is\n * `kind: \"unknown\"` and its payload schema is `{additionalProperties: true}`\n * with no properties. Both are TRUE — the standard's escape hatch, honestly\n * used — and both leave a renderer with nothing to read, so the default\n * fallback prints the whole thing as a JSON blob.\n *\n * That is the worst available answer to a value that is, by definition, a map\n * of ordinary `StuffContent`s. Keyed by concept, a renderer can at least show\n * the members as the named things they are. See `CompositeValue`.\n */\nexport function isNativeCompositeNode(node: NativeNode): boolean {\n return refinesNative(node, NATIVE_COMPOSITE_CONCEPT_REF);\n}\n\n/**\n * Whether a node is a `native.Page`, or a concept refining it — one page of an\n * extracted document.\n *\n * Its node is an `object` over `{text_and_images, page_view}`, which the\n * structural renderer laid out as a record: in a list, a table whose\n * \"Text and images\" column was named by the first `text` member it found,\n * `raw_html`, which an extractor leaves empty, so a page holding a whole\n * report read as a row of dashes. Keyed by concept, the result view reads the\n * page's text instead. See `readPageContent`.\n */\nexport function isNativePageNode(node: NativeNode): boolean {\n return refinesNative(node, NATIVE_PAGE_CONCEPT_REF);\n}\n\n/**\n * Whether a node is one of the verdicts a judge returns — a yes or no\n * (`native.YesNo`), a rating (`native.Rating`) or a choice (`native.Choice`),\n * or a concept refining one — and which.\n *\n * Their nodes are `object`s over the verdict and its measures (a `YesNo` from\n * an older runtime, whose model had one member, is a `boolean` node unwrapped\n * by its content key), so the structural renderer printed the measures as a\n * record: \"Yes no: Yes / Probability: 1\". The concept is what says the record\n * is a verdict, read off `concept_ref` and `refines` like every other native\n * predicate here, never off which keys the value happens to hold.\n */\nexport function nativeVerdictOf(node: NativeNode): 'yes_no' | 'rating' | 'choice' | undefined {\n if (refinesNative(node, NATIVE_YES_NO_CONCEPT_REF)) return 'yes_no';\n if (refinesNative(node, NATIVE_RATING_CONCEPT_REF)) return 'rating';\n if (refinesNative(node, NATIVE_CHOICE_CONCEPT_REF)) return 'choice';\n return undefined;\n}\n\n/**\n * Whether a node is a `native.SearchResult`, or a concept refining it: a\n * search's answer and the documents it was written from.\n *\n * Its node is an `object` over `{answer, sources}`, which the structural\n * renderer drew as a record: the answer squeezed beside its label with its\n * Markdown printed, and each web page it cites drawn as a file to download.\n * The concept is what says the record is a search result, never the keys the\n * value holds. See `readSearchResultContent`.\n */\nexport function isNativeSearchResultNode(node: NativeNode): boolean {\n return refinesNative(node, NATIVE_SEARCH_RESULT_CONCEPT_REF);\n}\n\n/**\n * Whether a node is one of the natives the kind vocabulary cannot name that a\n * list draws one value per line — a date, an HTML page, a composite — which a\n * renderer reads by CONCEPT before it reads the kind. A list of one answers no\n * (the predicates refuse a `list` node), and its item answers yes.\n *\n * One answer, read twice: the result view renders a list whose item answers yes\n * one value per line rather than as a table, and the generative layer delegates\n * that list to the kernel, because no catalog component reads a native value.\n * Not re-exported: a host asks the predicates it needs.\n */\nexport function isNativeValueNode(node: NativeNode): boolean {\n return isNativeDateNode(node) || isNativeHtmlNode(node) || isNativeCompositeNode(node);\n}\n\n/** What the native predicates read off a node: its stated kind and its concept. */\ninterface NativeNode {\n kind?: string;\n conceptRef?: string;\n refines?: readonly string[];\n}\n\n/**\n * The node IS one of the named native, or of a concept refining it.\n *\n * **A list of them is not one of them.** Plurality is not on the concept: a\n * plural node's `concept_ref` is its ELEMENT's, with the multiplicity stripped,\n * so a `native.Date[]` result is a `list` node whose concept reads\n * `native.Date`. Asking the concept alone answered yes for the whole list, and\n * every caller then treated the list as ONE date, one page or one composite: a\n * list of dates rendered as a single absent date, and a list of pages collected\n * no page at all. So a node whose stated kind is `list`\n * answers no, and its `item` answers for itself. The kind is the descriptor's\n * own statement, so this reads a stated fact and inspects no value.\n */\nfunction refinesNative(node: NativeNode, ref: string): boolean {\n if (node.kind === 'list') return false;\n if (node.conceptRef === ref) return true;\n return node.refines?.includes(ref) ?? false;\n}\n\n/**\n * Read a `date`-kind value, in any of the three shapes a run produces.\n *\n * The `date` member is read one level deep, because `native.Date`'s own `date`\n * member is a `datetime.date` and therefore arrives inside the same typed-scalar\n * envelope the whole value may already be wrapped in. One level is enough and\n * the recursion is bounded on purpose: a second envelope would be a\n * serialization bug, and following it forever would turn one into a hang.\n */\nexport function readDateContent(value: unknown): DateContentView | undefined {\n if (typeof value === 'string') {\n return value.length > 0 ? { date: value } : undefined;\n }\n if (!isRecord(value)) return undefined;\n\n const inner = ownProp(value, 'date');\n const date =\n typeof inner === 'string' ? inner : isRecord(inner) ? readText(inner, 'date') : undefined;\n if (date === undefined) return undefined;\n return { date, time: readText(value, 'time') };\n}\n\n/** `{date}` / `{date, time}` as one line, which is how both are read aloud. */\nexport function formatDateContent(content: DateContentView): string {\n return content.time ? `${content.date} ${content.time}` : content.date;\n}\n\n/**\n * The media types a `data:` URL may carry and still be viewable, each with the\n * extensions a saved file of that type may carry, the first being the one given\n * to a name that has none of them.\n *\n * An allow-list rather than a deny-list, because the question a sink asks is\n * \"can this paint without executing\", and only a closed set answers it. The\n * raster types are the ones the preview arms already name; `application/pdf` is\n * here because the input control previews a `data:application/pdf` value a\n * storage-less host wrote back, through an `<object>`, and reads this same\n * predicate to decide.\n *\n * `image/svg+xml` is deliberately absent: an SVG paints as a picture and\n * EXECUTES as a document the moment it is opened in a tab, which is one click\n * away from every image this package paints.\n *\n * The extensions live here, beside each admitted type, rather than in the save\n * planner that reads them: a type admitted without one would save under a name\n * with no extension, and the two lists used to be kept in step by hand.\n */\nconst VIEWABLE_DATA_MEDIA_TYPES: ReadonlyMap<string, readonly [string, ...string[]]> = new Map([\n ['image/png', ['png']],\n ['image/jpeg', ['jpg', 'jpeg']],\n ['image/gif', ['gif']],\n ['image/webp', ['webp']],\n ['image/avif', ['avif']],\n ['application/pdf', ['pdf']],\n]);\n\n/**\n * The extensions a saved `data:` file of this admitted media type may carry,\n * the first being its own. Empty for a type the gate does not admit.\n */\nexport function dataUrlExtensions(mediaType: string): readonly string[] {\n return VIEWABLE_DATA_MEDIA_TYPES.get(mediaType) ?? [];\n}\n\n/**\n * An origin no host can be, to resolve a relative reference against.\n *\n * `.invalid` is reserved by RFC 2606 and resolves nowhere, so nothing can be\n * fetched from it by accident. It exists only so a path can be parsed at all;\n * the answer taken from the parse is whether the reference STAYED on it.\n */\nconst RELATIVE_SENTINEL_ORIGIN = 'https://url-gate.invalid';\n\n/**\n * A scheme, by RFC 3986's grammar: a letter, then letters, digits, `+`, `-`, `.`\n *\n * Read off the string rather than inferred from a parse, because a parse needs a\n * base and the base is what makes the answer wrong — see {@link viewableUrl}.\n */\nconst OWN_SCHEME_RE = /^[a-z][a-z0-9+.-]*:/i;\n\n/**\n * What the WHATWG URL parser strips before it parses, applied before we judge.\n *\n * Leading and trailing C0 controls and spaces are removed, and every internal\n * tab, line feed and carriage return. This is not tidying: a scheme test run on\n * the raw string and a browser running on the parsed one disagree about\n * `\" https://cdn/x.png\"` — `new URL()` reads it as `https:` and `/^https?:/`\n * does not — and a host that validated a member by parsing while this gate\n * prefix-matched would have judged a different string than the one painted.\n */\nfunction stripUrlWhitespace(candidate: string): string {\n // Written out rather than as a character-class regex: the range IS the control\n // characters, which is exactly what a regex may not spell (`no-control-regex`).\n let start = 0;\n let end = candidate.length;\n while (start < end && candidate.charCodeAt(start) <= 0x20) start += 1;\n while (end > start && candidate.charCodeAt(end - 1) <= 0x20) end -= 1;\n // Scan before rebuilding, and rebuild only from the first character that has\n // to go. Almost every URL has nothing to strip inside it, and the one that\n // does is the one that is huge: an inline `data:` image is judged three or\n // four times per render, and a per-character rebuild of a megabyte-long\n // payload each time is hundreds of milliseconds of frozen main thread for a\n // string that comes back identical.\n for (let index = start; index < end; index += 1) {\n const code = candidate.charCodeAt(index);\n // Tab, line feed, carriage return - removed wherever they appear, not only\n // at the edges, which is what the parser does with them.\n if (code === 0x09 || code === 0x0a || code === 0x0d) {\n let stripped = candidate.slice(start, index);\n for (let rest = index; rest < end; rest += 1) {\n const restCode = candidate.charCodeAt(rest);\n if (restCode !== 0x09 && restCode !== 0x0a && restCode !== 0x0d)\n stripped += candidate[rest];\n }\n return stripped;\n }\n }\n return start === 0 && end === candidate.length ? candidate : candidate.slice(start, end);\n}\n\n/** What a `data:` URL says about the bytes it carries. */\nexport interface DataUrlView {\n /** Lowercased, without its parameters; `text/plain` when the URL declares none. */\n mediaType: string;\n /** The size of the DECODED payload, in bytes. */\n bytes: number;\n}\n\n/**\n * A `data:` URL's media type and decoded size, or `undefined` for any other URL.\n *\n * A host that encodes a picked file in the browser writes the file itself into\n * the value's `url`, so a thirty-kilobyte PDF is a forty-thousand-character\n * string, and printed where a reference would be it tells a person nothing. Its\n * type and its size are what they can read.\n *\n * The size is COUNTED rather than decoded. A base64 payload's size follows from\n * how many symbols it holds, and decoding a megabyte to measure it would be the\n * frozen main thread {@link stripUrlWhitespace} is written to avoid. This is a\n * reading for display, not a gate: whether the URL may be painted is still\n * {@link viewableUrl}'s answer alone.\n */\nexport function readDataUrl(candidate: string): DataUrlView | undefined {\n const url = candidate.trimStart();\n if (!/^data:/i.test(url)) return undefined;\n const comma = url.indexOf(',');\n if (comma === -1) return undefined;\n const [declared = '', ...parameters] = url.slice('data:'.length, comma).split(';');\n const trimmed = declared.trim().toLowerCase();\n // A fragment is not payload. `#page=2` on an inline PDF is the viewer's, and\n // counting it as bytes is counting the URL rather than the file.\n const fragment = url.indexOf('#', comma);\n const payload = fragment === -1 ? url.slice(comma + 1) : url.slice(comma + 1, fragment);\n const base64 = parameters.some((parameter) => parameter.trim().toLowerCase() === 'base64');\n return {\n mediaType: trimmed === '' ? 'text/plain' : trimmed,\n bytes: base64 ? base64Bytes(payload) : percentEncodedBytes(payload),\n };\n}\n\n/**\n * Three bytes for every four symbols, ignoring what is not one: the `=`\n * padding, and the line breaks a MIME encoder wraps its output at. Both\n * alphabets count, the standard one and the URL-safe one.\n *\n * A percent-escape is resolved to the character it stands for before it is\n * judged, because a payload may be escaped anywhere — `YQ%3D%3D` is `YQ==`,\n * one byte, and counting `3` and `D` as symbols made it four.\n */\nfunction base64Bytes(payload: string): number {\n let symbols = 0;\n for (let index = 0; index < payload.length; index += 1) {\n let code = payload.charCodeAt(index);\n if (code === 0x25) {\n const escaped = Number.parseInt(payload.slice(index + 1, index + 3), 16);\n if (!Number.isNaN(escaped) && index + 2 < payload.length) {\n code = escaped;\n index += 2;\n }\n }\n if (\n (code >= 0x41 && code <= 0x5a) ||\n (code >= 0x61 && code <= 0x7a) ||\n (code >= 0x30 && code <= 0x39) ||\n code === 0x2b ||\n code === 0x2f ||\n code === 0x2d ||\n code === 0x5f\n )\n symbols += 1;\n }\n return Math.floor((symbols * 3) / 4);\n}\n\n/** A percent-escape is one byte; any other character is its UTF-8 length. */\nfunction percentEncodedBytes(payload: string): number {\n const escapes = payload.match(/%[0-9a-f]{2}/gi)?.length ?? 0;\n return new TextEncoder().encode(payload).length - escapes * 2;\n}\n\n/** The media type a `data:` URL declares, lowercased; `text/plain` when it declares none. */\nfunction dataUrlMediaType(parsed: URL): string {\n const declared = parsed.pathname.split(/[;,]/, 1)[0] ?? '';\n const trimmed = declared.trim().toLowerCase();\n return trimmed === '' ? 'text/plain' : trimmed;\n}\n\n/**\n * The URL a browser can paint, normalised — or `undefined` when there is none.\n *\n * **The string this returns is the string a sink must use.** That is the whole\n * point of returning one rather than answering yes or no: the gate judges a\n * normalised URL, so handing the caller back the raw member would let the two\n * diverge again on exactly the whitespace the parser strips.\n *\n * The gate parses rather than prefix-matches, and branches on the protocol the\n * parser reports:\n *\n * - `http:` and `https:` are viewable.\n * - `blob:` is viewable. A blob URL is bound to the origin that minted it, so a\n * payload cannot forge one that points anywhere else.\n * - `data:` is viewable only for a media type in {@link VIEWABLE_DATA_MEDIA_TYPES}.\n * `data:text/html` is a document at the EMBEDDING page's own origin, which is\n * what made an unsandboxed frame over a payload URL a real hole.\n * - Everything else is not: `javascript:`, `file:` (a run on a developer's\n * machine writes one, and a browser refuses to load it from an http page) and\n * `pipelex-storage://`, which cannot be resolved client-side at all — that is\n * the upload seam's job (see [../../docs/upload-seam.md]), and a renderer with\n * no resolver must show the reference rather than a broken `<img>`.\n *\n * **A root-relative path counts**, and leaving it out was a real bug rather\n * than an omission. A host's URL resolver naturally hands back a path on its\n * OWN origin — `/api/assets/…`, an authenticated route that streams the object\n * — which is the whole point of resolving rather than exposing storage. This\n * predicate rejected it for having no scheme, so the resolved URL was thrown\n * away and the arms fell back to the payload's `public_url`: a presigned URL\n * that had already expired. The image stayed broken with the fix in place.\n *\n * A path is rejected when it is protocol-relative — `//host/x`, and the two\n * backslash spellings the parser reads the same way (`\\\\host\\x`, `/\\host/x`) —\n * and then checked against the sentinel as well. An accepted path is returned\n * relative, because making it absolute against a sentinel would point it at\n * nowhere.\n */\nexport function viewableUrl(candidate: string | undefined): string | undefined {\n if (!candidate) return undefined;\n const stripped = stripUrlWhitespace(candidate);\n if (stripped === '') return undefined;\n\n // Whether the string carries a scheme is read OFF THE STRING, before any base\n // is applied, because the parser reads a candidate whose scheme equals the\n // base's as relative to that base. Deciding it with a second, base-less parse\n // let the two disagree: `https:cdn.example/x.png` was judged absolute and\n // resolved against the sentinel, so the gate handed a sink\n // `https://url-gate.invalid/cdn.example/x.png` — an internal placeholder, in a\n // real `<img src>`, in place of a URL that had worked. The grammar is RFC\n // 3986's, and it agrees with the parser on every string either accepts.\n if (OWN_SCHEME_RE.test(stripped)) {\n let parsed: URL;\n try {\n parsed = new URL(stripped);\n } catch {\n return undefined;\n }\n switch (parsed.protocol) {\n case 'http:':\n case 'https:':\n case 'blob:':\n return parsed.href;\n case 'data:':\n return VIEWABLE_DATA_MEDIA_TYPES.has(dataUrlMediaType(parsed)) ? parsed.href : undefined;\n default:\n return undefined;\n }\n }\n\n // No scheme of its own: a reference relative to wherever the page is. Only a\n // root-relative path qualifies.\n if (!stripped.startsWith('/')) return undefined;\n // Protocol-relative, rejected on the SPELLING. \"Did it stay on the sentinel\"\n // reads as the same rule and is blind in exactly one place — the sentinel's\n // own host — so `//url-gate.invalid/x` passed the test written to stop it.\n const afterSlash = stripped.charCodeAt(1);\n if (afterSlash === 0x2f || afterSlash === 0x5c) return undefined;\n let parsed: URL;\n try {\n parsed = new URL(stripped, RELATIVE_SENTINEL_ORIGIN);\n } catch {\n return undefined;\n }\n return parsed.origin === RELATIVE_SENTINEL_ORIGIN ? stripped : undefined;\n}\n\n/**\n * Whether a browser can paint this URL as-is — {@link viewableUrl} as a guard.\n *\n * Prefer `viewableUrl` wherever the URL is then USED: this answers the question\n * without handing back the normalised string, so a caller that acts on the raw\n * candidate acts on a string the gate did not judge.\n */\nexport function isViewableUrl(url: string | undefined): url is string {\n return viewableUrl(url) !== undefined;\n}\n\n/**\n * The typed-scalar markers the serialization layer stamps onto a value.\n *\n * Exported so a host can recognise (and strip) them; nothing in the kernel\n * BRANCHES on them, which is the point — a reader keyed by these would be\n * reading the serializer instead of the standard.\n */\nexport const TYPED_SCALAR_MARKERS = ['__class__', '__module__'] as const;\n\n/** Whether a record carries the typed-scalar markers. Informational. */\nexport function hasTypedScalarMarkers(value: unknown): boolean {\n return isRecord(value) && TYPED_SCALAR_MARKERS.every((marker) => hasOwnProp(value, marker));\n}\n"]}
|
package/dist/core/index.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ export { StuffFile, StuffFileKind, collectStuffFiles } from './stuff-files.js';
|
|
|
6
6
|
export { SaveFailure, SaveFile, SaveFileKind, SaveFiles, SavePlan, SavePlanOptions, SaveResult, UnavailableFile, planFileSave, planStuffSave } from './save-plan.js';
|
|
7
7
|
export { DOCUMENT_FORMATS, FileFormat, IMAGE_FORMATS, acceptLabel, acceptMap, formatsForKind, isAcceptedFile } from './file-formats.js';
|
|
8
8
|
export { narrowFileFormats } from './narrow-file-formats.js';
|
|
9
|
-
export { ChoiceContentView, CompositeMember, DataUrlView, DateContentView, DocumentContentView, HtmlContentView, ImageContentView, NATIVE_CHOICE_CONCEPT_REF, NATIVE_COMPOSITE_CONCEPT_REF, NATIVE_DATE_CONCEPT_REF, NATIVE_HTML_CONCEPT_REF, NATIVE_PAGE_CONCEPT_REF, NATIVE_RATING_CONCEPT_REF, NATIVE_YES_NO_CONCEPT_REF, PageContentView, RatingContentView, TYPED_SCALAR_MARKERS, YesNoContentView, formatDateContent, hasTypedScalarMarkers, isNativeCompositeNode, isNativeDateNode, isNativeHtmlNode, isNativePageNode, isViewableUrl, nativeVerdictOf, readChoiceContent, readCompositeContent, readDataUrl, readDateContent, readDocumentContent, readHtmlContent, readImageContent, readPageContent, readRatingContent, readYesNoContent, viewableUrl } from './native-content.js';
|
|
9
|
+
export { ChoiceContentView, CitationSegment, CompositeMember, DataUrlView, DateContentView, DocumentContentView, HtmlContentView, ImageContentView, NATIVE_CHOICE_CONCEPT_REF, NATIVE_COMPOSITE_CONCEPT_REF, NATIVE_DATE_CONCEPT_REF, NATIVE_HTML_CONCEPT_REF, NATIVE_PAGE_CONCEPT_REF, NATIVE_RATING_CONCEPT_REF, NATIVE_SEARCH_RESULT_CONCEPT_REF, NATIVE_YES_NO_CONCEPT_REF, PageContentView, RatingContentView, SearchResultContentView, SearchSourceView, TYPED_SCALAR_MARKERS, YesNoContentView, citedSource, formatDateContent, hasTypedScalarMarkers, isNativeCompositeNode, isNativeDateNode, isNativeHtmlNode, isNativePageNode, isNativeSearchResultNode, isViewableUrl, nativeVerdictOf, readChoiceContent, readCompositeContent, readDataUrl, readDateContent, readDocumentContent, readHtmlContent, readImageContent, readPageContent, readRatingContent, readSearchResultContent, readYesNoContent, splitCitations, viewableUrl } from './native-content.js';
|
|
10
10
|
export { Readiness, anyOptionalStructureOpen, computeReadiness, fieldFilled, foldsBehindOptionalDisclosure, isFilled, isFoldedOptional, isOptionalStructure, mustBeFilled, optionalStructureOpen, shownAsOptional } from './readiness.js';
|
|
11
11
|
export { closeOptionalStructures, openOptionalStructures, seedInputs, seedObjectValue } from './seed.js';
|
|
12
12
|
export { InputPresence, buildPipeRef, getPipeIOContract, inputMustBeFilled, isFixedCountInput, isOptionalInput, isPluralInput } from './contracts.js';
|
package/dist/core/index.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
export { planFileSave, planStuffSave } from '../chunk-
|
|
1
|
+
export { planFileSave, planStuffSave } from '../chunk-4VAO6BDE.js';
|
|
2
2
|
export { closeOptionalStructures, openOptionalStructures, seedInputs, seedObjectValue } from '../chunk-VH5CDQDR.js';
|
|
3
3
|
export { addChosenFiles, chosenFilesAdded, roomForChosenFiles, sourceFileValue } from '../chunk-NSHGLM6A.js';
|
|
4
|
-
export { collectStuffFiles } from '../chunk-
|
|
4
|
+
export { collectStuffFiles } from '../chunk-56WECFBD.js';
|
|
5
5
|
export { describeValidationError, displayValue, valueAtProperty } from '../chunk-RPA7DNSK.js';
|
|
6
6
|
export { apiInputsFromRunValues, fieldsForContract, inputDataFromWorkingMemory, outputsFromPipeOutput, rjsfDataFromRunValues, runValuesFromInputs, runValuesFromStore, sameRunValues, setValueAtPath, storeInputDataFromRunValues } from '../chunk-ZX52CQJ4.js';
|
|
7
7
|
export { narrowFileFormats } from '../chunk-CAKQ5VFT.js';
|
|
8
|
-
export { NATIVE_CHOICE_CONCEPT_REF, NATIVE_COMPOSITE_CONCEPT_REF, NATIVE_DATE_CONCEPT_REF, NATIVE_HTML_CONCEPT_REF, NATIVE_PAGE_CONCEPT_REF, NATIVE_RATING_CONCEPT_REF, NATIVE_YES_NO_CONCEPT_REF, TYPED_SCALAR_MARKERS, formatDateContent, hasTypedScalarMarkers, isNativeCompositeNode, isNativeDateNode, isNativeHtmlNode, isNativePageNode, isViewableUrl, nativeVerdictOf, readChoiceContent, readCompositeContent, readDataUrl, readDateContent, readDocumentContent, readHtmlContent, readImageContent, readPageContent, readRatingContent, readYesNoContent, viewableUrl } from '../chunk-
|
|
8
|
+
export { NATIVE_CHOICE_CONCEPT_REF, NATIVE_COMPOSITE_CONCEPT_REF, NATIVE_DATE_CONCEPT_REF, NATIVE_HTML_CONCEPT_REF, NATIVE_PAGE_CONCEPT_REF, NATIVE_RATING_CONCEPT_REF, NATIVE_SEARCH_RESULT_CONCEPT_REF, NATIVE_YES_NO_CONCEPT_REF, TYPED_SCALAR_MARKERS, citedSource, formatDateContent, hasTypedScalarMarkers, isNativeCompositeNode, isNativeDateNode, isNativeHtmlNode, isNativePageNode, isNativeSearchResultNode, isViewableUrl, nativeVerdictOf, readChoiceContent, readCompositeContent, readDataUrl, readDateContent, readDocumentContent, readHtmlContent, readImageContent, readPageContent, readRatingContent, readSearchResultContent, readYesNoContent, splitCitations, viewableUrl } from '../chunk-QQK6Y55E.js';
|
|
9
9
|
export { getPipeOutputForm } from '../chunk-JIGRWJTV.js';
|
|
10
10
|
export { buildResultField, buildRunFields, getPipeInputForm } from '../chunk-ZB4RYUKV.js';
|
|
11
11
|
export { conceptCategory } from '../chunk-FABY3DEY.js';
|
|
@@ -112,6 +112,7 @@ declare const NATIVE_PAGE_CONCEPT_REF = "native.Page";
|
|
|
112
112
|
declare const NATIVE_YES_NO_CONCEPT_REF = "native.YesNo";
|
|
113
113
|
declare const NATIVE_RATING_CONCEPT_REF = "native.Rating";
|
|
114
114
|
declare const NATIVE_CHOICE_CONCEPT_REF = "native.Choice";
|
|
115
|
+
declare const NATIVE_SEARCH_RESULT_CONCEPT_REF = "native.SearchResult";
|
|
115
116
|
/**
|
|
116
117
|
* `native.Page`, read: what one page of an extracted document holds.
|
|
117
118
|
*
|
|
@@ -180,6 +181,96 @@ interface ChoiceContentView {
|
|
|
180
181
|
* of them, so an empty key names no option and leaves no answer to draw.
|
|
181
182
|
*/
|
|
182
183
|
declare function readChoiceContent(value: unknown): ChoiceContentView | undefined;
|
|
184
|
+
/**
|
|
185
|
+
* One source of a search result, read: a document the answer was written from,
|
|
186
|
+
* which a search returns as a web page rather than as a file.
|
|
187
|
+
*/
|
|
188
|
+
interface SearchSourceView {
|
|
189
|
+
/**
|
|
190
|
+
* The source's address as a reader is shown it: the web address when it has
|
|
191
|
+
* one (normalised, as `href`), else its `url` as the payload states it.
|
|
192
|
+
*/
|
|
193
|
+
address: string;
|
|
194
|
+
/**
|
|
195
|
+
* The web address, normalised, when the source has one: an `http:` or
|
|
196
|
+
* `https:` URL, read from `url`, else from `public_url`. It is the only kind
|
|
197
|
+
* of address a renderer links; any other is shown as text.
|
|
198
|
+
*/
|
|
199
|
+
href?: string;
|
|
200
|
+
/** The web address's host name, a leading `www.` dropped: the site a reader recognises. */
|
|
201
|
+
host?: string;
|
|
202
|
+
title?: string;
|
|
203
|
+
snippet?: string;
|
|
204
|
+
/**
|
|
205
|
+
* The citations that name this source, each counted from one over the
|
|
206
|
+
* sources as the payload lists them. More than one when the payload listed
|
|
207
|
+
* the same address more than once: a later copy is not kept, and its number
|
|
208
|
+
* names the copy that is.
|
|
209
|
+
*/
|
|
210
|
+
citations: readonly number[];
|
|
211
|
+
}
|
|
212
|
+
/** `native.SearchResult`, read: the answer, and each of its sources once. */
|
|
213
|
+
interface SearchResultContentView {
|
|
214
|
+
/** The answer, as written: Markdown with inline citations (`[2]`, `[2][3]`). */
|
|
215
|
+
answer: string;
|
|
216
|
+
/** Each source once, in the order the payload first lists it. */
|
|
217
|
+
sources: readonly SearchSourceView[];
|
|
218
|
+
}
|
|
219
|
+
/**
|
|
220
|
+
* A web address a renderer may link, normalised: `http:` or `https:`, read by
|
|
221
|
+
* parsing, and `undefined` for any other address. Not re-exported: the
|
|
222
|
+
* Markdown walker reads it to check an address a host hands it for a
|
|
223
|
+
* citation, as the search reader checks a source's.
|
|
224
|
+
*/
|
|
225
|
+
declare function webHref(candidate: string | undefined): string | undefined;
|
|
226
|
+
/**
|
|
227
|
+
* Read a `native.SearchResult` value: `{answer, sources}`, each source a
|
|
228
|
+
* `native.Document`. `undefined` when the value is not that model (no string
|
|
229
|
+
* `answer`, a `sources` that is not a list, or a source that is not a document
|
|
230
|
+
* with a `url`), which leaves the node to the structural arms. A missing
|
|
231
|
+
* `sources` reads as none, since the runtime's model defaults it to an empty
|
|
232
|
+
* list.
|
|
233
|
+
*
|
|
234
|
+
* **A source listed twice is kept once.** Two sources with web addresses are
|
|
235
|
+
* the same page when `samePageKey` reads the two alike: it sets aside what does
|
|
236
|
+
* not change the page (`http` or `https`, the host's case and a leading
|
|
237
|
+
* `www.`, the fragment, a trailing `/`) and keeps the query as written. Two
|
|
238
|
+
* sources whose addresses are not web ones, or that the parser refuses, are
|
|
239
|
+
* the same when the two strings are. The first is kept, where the payload
|
|
240
|
+
* first lists it, under its own title and at its own address, and the
|
|
241
|
+
* citations of every copy name it.
|
|
242
|
+
*
|
|
243
|
+
* **A source's title is decoded, once** (`decodeTitle`): a run made before the
|
|
244
|
+
* runtime decoded the page's title kept it escaped (`Requirements & SAP
|
|
245
|
+
* Integration`), and it keeps it so for good. The snippet is left as written,
|
|
246
|
+
* and so is the answer, which is Markdown and decoded as Markdown.
|
|
247
|
+
*/
|
|
248
|
+
declare function readSearchResultContent(value: unknown): SearchResultContentView | undefined;
|
|
249
|
+
/**
|
|
250
|
+
* The source an inline citation names, counted from one over the sources as
|
|
251
|
+
* the payload lists them: `[2]` names the second, or the copy kept for it.
|
|
252
|
+
* `undefined` for a number that names no source, which a renderer leaves as
|
|
253
|
+
* the text it is.
|
|
254
|
+
*/
|
|
255
|
+
declare function citedSource(content: SearchResultContentView, citation: number): SearchSourceView | undefined;
|
|
256
|
+
/** A run of text, or an inline citation in it: `[2]`, its number and its text. */
|
|
257
|
+
type CitationSegment = {
|
|
258
|
+
text: string;
|
|
259
|
+
} | {
|
|
260
|
+
citation: number;
|
|
261
|
+
text: string;
|
|
262
|
+
};
|
|
263
|
+
/**
|
|
264
|
+
* A run of text cut at its inline citations: every `[n]`, `n` a whole number
|
|
265
|
+
* from one written with no leading zero, is a segment of its own, and a run
|
|
266
|
+
* such as `[2][3]` is two. Text between them is kept as written, so joining
|
|
267
|
+
* the segments' text gives the run back.
|
|
268
|
+
*
|
|
269
|
+
* It reads plain text only. Which runs of an answer are plain text (not a link,
|
|
270
|
+
* an image or code, where a bracketed number is the author's own) is the
|
|
271
|
+
* Markdown reader's question, and it hands this only those.
|
|
272
|
+
*/
|
|
273
|
+
declare function splitCitations(text: string): CitationSegment[];
|
|
183
274
|
/** One member of a composite: the name it was composed under, and its content. */
|
|
184
275
|
interface CompositeMember {
|
|
185
276
|
name: string;
|
|
@@ -260,6 +351,17 @@ declare function isNativePageNode(node: NativeNode): boolean;
|
|
|
260
351
|
* predicate here, never off which keys the value happens to hold.
|
|
261
352
|
*/
|
|
262
353
|
declare function nativeVerdictOf(node: NativeNode): 'yes_no' | 'rating' | 'choice' | undefined;
|
|
354
|
+
/**
|
|
355
|
+
* Whether a node is a `native.SearchResult`, or a concept refining it: a
|
|
356
|
+
* search's answer and the documents it was written from.
|
|
357
|
+
*
|
|
358
|
+
* Its node is an `object` over `{answer, sources}`, which the structural
|
|
359
|
+
* renderer drew as a record: the answer squeezed beside its label with its
|
|
360
|
+
* Markdown printed, and each web page it cites drawn as a file to download.
|
|
361
|
+
* The concept is what says the record is a search result, never the keys the
|
|
362
|
+
* value holds. See `readSearchResultContent`.
|
|
363
|
+
*/
|
|
364
|
+
declare function isNativeSearchResultNode(node: NativeNode): boolean;
|
|
263
365
|
/**
|
|
264
366
|
* Whether a node is one of the natives the kind vocabulary cannot name that a
|
|
265
367
|
* list draws one value per line — a date, an HTML page, a composite — which a
|
|
@@ -374,4 +476,4 @@ declare const TYPED_SCALAR_MARKERS: readonly ["__class__", "__module__"];
|
|
|
374
476
|
/** Whether a record carries the typed-scalar markers. Informational. */
|
|
375
477
|
declare function hasTypedScalarMarkers(value: unknown): boolean;
|
|
376
478
|
|
|
377
|
-
export { type ChoiceContentView, type CompositeMember, type DataUrlView, type DateContentView, type DocumentContentView, type HtmlContentView, type ImageContentView, NATIVE_CHOICE_CONCEPT_REF, NATIVE_COMPOSITE_CONCEPT_REF, NATIVE_DATE_CONCEPT_REF, NATIVE_HTML_CONCEPT_REF, NATIVE_PAGE_CONCEPT_REF, NATIVE_RATING_CONCEPT_REF, NATIVE_YES_NO_CONCEPT_REF, type PageContentView, type RatingContentView, TYPED_SCALAR_MARKERS, type YesNoContentView, dataUrlExtensions, formatDateContent, hasTypedScalarMarkers, isNativeCompositeNode, isNativeDateNode, isNativeHtmlNode, isNativePageNode, isNativeValueNode, isViewableUrl, nativeVerdictOf, readChoiceContent, readCompositeContent, readDataUrl, readDateContent, readDocumentContent, readHtmlContent, readImageContent, readPageContent, readRatingContent, readYesNoContent, viewableUrl };
|
|
479
|
+
export { type ChoiceContentView, type CitationSegment, type CompositeMember, type DataUrlView, type DateContentView, type DocumentContentView, type HtmlContentView, type ImageContentView, NATIVE_CHOICE_CONCEPT_REF, NATIVE_COMPOSITE_CONCEPT_REF, NATIVE_DATE_CONCEPT_REF, NATIVE_HTML_CONCEPT_REF, NATIVE_PAGE_CONCEPT_REF, NATIVE_RATING_CONCEPT_REF, NATIVE_SEARCH_RESULT_CONCEPT_REF, NATIVE_YES_NO_CONCEPT_REF, type PageContentView, type RatingContentView, type SearchResultContentView, type SearchSourceView, TYPED_SCALAR_MARKERS, type YesNoContentView, citedSource, dataUrlExtensions, formatDateContent, hasTypedScalarMarkers, isNativeCompositeNode, isNativeDateNode, isNativeHtmlNode, isNativePageNode, isNativeSearchResultNode, isNativeValueNode, isViewableUrl, nativeVerdictOf, readChoiceContent, readCompositeContent, readDataUrl, readDateContent, readDocumentContent, readHtmlContent, readImageContent, readPageContent, readRatingContent, readSearchResultContent, readYesNoContent, splitCitations, viewableUrl, webHref };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { NATIVE_CHOICE_CONCEPT_REF, NATIVE_COMPOSITE_CONCEPT_REF, NATIVE_DATE_CONCEPT_REF, NATIVE_HTML_CONCEPT_REF, NATIVE_PAGE_CONCEPT_REF, NATIVE_RATING_CONCEPT_REF, NATIVE_YES_NO_CONCEPT_REF, TYPED_SCALAR_MARKERS, dataUrlExtensions, formatDateContent, hasTypedScalarMarkers, isNativeCompositeNode, isNativeDateNode, isNativeHtmlNode, isNativePageNode, isNativeValueNode, isViewableUrl, nativeVerdictOf, readChoiceContent, readCompositeContent, readDataUrl, readDateContent, readDocumentContent, readHtmlContent, readImageContent, readPageContent, readRatingContent, readYesNoContent, viewableUrl } from '../chunk-
|
|
1
|
+
export { NATIVE_CHOICE_CONCEPT_REF, NATIVE_COMPOSITE_CONCEPT_REF, NATIVE_DATE_CONCEPT_REF, NATIVE_HTML_CONCEPT_REF, NATIVE_PAGE_CONCEPT_REF, NATIVE_RATING_CONCEPT_REF, NATIVE_SEARCH_RESULT_CONCEPT_REF, NATIVE_YES_NO_CONCEPT_REF, TYPED_SCALAR_MARKERS, citedSource, dataUrlExtensions, formatDateContent, hasTypedScalarMarkers, isNativeCompositeNode, isNativeDateNode, isNativeHtmlNode, isNativePageNode, isNativeSearchResultNode, isNativeValueNode, isViewableUrl, nativeVerdictOf, readChoiceContent, readCompositeContent, readDataUrl, readDateContent, readDocumentContent, readHtmlContent, readImageContent, readPageContent, readRatingContent, readSearchResultContent, readYesNoContent, splitCitations, viewableUrl, webHref } from '../chunk-QQK6Y55E.js';
|
|
2
2
|
import '../chunk-V3OV2XQT.js';
|
|
3
3
|
//# sourceMappingURL=native-content.js.map
|
|
4
4
|
//# sourceMappingURL=native-content.js.map
|
package/dist/core/save-plan.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export { planFileSave, planStuffSave, splitFileName, typedFileStem } from '../chunk-
|
|
2
|
-
import '../chunk-
|
|
3
|
-
import '../chunk-
|
|
1
|
+
export { planFileSave, planStuffSave, splitFileName, typedFileStem } from '../chunk-4VAO6BDE.js';
|
|
2
|
+
import '../chunk-56WECFBD.js';
|
|
3
|
+
import '../chunk-QQK6Y55E.js';
|
|
4
4
|
import '../chunk-V3OV2XQT.js';
|
|
5
5
|
//# sourceMappingURL=save-plan.js.map
|
|
6
6
|
//# sourceMappingURL=save-plan.js.map
|
package/dist/core/stuff-files.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { collectStuffFiles, readStuffFile } from '../chunk-
|
|
2
|
-
import '../chunk-
|
|
1
|
+
export { collectStuffFiles, readStuffFile } from '../chunk-56WECFBD.js';
|
|
2
|
+
import '../chunk-QQK6Y55E.js';
|
|
3
3
|
import '../chunk-V3OV2XQT.js';
|
|
4
4
|
//# sourceMappingURL=stuff-files.js.map
|
|
5
5
|
//# sourceMappingURL=stuff-files.js.map
|
package/dist/generative/index.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { cn, checkedAccentClass, focusOutlineClass, linkTextClass, selectedBorderClass, selectedFillClass, fieldControlClass, ResultRoot, ResultField, FieldRenderer, ToggleGroup, ToggleGroupItem, selectedFillStrongClass, Switch, Select, SelectTrigger, SelectValue, SelectContent, SelectItem } from '../chunk-
|
|
3
|
-
import '../chunk-
|
|
2
|
+
import { cn, checkedAccentClass, focusOutlineClass, linkTextClass, selectedBorderClass, selectedFillClass, fieldControlClass, ResultRoot, ResultField, FieldRenderer, ToggleGroup, ToggleGroupItem, selectedFillStrongClass, Switch, Select, SelectTrigger, SelectValue, SelectContent, SelectItem } from '../chunk-AZIUFSIQ.js';
|
|
3
|
+
import '../chunk-4VAO6BDE.js';
|
|
4
4
|
export { seedInputs } from '../chunk-VH5CDQDR.js';
|
|
5
5
|
import '../chunk-NSHGLM6A.js';
|
|
6
|
-
import '../chunk-
|
|
6
|
+
import '../chunk-56WECFBD.js';
|
|
7
7
|
import '../chunk-ZX52CQJ4.js';
|
|
8
|
-
import { isNativeValueNode, readDateContent, formatDateContent, isNativeHtmlNode, isNativeDateNode, isNativeCompositeNode } from '../chunk-
|
|
8
|
+
import { isNativeValueNode, readDateContent, formatDateContent, isNativeHtmlNode, isNativeDateNode, isNativeCompositeNode } from '../chunk-QQK6Y55E.js';
|
|
9
9
|
export { brandManifestSchema } from '../chunk-QFX332LE.js';
|
|
10
10
|
import '../chunk-ZB4RYUKV.js';
|
|
11
11
|
import '../chunk-FABY3DEY.js';
|