@ai-matrx/content-ir 0.22.5 → 0.22.7
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 +12 -0
- package/dist/convert.cjs +33 -2
- package/dist/convert.cjs.map +1 -1
- package/dist/convert.js +33 -2
- package/dist/convert.js.map +1 -1
- package/dist/index.cjs +39 -8
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +39 -8
- package/dist/index.js.map +1 -1
- package/dist/source.cjs +6 -6
- package/dist/source.cjs.map +1 -1
- package/dist/source.d.cts +4 -4
- package/dist/source.d.ts +4 -4
- package/dist/source.js +6 -6
- package/dist/source.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -3296,7 +3296,7 @@ function buildAgentSchemaWithRenderBlockSupport(input, rootKindSlug, arrayBindin
|
|
|
3296
3296
|
}
|
|
3297
3297
|
function resolveRef(ref, ctx) {
|
|
3298
3298
|
if (ref === "#" || ref === "#/") {
|
|
3299
|
-
return { slug: ctx.schemaName, node: ctx.rootSchema };
|
|
3299
|
+
return { slug: ctx.schemaName, node: ctx.rootSchema, declaresKind: true };
|
|
3300
3300
|
}
|
|
3301
3301
|
const match = /^#\/(?:\$defs|definitions)\/(.+)$/.exec(ref);
|
|
3302
3302
|
if (!match) return null;
|
|
@@ -3306,7 +3306,11 @@ function resolveRef(ref, ctx) {
|
|
|
3306
3306
|
const node = ctx.defs[name];
|
|
3307
3307
|
if (!isRecord4(node)) return null;
|
|
3308
3308
|
const declared = isRecord4(node.properties) ? readBlockKindFromProperties(node.properties) : null;
|
|
3309
|
-
return { slug: declared ?? name, node };
|
|
3309
|
+
return { slug: declared ?? name, node, declaresKind: declared !== null };
|
|
3310
|
+
}
|
|
3311
|
+
function inlineRefNode(refNode, resolved) {
|
|
3312
|
+
const { $ref: _ref, ...beside } = refNode;
|
|
3313
|
+
return { ...resolved.node, ...beside };
|
|
3310
3314
|
}
|
|
3311
3315
|
function refToObjectField(resolved, path, ctx) {
|
|
3312
3316
|
if (ctx.refsInProgress.has(resolved.slug)) return;
|
|
@@ -3376,6 +3380,29 @@ function convertPropertyCore(fieldName, node, required, path, ctx) {
|
|
|
3376
3380
|
});
|
|
3377
3381
|
return null;
|
|
3378
3382
|
}
|
|
3383
|
+
if (!resolved.declaresKind) {
|
|
3384
|
+
const guard = `$def:${node.$ref}`;
|
|
3385
|
+
if (ctx.refsInProgress.has(guard)) {
|
|
3386
|
+
ctx.problems.push({
|
|
3387
|
+
severity: "info",
|
|
3388
|
+
path,
|
|
3389
|
+
message: `Self-referencing structure "${node.$ref}" \u2014 carried as any JSON value (json).`
|
|
3390
|
+
});
|
|
3391
|
+
return { ...requiredNullableFlags(required), type: "json" };
|
|
3392
|
+
}
|
|
3393
|
+
ctx.refsInProgress.add(guard);
|
|
3394
|
+
try {
|
|
3395
|
+
return convertPropertyCore(
|
|
3396
|
+
fieldName,
|
|
3397
|
+
inlineRefNode(node, resolved),
|
|
3398
|
+
required,
|
|
3399
|
+
path,
|
|
3400
|
+
ctx
|
|
3401
|
+
);
|
|
3402
|
+
} finally {
|
|
3403
|
+
ctx.refsInProgress.delete(guard);
|
|
3404
|
+
}
|
|
3405
|
+
}
|
|
3379
3406
|
refToObjectField(resolved, path, ctx);
|
|
3380
3407
|
return {
|
|
3381
3408
|
...requiredNullableFlags(required),
|
|
@@ -3407,6 +3434,10 @@ function convertPropertyCore(fieldName, node, required, path, ctx) {
|
|
|
3407
3434
|
unsupported = true;
|
|
3408
3435
|
continue;
|
|
3409
3436
|
}
|
|
3437
|
+
if (!resolvedVariant.declaresKind) {
|
|
3438
|
+
anonymousObjects.push(inlineRefNode(variant, resolvedVariant));
|
|
3439
|
+
continue;
|
|
3440
|
+
}
|
|
3410
3441
|
refToObjectField(resolvedVariant, path, ctx);
|
|
3411
3442
|
memberKinds.push(resolvedVariant.slug);
|
|
3412
3443
|
continue;
|
|
@@ -6407,6 +6438,12 @@ function findTableEnd(lines, start) {
|
|
|
6407
6438
|
while (end < lines.length && continuesTable(lines[end] ?? "", container)) end += 1;
|
|
6408
6439
|
return end;
|
|
6409
6440
|
}
|
|
6441
|
+
function startsLikeTableRow(line) {
|
|
6442
|
+
return /^\s*\|/.test(line);
|
|
6443
|
+
}
|
|
6444
|
+
function isGrowingDelimiterRow(line) {
|
|
6445
|
+
return /^[\s|:-]*-[\s|:-]*$/.test(line);
|
|
6446
|
+
}
|
|
6410
6447
|
|
|
6411
6448
|
// source/tokenize.ts
|
|
6412
6449
|
var QUOTE_PREFIX = /^ {0,3}>(?: ?>)* ?/;
|
|
@@ -8485,12 +8522,6 @@ function findWholeTableStart(lines, from = 0) {
|
|
|
8485
8522
|
for (let i = Math.max(0, from); i + 1 < lines.length; i += 1) if (tableStartsAt(lines, i)) return i;
|
|
8486
8523
|
return -1;
|
|
8487
8524
|
}
|
|
8488
|
-
function startsLikeTableRow(line) {
|
|
8489
|
-
return /^\s*\|/.test(line);
|
|
8490
|
-
}
|
|
8491
|
-
function isGrowingDelimiterRow(line) {
|
|
8492
|
-
return /^[\s|:-]*-[\s|:-]*$/.test(line);
|
|
8493
|
-
}
|
|
8494
8525
|
function trailingTableStart(lines, end = lines.length) {
|
|
8495
8526
|
const isTableLine = (line) => startsLikeTableRow(line) || continuesTable(line.trimStart());
|
|
8496
8527
|
let start = end;
|