@ai-matrx/content-ir 0.19.20 → 0.19.25
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/CHANGELOG.md +28 -0
- package/dist/convert.cjs +139 -5
- package/dist/convert.cjs.map +1 -1
- package/dist/convert.d.cts +71 -2
- package/dist/convert.d.ts +71 -2
- package/dist/convert.js +133 -6
- package/dist/convert.js.map +1 -1
- package/dist/core.cjs +13 -23
- package/dist/core.cjs.map +1 -1
- package/dist/core.js +13 -23
- package/dist/core.js.map +1 -1
- package/dist/index.cjs +153 -28
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +146 -29
- package/dist/index.js.map +1 -1
- package/dist/registry.d.cts +1 -1
- package/dist/registry.d.ts +1 -1
- package/dist/session.cjs +13 -23
- package/dist/session.cjs.map +1 -1
- package/dist/session.js +13 -23
- package/dist/session.js.map +1 -1
- package/dist/source.cjs +1 -0
- package/dist/source.d.cts +9 -1
- package/dist/source.d.ts +9 -1
- package/dist/source.js +1 -1
- package/dist/wire.cjs.map +1 -1
- package/dist/wire.d.cts +2 -2
- package/dist/wire.d.ts +2 -2
- package/dist/wire.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -4,8 +4,8 @@ export { CompleteValueEnvelopeOptions, CompliantKindSnapshot, ContentRegionInit,
|
|
|
4
4
|
export { A as ArrayItemScalarType, F as FieldSchema, K as KIND_KEY, a as KindSchema, R as RecordValueType, S as ScalarFieldType, i as isJsonAnyField, b as isScalarArrayType, r as readObjectKind, s as scalarArrayItemType } from './kind-schema.types-CwncWj9U.cjs';
|
|
5
5
|
export { ParseSession, ParseSessionOptions, disposeParseSession, getParseSession, openParseSession } from './session.cjs';
|
|
6
6
|
export { DualGateDefinition, DualGateInput, DualGateResolvedComponent, DualGateResult, Json, KindBlockProps, KindDefinition, KindEdgeSpec, KindStorageError, KindStorageShape, KindTier, KindValidationResult, KindValidator, KindValidatorOptions, LegResult, ROOT_STORAGE_NAME, SchemaSourcePort, SchemaUnavailableReason, StoredFieldElement, createKindValidator, describeDualGateFailure, kindSchemaToStorage, runKindDualGate, storageToKindSchema, validateStructuralLeg } from './registry.cjs';
|
|
7
|
-
export { ArrayItemKindBinding, BlockSchemaDraft, ConversionProblem, DroppedMetadata, FieldComparison, ItemKindRefCheck, JsonSchemaNode, KindJsonSchemaExport, KindJsonSchemaOptions, KindSchemaFromJsonResult, SavePlanEntry, SavePlanValidation, SchemaConversionResult, buildAgentSchemaWithRenderBlockSupport, collectReferencedKinds, collectSchemaReferencedKinds, compareWithExistingKindSchema, convertAiSchemaToBlockFields, fieldsToDbPayload, injectKindIntoObjectSchema, isDuplicateBlockSlug, kindSchemaFromJsonSchema, kindSchemaToJsonSchema, normalizeAiSchemaInput, runSchemaConversion, validateBlockSchemaSavePlan } from './convert.cjs';
|
|
7
|
+
export { ArrayItemKindBinding, BlockSchemaDraft, CONTROL_KEYS, CONTROL_KEY_FIELDS, ControlKey, ControlKeysMode, ConversionProblem, DroppedMetadata, FieldComparison, ItemKindRefCheck, JsonSchemaNode, KindJsonSchemaExport, KindJsonSchemaOptions, KindSchemaFromJsonOptions, KindSchemaFromJsonResult, RECORD_DISPOSITION, SavePlanEntry, SavePlanValidation, SchemaConversionResult, WithControlKeysOptions, buildAgentSchemaWithRenderBlockSupport, collectReferencedKinds, collectSchemaReferencedKinds, compareWithExistingKindSchema, controlKeysApplyTo, convertAiSchemaToBlockFields, fieldsToDbPayload, injectKindIntoObjectSchema, isDuplicateBlockSlug, kindSchemaFromJsonSchema, kindSchemaToJsonSchema, normalizeAiSchemaInput, runSchemaConversion, stripControlKeys, validateBlockSchemaSavePlan, withControlKeyFields, withControlKeys } from './convert.cjs';
|
|
8
8
|
export { AnyPartialKindEvent, IR_PARTIAL_KEY, KindVerdict, NODE_OUTCOME_KIND, NodeOutcomeWrapper, PartialKindEvent, PartialKindNode, PartialKindState, RUN_RESULT_KIND, RetractedKindEvent, RunResultWrapper, SupersededKindEvent, advancePartialKind, emitPayloadFence, emitPayloadJson, isProvisionalKind, isTerminalKindEvent, kindVerdictOf, makePartialKindStalenessGate, readNodeOutcomeValue, readOutputRef, readPartialKindEvent, readRunResultValue, rehydrateNodeOutcome, rehydrateRunResult, sanitizeInboundPartialKindMetadata, withRootKind } from './wire.cjs';
|
|
9
9
|
export { ACTION_BY_CLASS, CAPABILITY_BY_CLASS, CLASSES, DIRECTIVE_VERSION, DecodedDirective, DirectiveCapability, DirectiveClass, DirectiveDecodeError, DirectiveDisplay, DirectiveItemKindLookup, DirectiveItemsEdge, DirectiveNounCatalog, DirectiveNounEntry, DirectiveSlug, IN_CONTENT_CLASSES, ItemFact, KindDirectiveShell, RESERVED_PREFIX, SIDE_EFFECT_CLASSES, SLUG_PREFIX, asKindInstance, buildDirectiveSlug, buildKindDirective, capabilityOf, decodeDirective, directiveDisplay, directiveItemKindFromEdges, directiveSlugOf, executesAtOutputRoot, isDirectiveClass, isKindDirective, isLegacyShell, isReservedDirectiveSlug, itemFacts, itemSubtitle, itemTitle, legacyShellUses, looksLikeDirectiveHead, nounFamily, nounLabel, nounTitleColumn, parseDirectiveSlug, resetLegacyShellUses, resolvesInContent, titleCaseToken, tryDecodeDirective, tryDecodeDirectiveContent } from './directives.cjs';
|
|
10
|
-
export { AFTER_WINDOW, BacktickRuns, BlockIslandType, CALLOUT_NAMES, CodePointIndex, CodeRange, DisturbedIsland, FENCE_OPENER_WHITESPACE, FENCE_WHITESPACE, FenceEnd, FenceLineKind, FenceLines, FenceOpener, FenceReader, InlineIslandType, InnerFenceLine, IslandMeta, IslandType, LinkDefinition, MapOptions, MappedPosition, MappedRange, NESTING_FENCE_LANGUAGES, ReadXmlTag, SourceBlock, SourceBlockKind, SourceChange, SourceEdit, SourceIsland, SourceSpan, SourceSpliceError, SourceSpliceErrorCode, SpliceIntegrity, SpliceOptions, SpliceResult, TokenizeOptions, XmlContainerTracker, blockAt, blockEdit, blockRangeEdit, buildCodePointIndex, classifyInnerFenceLine, closeFence, codeSpanText, collectLinkDefinitions, continuesTable, fenceLineKinds, fenceNestsInnerFences, fenceOpenerOf, fenceParts, findCodeRanges, findInlineCodeSpans, findLinkDefinitionLines, findTableEnd, findTableStart, isEscapedBracketMath, isGfmDelimiterRow, isHtmlBlockTagName, isMathPlaceholder, isPipeLedRow, isSingleDollarMath, islandEdit, joinSource, lineIndent, listIslands, looksLikeDisplayMath, looksLikeOpenInlineMath, mapCodeRanges, mapInlineCodeSpans, mapPosition, mapRange, normalizeLinkLabel, opensStrippedHtmlBlock, opensTable, pairDisplayMath, parseFenceOpener, pendingDisplayMathOpener, readXmlTag, resolveReferenceLinks, rowCells, singleDollarAfter, singleDollarMathEnd, spliceSave, splitRowSegments, splitsSurrogatePair, startsHtmlBlock, startsPipelessTable, tableContainerIndent, tableStartsAt, toCodePointOffset, toUtf16Offset, tokenizeSource, trimFenceLine, unescapeCellPipes } from './source.cjs';
|
|
10
|
+
export { AFTER_WINDOW, BacktickRuns, BlockIslandType, CALLOUT_NAMES, CodePointIndex, CodeRange, DisturbedIsland, FENCE_OPENER_WHITESPACE, FENCE_WHITESPACE, FenceEnd, FenceLineKind, FenceLines, FenceOpener, FenceReader, InlineIslandType, InnerFenceLine, IslandMeta, IslandType, LinkDefinition, MapOptions, MappedPosition, MappedRange, NESTING_FENCE_LANGUAGES, ReadXmlTag, SourceBlock, SourceBlockKind, SourceChange, SourceEdit, SourceIsland, SourceSpan, SourceSpliceError, SourceSpliceErrorCode, SpliceIntegrity, SpliceOptions, SpliceResult, TokenizeOptions, XmlContainerTracker, blockAt, blockEdit, blockRangeEdit, buildCodePointIndex, classifyInnerFenceLine, closeFence, codeSpanText, collectLinkDefinitions, continuesTable, fenceLineKinds, fenceNestsInnerFences, fenceOpenerOf, fenceParts, findCodeRanges, findInlineCodeSpans, findLinkDefinitionLines, findTableEnd, findTableStart, isEscapedBracketMath, isGfmDelimiterRow, isHtmlBlockTagName, isMathPlaceholder, isPipeLedRow, isSingleDollarMath, islandEdit, joinSource, lineIndent, listIslands, looksLikeDisplayMath, looksLikeOpenInlineMath, mapCodeRanges, mapInlineCodeSpans, mapPosition, mapRange, normalizeLinkLabel, opensStrippedHtmlBlock, opensTable, pairDisplayMath, parseFenceOpener, pendingCodeSpanStart, pendingDisplayMathOpener, readXmlTag, resolveReferenceLinks, rowCells, singleDollarAfter, singleDollarMathEnd, spliceSave, splitRowSegments, splitsSurrogatePair, startsHtmlBlock, startsPipelessTable, tableContainerIndent, tableStartsAt, toCodePointOffset, toUtf16Offset, tokenizeSource, trimFenceLine, unescapeCellPipes } from './source.cjs';
|
|
11
11
|
import 'react';
|
package/dist/index.d.ts
CHANGED
|
@@ -4,8 +4,8 @@ export { CompleteValueEnvelopeOptions, CompliantKindSnapshot, ContentRegionInit,
|
|
|
4
4
|
export { A as ArrayItemScalarType, F as FieldSchema, K as KIND_KEY, a as KindSchema, R as RecordValueType, S as ScalarFieldType, i as isJsonAnyField, b as isScalarArrayType, r as readObjectKind, s as scalarArrayItemType } from './kind-schema.types-CwncWj9U.js';
|
|
5
5
|
export { ParseSession, ParseSessionOptions, disposeParseSession, getParseSession, openParseSession } from './session.js';
|
|
6
6
|
export { DualGateDefinition, DualGateInput, DualGateResolvedComponent, DualGateResult, Json, KindBlockProps, KindDefinition, KindEdgeSpec, KindStorageError, KindStorageShape, KindTier, KindValidationResult, KindValidator, KindValidatorOptions, LegResult, ROOT_STORAGE_NAME, SchemaSourcePort, SchemaUnavailableReason, StoredFieldElement, createKindValidator, describeDualGateFailure, kindSchemaToStorage, runKindDualGate, storageToKindSchema, validateStructuralLeg } from './registry.js';
|
|
7
|
-
export { ArrayItemKindBinding, BlockSchemaDraft, ConversionProblem, DroppedMetadata, FieldComparison, ItemKindRefCheck, JsonSchemaNode, KindJsonSchemaExport, KindJsonSchemaOptions, KindSchemaFromJsonResult, SavePlanEntry, SavePlanValidation, SchemaConversionResult, buildAgentSchemaWithRenderBlockSupport, collectReferencedKinds, collectSchemaReferencedKinds, compareWithExistingKindSchema, convertAiSchemaToBlockFields, fieldsToDbPayload, injectKindIntoObjectSchema, isDuplicateBlockSlug, kindSchemaFromJsonSchema, kindSchemaToJsonSchema, normalizeAiSchemaInput, runSchemaConversion, validateBlockSchemaSavePlan } from './convert.js';
|
|
7
|
+
export { ArrayItemKindBinding, BlockSchemaDraft, CONTROL_KEYS, CONTROL_KEY_FIELDS, ControlKey, ControlKeysMode, ConversionProblem, DroppedMetadata, FieldComparison, ItemKindRefCheck, JsonSchemaNode, KindJsonSchemaExport, KindJsonSchemaOptions, KindSchemaFromJsonOptions, KindSchemaFromJsonResult, RECORD_DISPOSITION, SavePlanEntry, SavePlanValidation, SchemaConversionResult, WithControlKeysOptions, buildAgentSchemaWithRenderBlockSupport, collectReferencedKinds, collectSchemaReferencedKinds, compareWithExistingKindSchema, controlKeysApplyTo, convertAiSchemaToBlockFields, fieldsToDbPayload, injectKindIntoObjectSchema, isDuplicateBlockSlug, kindSchemaFromJsonSchema, kindSchemaToJsonSchema, normalizeAiSchemaInput, runSchemaConversion, stripControlKeys, validateBlockSchemaSavePlan, withControlKeyFields, withControlKeys } from './convert.js';
|
|
8
8
|
export { AnyPartialKindEvent, IR_PARTIAL_KEY, KindVerdict, NODE_OUTCOME_KIND, NodeOutcomeWrapper, PartialKindEvent, PartialKindNode, PartialKindState, RUN_RESULT_KIND, RetractedKindEvent, RunResultWrapper, SupersededKindEvent, advancePartialKind, emitPayloadFence, emitPayloadJson, isProvisionalKind, isTerminalKindEvent, kindVerdictOf, makePartialKindStalenessGate, readNodeOutcomeValue, readOutputRef, readPartialKindEvent, readRunResultValue, rehydrateNodeOutcome, rehydrateRunResult, sanitizeInboundPartialKindMetadata, withRootKind } from './wire.js';
|
|
9
9
|
export { ACTION_BY_CLASS, CAPABILITY_BY_CLASS, CLASSES, DIRECTIVE_VERSION, DecodedDirective, DirectiveCapability, DirectiveClass, DirectiveDecodeError, DirectiveDisplay, DirectiveItemKindLookup, DirectiveItemsEdge, DirectiveNounCatalog, DirectiveNounEntry, DirectiveSlug, IN_CONTENT_CLASSES, ItemFact, KindDirectiveShell, RESERVED_PREFIX, SIDE_EFFECT_CLASSES, SLUG_PREFIX, asKindInstance, buildDirectiveSlug, buildKindDirective, capabilityOf, decodeDirective, directiveDisplay, directiveItemKindFromEdges, directiveSlugOf, executesAtOutputRoot, isDirectiveClass, isKindDirective, isLegacyShell, isReservedDirectiveSlug, itemFacts, itemSubtitle, itemTitle, legacyShellUses, looksLikeDirectiveHead, nounFamily, nounLabel, nounTitleColumn, parseDirectiveSlug, resetLegacyShellUses, resolvesInContent, titleCaseToken, tryDecodeDirective, tryDecodeDirectiveContent } from './directives.js';
|
|
10
|
-
export { AFTER_WINDOW, BacktickRuns, BlockIslandType, CALLOUT_NAMES, CodePointIndex, CodeRange, DisturbedIsland, FENCE_OPENER_WHITESPACE, FENCE_WHITESPACE, FenceEnd, FenceLineKind, FenceLines, FenceOpener, FenceReader, InlineIslandType, InnerFenceLine, IslandMeta, IslandType, LinkDefinition, MapOptions, MappedPosition, MappedRange, NESTING_FENCE_LANGUAGES, ReadXmlTag, SourceBlock, SourceBlockKind, SourceChange, SourceEdit, SourceIsland, SourceSpan, SourceSpliceError, SourceSpliceErrorCode, SpliceIntegrity, SpliceOptions, SpliceResult, TokenizeOptions, XmlContainerTracker, blockAt, blockEdit, blockRangeEdit, buildCodePointIndex, classifyInnerFenceLine, closeFence, codeSpanText, collectLinkDefinitions, continuesTable, fenceLineKinds, fenceNestsInnerFences, fenceOpenerOf, fenceParts, findCodeRanges, findInlineCodeSpans, findLinkDefinitionLines, findTableEnd, findTableStart, isEscapedBracketMath, isGfmDelimiterRow, isHtmlBlockTagName, isMathPlaceholder, isPipeLedRow, isSingleDollarMath, islandEdit, joinSource, lineIndent, listIslands, looksLikeDisplayMath, looksLikeOpenInlineMath, mapCodeRanges, mapInlineCodeSpans, mapPosition, mapRange, normalizeLinkLabel, opensStrippedHtmlBlock, opensTable, pairDisplayMath, parseFenceOpener, pendingDisplayMathOpener, readXmlTag, resolveReferenceLinks, rowCells, singleDollarAfter, singleDollarMathEnd, spliceSave, splitRowSegments, splitsSurrogatePair, startsHtmlBlock, startsPipelessTable, tableContainerIndent, tableStartsAt, toCodePointOffset, toUtf16Offset, tokenizeSource, trimFenceLine, unescapeCellPipes } from './source.js';
|
|
10
|
+
export { AFTER_WINDOW, BacktickRuns, BlockIslandType, CALLOUT_NAMES, CodePointIndex, CodeRange, DisturbedIsland, FENCE_OPENER_WHITESPACE, FENCE_WHITESPACE, FenceEnd, FenceLineKind, FenceLines, FenceOpener, FenceReader, InlineIslandType, InnerFenceLine, IslandMeta, IslandType, LinkDefinition, MapOptions, MappedPosition, MappedRange, NESTING_FENCE_LANGUAGES, ReadXmlTag, SourceBlock, SourceBlockKind, SourceChange, SourceEdit, SourceIsland, SourceSpan, SourceSpliceError, SourceSpliceErrorCode, SpliceIntegrity, SpliceOptions, SpliceResult, TokenizeOptions, XmlContainerTracker, blockAt, blockEdit, blockRangeEdit, buildCodePointIndex, classifyInnerFenceLine, closeFence, codeSpanText, collectLinkDefinitions, continuesTable, fenceLineKinds, fenceNestsInnerFences, fenceOpenerOf, fenceParts, findCodeRanges, findInlineCodeSpans, findLinkDefinitionLines, findTableEnd, findTableStart, isEscapedBracketMath, isGfmDelimiterRow, isHtmlBlockTagName, isMathPlaceholder, isPipeLedRow, isSingleDollarMath, islandEdit, joinSource, lineIndent, listIslands, looksLikeDisplayMath, looksLikeOpenInlineMath, mapCodeRanges, mapInlineCodeSpans, mapPosition, mapRange, normalizeLinkLabel, opensStrippedHtmlBlock, opensTable, pairDisplayMath, parseFenceOpener, pendingCodeSpanStart, pendingDisplayMathOpener, readXmlTag, resolveReferenceLinks, rowCells, singleDollarAfter, singleDollarMathEnd, spliceSave, splitRowSegments, splitsSurrogatePair, startsHtmlBlock, startsPipelessTable, tableContainerIndent, tableStartsAt, toCodePointOffset, toUtf16Offset, tokenizeSource, trimFenceLine, unescapeCellPipes } from './source.js';
|
|
11
11
|
import 'react';
|
package/dist/index.js
CHANGED
|
@@ -1268,7 +1268,7 @@ var KindStreamParser = class {
|
|
|
1268
1268
|
}
|
|
1269
1269
|
if (!declaredKind2 && committedKind && this.speculativeKinds.has(pathKey)) {
|
|
1270
1270
|
this.speculativeKinds.delete(pathKey);
|
|
1271
|
-
this.finalizeSpeculatedObject(path, objectValue, committedKind, at);
|
|
1271
|
+
this.finalizeSpeculatedObject(path, objectValue, committedKind, at, true);
|
|
1272
1272
|
return;
|
|
1273
1273
|
}
|
|
1274
1274
|
if (path.length === 0 && !declaredKind2 && !committedKind && this.rootSurfaceKind) {
|
|
@@ -1346,7 +1346,7 @@ var KindStreamParser = class {
|
|
|
1346
1346
|
});
|
|
1347
1347
|
}
|
|
1348
1348
|
/** Validate + complete an object typed purely by parent prediction. */
|
|
1349
|
-
finalizeSpeculatedObject(path, objectValue, kind, at) {
|
|
1349
|
+
finalizeSpeculatedObject(path, objectValue, kind, at, requireSharedField = false) {
|
|
1350
1350
|
const schema = this.lookupSchema(kind);
|
|
1351
1351
|
if (!schema) {
|
|
1352
1352
|
this.emitRawObject(
|
|
@@ -1359,6 +1359,15 @@ var KindStreamParser = class {
|
|
|
1359
1359
|
);
|
|
1360
1360
|
return;
|
|
1361
1361
|
}
|
|
1362
|
+
if (requireSharedField && !Object.keys(objectValue).some((key) => key in schema.fields)) {
|
|
1363
|
+
this.emitRawObject(
|
|
1364
|
+
path,
|
|
1365
|
+
objectValue,
|
|
1366
|
+
`Object carries none of "${kind}"'s fields.`,
|
|
1367
|
+
at
|
|
1368
|
+
);
|
|
1369
|
+
return;
|
|
1370
|
+
}
|
|
1362
1371
|
const outcome = this.validateObjectAgainstSchema(
|
|
1363
1372
|
{ ...objectValue, [KIND_KEY]: kind },
|
|
1364
1373
|
schema
|
|
@@ -1619,16 +1628,7 @@ var KindStreamParser = class {
|
|
|
1619
1628
|
...emptyOutcome
|
|
1620
1629
|
};
|
|
1621
1630
|
}
|
|
1622
|
-
for (const
|
|
1623
|
-
if (fieldSchema.required) {
|
|
1624
|
-
if (!(fieldName in objectValue)) {
|
|
1625
|
-
return {
|
|
1626
|
-
error: `Kind "${schema.kind}" is missing required field "${fieldName}".`,
|
|
1627
|
-
...emptyOutcome
|
|
1628
|
-
};
|
|
1629
|
-
}
|
|
1630
|
-
continue;
|
|
1631
|
-
}
|
|
1631
|
+
for (const fieldName of Object.keys(schema.fields)) {
|
|
1632
1632
|
if (!(fieldName in objectValue)) {
|
|
1633
1633
|
optionalMissing.push(fieldName);
|
|
1634
1634
|
}
|
|
@@ -1835,17 +1835,7 @@ var KindStreamParser = class {
|
|
|
1835
1835
|
validateObjectAgainstFields(objectValue, fields) {
|
|
1836
1836
|
const optionalMissing = [];
|
|
1837
1837
|
const extraFields = [];
|
|
1838
|
-
const
|
|
1839
|
-
for (const [fieldName, fieldSchema] of Object.entries(fields)) {
|
|
1840
|
-
if (fieldSchema.required) {
|
|
1841
|
-
if (!(fieldName in objectValue)) {
|
|
1842
|
-
return {
|
|
1843
|
-
error: `Inline object is missing required field "${fieldName}".`,
|
|
1844
|
-
...emptyOutcome
|
|
1845
|
-
};
|
|
1846
|
-
}
|
|
1847
|
-
continue;
|
|
1848
|
-
}
|
|
1838
|
+
for (const fieldName of Object.keys(fields)) {
|
|
1849
1839
|
if (!(fieldName in objectValue)) {
|
|
1850
1840
|
optionalMissing.push(fieldName);
|
|
1851
1841
|
}
|
|
@@ -3192,13 +3182,13 @@ function makeKindJsonSchemaProperty(kindSlug, strict) {
|
|
|
3192
3182
|
return { ...base2, enum: [kindSlug] };
|
|
3193
3183
|
}
|
|
3194
3184
|
function injectKindIntoObjectSchema(objectSchema, kindSlug, strict) {
|
|
3195
|
-
const
|
|
3196
|
-
const properties = isRecord4(
|
|
3185
|
+
const clone2 = deepClone(objectSchema);
|
|
3186
|
+
const properties = isRecord4(clone2.properties) ? { ...clone2.properties } : {};
|
|
3197
3187
|
properties[KIND_KEY] = makeKindJsonSchemaProperty(kindSlug, strict);
|
|
3198
|
-
const required = Array.isArray(
|
|
3188
|
+
const required = Array.isArray(clone2.required) ? clone2.required.filter((k) => typeof k === "string") : [];
|
|
3199
3189
|
const nextRequired = required.includes(KIND_KEY) ? required : [KIND_KEY, ...required];
|
|
3200
3190
|
return {
|
|
3201
|
-
...
|
|
3191
|
+
...clone2,
|
|
3202
3192
|
properties,
|
|
3203
3193
|
required: nextRequired,
|
|
3204
3194
|
...strict ? { additionalProperties: false } : {}
|
|
@@ -4395,8 +4385,132 @@ function kindSchemaToJsonSchema(kind, resolve, options = {}) {
|
|
|
4395
4385
|
return { name: kind, schema: { ...rootNode, $defs: defs }, strict, unresolved };
|
|
4396
4386
|
}
|
|
4397
4387
|
|
|
4388
|
+
// convert/control-keys.ts
|
|
4389
|
+
var CONTROL_KEYS = ["_replaces", "_new", "_record_id", "_records"];
|
|
4390
|
+
var RECORD_DISPOSITION = "record";
|
|
4391
|
+
var KIND_KEY2 = "__kind";
|
|
4392
|
+
var DOCUMENT_KEYS = /* @__PURE__ */ new Set(["$schema", "$id", "$defs", "definitions", "title", "description"]);
|
|
4393
|
+
var CONTROL = new Set(CONTROL_KEYS);
|
|
4394
|
+
function controlKeysApplyTo(disposition) {
|
|
4395
|
+
return disposition === RECORD_DISPOSITION;
|
|
4396
|
+
}
|
|
4397
|
+
function clone(value) {
|
|
4398
|
+
return value === void 0 ? value : JSON.parse(JSON.stringify(value));
|
|
4399
|
+
}
|
|
4400
|
+
function isObjectSchema(schema) {
|
|
4401
|
+
if (!schema || typeof schema !== "object" || Array.isArray(schema)) return false;
|
|
4402
|
+
const s = schema;
|
|
4403
|
+
return s.type === "object" && !!s.properties && typeof s.properties === "object" && !Array.isArray(s.properties);
|
|
4404
|
+
}
|
|
4405
|
+
function requiredOf(schema) {
|
|
4406
|
+
return Array.isArray(schema.required) ? schema.required : [];
|
|
4407
|
+
}
|
|
4408
|
+
function recordObject(schema) {
|
|
4409
|
+
const item = {};
|
|
4410
|
+
for (const [k, v] of Object.entries(schema)) {
|
|
4411
|
+
if (!DOCUMENT_KEYS.has(k)) item[k] = clone(v);
|
|
4412
|
+
}
|
|
4413
|
+
const props = {};
|
|
4414
|
+
for (const [k, v] of Object.entries(item.properties)) {
|
|
4415
|
+
if (k !== KIND_KEY2 && !CONTROL.has(k)) props[k] = v;
|
|
4416
|
+
}
|
|
4417
|
+
item.properties = props;
|
|
4418
|
+
const required = requiredOf(item).filter((k) => k !== KIND_KEY2 && !CONTROL.has(k));
|
|
4419
|
+
if (required.length > 0) item.required = required;
|
|
4420
|
+
else delete item.required;
|
|
4421
|
+
return item;
|
|
4422
|
+
}
|
|
4423
|
+
function stored(schema) {
|
|
4424
|
+
const out = clone(schema);
|
|
4425
|
+
const item = recordObject(schema);
|
|
4426
|
+
const props = out.properties;
|
|
4427
|
+
props._replaces = { type: ["string", "null"], format: "uuid" };
|
|
4428
|
+
props._new = { type: ["boolean", "null"] };
|
|
4429
|
+
props._record_id = { type: ["string", "null"], format: "uuid" };
|
|
4430
|
+
props._records = { type: ["array", "null"], items: item };
|
|
4431
|
+
const rootRequired = requiredOf(out).filter((k) => !CONTROL.has(k));
|
|
4432
|
+
const lifted = rootRequired.filter((k) => k !== KIND_KEY2);
|
|
4433
|
+
if (lifted.length > 0) {
|
|
4434
|
+
const kept = rootRequired.filter((k) => k === KIND_KEY2);
|
|
4435
|
+
if (kept.length > 0) out.required = kept;
|
|
4436
|
+
else delete out.required;
|
|
4437
|
+
const branch = {
|
|
4438
|
+
if: {
|
|
4439
|
+
anyOf: [
|
|
4440
|
+
{ required: ["_record_id"], properties: { _record_id: { type: "string" } } },
|
|
4441
|
+
{ required: ["_records"], properties: { _records: { type: "array" } } }
|
|
4442
|
+
]
|
|
4443
|
+
},
|
|
4444
|
+
else: { required: lifted }
|
|
4445
|
+
};
|
|
4446
|
+
out.allOf = Array.isArray(out.allOf) ? [...out.allOf, branch] : [branch];
|
|
4447
|
+
}
|
|
4448
|
+
return out;
|
|
4449
|
+
}
|
|
4450
|
+
function authored(schema, many, allowEdit) {
|
|
4451
|
+
const signals = {
|
|
4452
|
+
_replaces: { type: "string", format: "uuid" },
|
|
4453
|
+
_new: { type: "boolean" }
|
|
4454
|
+
};
|
|
4455
|
+
if (allowEdit) signals._record_id = { type: "string", format: "uuid" };
|
|
4456
|
+
if (!many) {
|
|
4457
|
+
const out2 = clone(schema);
|
|
4458
|
+
Object.assign(out2.properties, clone(signals));
|
|
4459
|
+
const required = requiredOf(out2).filter((k) => !CONTROL.has(k));
|
|
4460
|
+
if (required.length > 0 || "required" in out2) out2.required = required;
|
|
4461
|
+
return out2;
|
|
4462
|
+
}
|
|
4463
|
+
const out = {};
|
|
4464
|
+
for (const [k, v] of Object.entries(schema)) {
|
|
4465
|
+
if (DOCUMENT_KEYS.has(k)) out[k] = clone(v);
|
|
4466
|
+
}
|
|
4467
|
+
out.type = "object";
|
|
4468
|
+
const kindProp = schema.properties[KIND_KEY2];
|
|
4469
|
+
const properties = {};
|
|
4470
|
+
if (kindProp !== void 0) properties[KIND_KEY2] = clone(kindProp);
|
|
4471
|
+
properties._records = { type: "array", items: recordObject(schema) };
|
|
4472
|
+
Object.assign(properties, clone(signals));
|
|
4473
|
+
out.properties = properties;
|
|
4474
|
+
out.required = [KIND_KEY2, "_records"].filter((k) => k in properties);
|
|
4475
|
+
out.additionalProperties = false;
|
|
4476
|
+
return out;
|
|
4477
|
+
}
|
|
4478
|
+
function withControlKeys(schema, options) {
|
|
4479
|
+
const { mode, many = false, allowEdit = false } = options;
|
|
4480
|
+
if (mode !== "stored" && mode !== "authored") {
|
|
4481
|
+
throw new Error(`withControlKeys: mode must be "stored" or "authored", got ${String(mode)}`);
|
|
4482
|
+
}
|
|
4483
|
+
if (!isObjectSchema(schema)) return schema;
|
|
4484
|
+
return mode === "stored" ? stored(schema) : authored(schema, many, allowEdit);
|
|
4485
|
+
}
|
|
4486
|
+
var CONTROL_KEY_FIELDS = Object.freeze({
|
|
4487
|
+
_replaces: { type: "string", nullable: true },
|
|
4488
|
+
_new: { type: "boolean", nullable: true },
|
|
4489
|
+
_record_id: { type: "string", nullable: true },
|
|
4490
|
+
// A batch's items are records of this kind WITHOUT `__kind`; the render layer reads them
|
|
4491
|
+
// as opaque JSON (never stricter than the store, which validates each item).
|
|
4492
|
+
_records: { type: "json[]", nullable: true }
|
|
4493
|
+
});
|
|
4494
|
+
function withControlKeyFields(schema) {
|
|
4495
|
+
if (schema.root) return schema;
|
|
4496
|
+
const fields = { ...schema.fields };
|
|
4497
|
+
for (const key of CONTROL_KEYS) {
|
|
4498
|
+
if (!(key in fields)) fields[key] = { ...CONTROL_KEY_FIELDS[key] };
|
|
4499
|
+
}
|
|
4500
|
+
return { ...schema, fields };
|
|
4501
|
+
}
|
|
4502
|
+
function stripControlKeys(value) {
|
|
4503
|
+
const values = {};
|
|
4504
|
+
const signals = {};
|
|
4505
|
+
for (const [k, v] of Object.entries(value)) {
|
|
4506
|
+
if (CONTROL.has(k)) signals[k] = v;
|
|
4507
|
+
else values[k] = v;
|
|
4508
|
+
}
|
|
4509
|
+
return { values, signals };
|
|
4510
|
+
}
|
|
4511
|
+
|
|
4398
4512
|
// convert/json-schema-to-kind.ts
|
|
4399
|
-
function kindSchemaFromJsonSchema(kind, jsonSchema) {
|
|
4513
|
+
function kindSchemaFromJsonSchema(kind, jsonSchema, options = {}) {
|
|
4400
4514
|
if (jsonSchema === null || jsonSchema === void 0) {
|
|
4401
4515
|
return { schema: null, children: {}, problems: [] };
|
|
4402
4516
|
}
|
|
@@ -4427,6 +4541,9 @@ function kindSchemaFromJsonSchema(kind, jsonSchema) {
|
|
|
4427
4541
|
if (draft.slug === kind) schema = asKindSchema;
|
|
4428
4542
|
else children[draft.slug] = asKindSchema;
|
|
4429
4543
|
}
|
|
4544
|
+
if (schema && controlKeysApplyTo(options.disposition)) {
|
|
4545
|
+
schema = withControlKeyFields(schema);
|
|
4546
|
+
}
|
|
4430
4547
|
return { schema, children, problems: converted.problems };
|
|
4431
4548
|
}
|
|
4432
4549
|
|
|
@@ -7931,6 +8048,6 @@ function resolveReferenceLinks(fragment, defs) {
|
|
|
7931
8048
|
return resolved.replace(new RegExp(`${PLACEHOLDER}(\\d+)${PLACEHOLDER}`, "g"), (_m, i) => spans[Number(i)] ?? "");
|
|
7932
8049
|
}
|
|
7933
8050
|
|
|
7934
|
-
export { ACTION_BY_CLASS, AFTER_WINDOW, BacktickRuns, CALLOUT_NAMES, CAPABILITY_BY_CLASS, CLASSES, DIRECTIVE_VERSION, DirectiveDecodeError, FENCE_OPENER_WHITESPACE, FENCE_WHITESPACE, FenceReader, IN_CONTENT_CLASSES, IR_ENVELOPE_CACHE_VERSION, IR_ENVELOPE_KEY, IR_PARTIAL_KEY, IR_VERSION, IrTree, JSON_DISCRIMINATOR, JsonStreamTokenizer, KIND_KEY, KindStorageError, KindStreamParser, NESTING_FENCE_LANGUAGES, NODE_OUTCOME_KIND, ParseSession, RESERVED_PREFIX, ROOT_STORAGE_NAME, RUN_RESULT_KIND, SIDE_EFFECT_CLASSES, SLUG_PREFIX, SourceSpliceError, XmlContainerTracker, advancePartialKind, asKindInstance, blockAt, blockEdit, blockRangeEdit, buildAgentSchemaWithRenderBlockSupport, buildCodePointIndex, buildCompliantKindSnapshot, buildDirectiveSlug, buildKindDirective, capabilityOf, classifyInboundEnvelopeMetadata, classifyInnerFenceLine, closeFence, codeSpanText, collectLinkDefinitions, collectReferencedKinds, collectSchemaReferencedKinds, compareWithExistingKindSchema, continuesTable, convertAiSchemaToBlockFields, createFingerprinter, createKindStreamParser, createKindValidator, decodeDirective, describeDualGateFailure, directiveDisplay, directiveItemKindFromEdges, directiveSlugOf, disposeParseSession, emitPayloadFence, emitPayloadJson, emptyValueForFieldSchema, envelopeCacheFromEnvelopes, envelopeFromCompleteValue, executesAtOutputRoot, fenceDiscriminator, fenceLineKinds, fenceNestsInnerFences, fenceOpenerOf, fenceParts, fieldsToDbPayload, findCodeRanges, findInlineCodeSpans, findLinkDefinitionLines, findTableEnd, findTableStart, fingerprintText, formatBlockLabel, getParseSession, injectKindIntoObjectSchema, irPathIsUnderOrEqual, irPathKey, irPathLabel, irPathsEqual, isCanonicalBlockIR, isDirectiveClass, isDuplicateBlockSlug, isEmptyResidue, isEscapedBracketMath, isGfmDelimiterRow, isHtmlBlockTagName, isIrEnvelopeCache, isJsonAnyField, isKindDirective, isLegacyShell, isMathPlaceholder, isPipeLedRow, isProvisionalKind, isReservedDirectiveSlug, isScalarArrayType, isSingleDollarMath, isTerminalKindEvent, islandEdit, itemFacts, itemSubtitle, itemTitle, joinSource, kindSchemaFromJsonSchema, kindSchemaToJsonSchema, kindSchemaToStorage, kindVerdictOf, legacyShellUses, lineIndent, listIslands, looksLikeDirectiveHead, looksLikeDisplayMath, looksLikeOpenInlineMath, makePartialKindStalenessGate, mapCodeRanges, mapInlineCodeSpans, mapPosition, mapRange, mergeResidueIntoValue, normalizeAiSchemaInput, normalizeJsonRegion, normalizeLinkLabel, nounFamily, nounLabel, nounTitleColumn, openParseSession, opensStrippedHtmlBlock, opensTable, pairDisplayMath, parseDirectiveSlug, parseFenceOpener, pendingDisplayMathOpener, readEnvelope, readNodeOutcomeValue, readObjectKind, readOutputRef, readPartialKindEvent, readRunResultValue, readXmlTag, reconstructRegionValue, rehydrateNodeOutcome, rehydrateRunResult, resetLegacyShellUses, resolveReferenceLinks, resolvesInContent, reuseEnvelopeIfCurrent, rowCells, runKindDualGate, runSchemaConversion, sanitizeInboundEnvelopeMetadata, sanitizeInboundPartialKindMetadata, scalarArrayItemType, schemaLayoutMode, schemaStructureDepth, setJsonRootKeyLookup, singleDollarAfter, singleDollarMathEnd, spliceSave, splitRowSegments, splitsSurrogatePair, startsHtmlBlock, startsPipelessTable, storageToKindSchema, stripKindDeep, tableContainerIndent, tableStartsAt, titleCaseToken, toCodePointOffset, toUtf16Offset, tokenizeSource, trimFenceLine, tryDecodeDirective, tryDecodeDirectiveContent, unescapeCellPipes, validateBlockSchemaSavePlan, validateStructuralLeg, withRootKind, xmlDiscriminator };
|
|
8051
|
+
export { ACTION_BY_CLASS, AFTER_WINDOW, BacktickRuns, CALLOUT_NAMES, CAPABILITY_BY_CLASS, CLASSES, CONTROL_KEYS, CONTROL_KEY_FIELDS, DIRECTIVE_VERSION, DirectiveDecodeError, FENCE_OPENER_WHITESPACE, FENCE_WHITESPACE, FenceReader, IN_CONTENT_CLASSES, IR_ENVELOPE_CACHE_VERSION, IR_ENVELOPE_KEY, IR_PARTIAL_KEY, IR_VERSION, IrTree, JSON_DISCRIMINATOR, JsonStreamTokenizer, KIND_KEY, KindStorageError, KindStreamParser, NESTING_FENCE_LANGUAGES, NODE_OUTCOME_KIND, ParseSession, RECORD_DISPOSITION, RESERVED_PREFIX, ROOT_STORAGE_NAME, RUN_RESULT_KIND, SIDE_EFFECT_CLASSES, SLUG_PREFIX, SourceSpliceError, XmlContainerTracker, advancePartialKind, asKindInstance, blockAt, blockEdit, blockRangeEdit, buildAgentSchemaWithRenderBlockSupport, buildCodePointIndex, buildCompliantKindSnapshot, buildDirectiveSlug, buildKindDirective, capabilityOf, classifyInboundEnvelopeMetadata, classifyInnerFenceLine, closeFence, codeSpanText, collectLinkDefinitions, collectReferencedKinds, collectSchemaReferencedKinds, compareWithExistingKindSchema, continuesTable, controlKeysApplyTo, convertAiSchemaToBlockFields, createFingerprinter, createKindStreamParser, createKindValidator, decodeDirective, describeDualGateFailure, directiveDisplay, directiveItemKindFromEdges, directiveSlugOf, disposeParseSession, emitPayloadFence, emitPayloadJson, emptyValueForFieldSchema, envelopeCacheFromEnvelopes, envelopeFromCompleteValue, executesAtOutputRoot, fenceDiscriminator, fenceLineKinds, fenceNestsInnerFences, fenceOpenerOf, fenceParts, fieldsToDbPayload, findCodeRanges, findInlineCodeSpans, findLinkDefinitionLines, findTableEnd, findTableStart, fingerprintText, formatBlockLabel, getParseSession, injectKindIntoObjectSchema, irPathIsUnderOrEqual, irPathKey, irPathLabel, irPathsEqual, isCanonicalBlockIR, isDirectiveClass, isDuplicateBlockSlug, isEmptyResidue, isEscapedBracketMath, isGfmDelimiterRow, isHtmlBlockTagName, isIrEnvelopeCache, isJsonAnyField, isKindDirective, isLegacyShell, isMathPlaceholder, isPipeLedRow, isProvisionalKind, isReservedDirectiveSlug, isScalarArrayType, isSingleDollarMath, isTerminalKindEvent, islandEdit, itemFacts, itemSubtitle, itemTitle, joinSource, kindSchemaFromJsonSchema, kindSchemaToJsonSchema, kindSchemaToStorage, kindVerdictOf, legacyShellUses, lineIndent, listIslands, looksLikeDirectiveHead, looksLikeDisplayMath, looksLikeOpenInlineMath, makePartialKindStalenessGate, mapCodeRanges, mapInlineCodeSpans, mapPosition, mapRange, mergeResidueIntoValue, normalizeAiSchemaInput, normalizeJsonRegion, normalizeLinkLabel, nounFamily, nounLabel, nounTitleColumn, openParseSession, opensStrippedHtmlBlock, opensTable, pairDisplayMath, parseDirectiveSlug, parseFenceOpener, pendingCodeSpanStart, pendingDisplayMathOpener, readEnvelope, readNodeOutcomeValue, readObjectKind, readOutputRef, readPartialKindEvent, readRunResultValue, readXmlTag, reconstructRegionValue, rehydrateNodeOutcome, rehydrateRunResult, resetLegacyShellUses, resolveReferenceLinks, resolvesInContent, reuseEnvelopeIfCurrent, rowCells, runKindDualGate, runSchemaConversion, sanitizeInboundEnvelopeMetadata, sanitizeInboundPartialKindMetadata, scalarArrayItemType, schemaLayoutMode, schemaStructureDepth, setJsonRootKeyLookup, singleDollarAfter, singleDollarMathEnd, spliceSave, splitRowSegments, splitsSurrogatePair, startsHtmlBlock, startsPipelessTable, storageToKindSchema, stripControlKeys, stripKindDeep, tableContainerIndent, tableStartsAt, titleCaseToken, toCodePointOffset, toUtf16Offset, tokenizeSource, trimFenceLine, tryDecodeDirective, tryDecodeDirectiveContent, unescapeCellPipes, validateBlockSchemaSavePlan, validateStructuralLeg, withControlKeyFields, withControlKeys, withRootKind, xmlDiscriminator };
|
|
7935
8052
|
//# sourceMappingURL=index.js.map
|
|
7936
8053
|
//# sourceMappingURL=index.js.map
|