@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.js
CHANGED
|
@@ -3290,7 +3290,7 @@ function buildAgentSchemaWithRenderBlockSupport(input, rootKindSlug, arrayBindin
|
|
|
3290
3290
|
}
|
|
3291
3291
|
function resolveRef(ref, ctx) {
|
|
3292
3292
|
if (ref === "#" || ref === "#/") {
|
|
3293
|
-
return { slug: ctx.schemaName, node: ctx.rootSchema };
|
|
3293
|
+
return { slug: ctx.schemaName, node: ctx.rootSchema, declaresKind: true };
|
|
3294
3294
|
}
|
|
3295
3295
|
const match = /^#\/(?:\$defs|definitions)\/(.+)$/.exec(ref);
|
|
3296
3296
|
if (!match) return null;
|
|
@@ -3300,7 +3300,11 @@ function resolveRef(ref, ctx) {
|
|
|
3300
3300
|
const node = ctx.defs[name];
|
|
3301
3301
|
if (!isRecord4(node)) return null;
|
|
3302
3302
|
const declared = isRecord4(node.properties) ? readBlockKindFromProperties(node.properties) : null;
|
|
3303
|
-
return { slug: declared ?? name, node };
|
|
3303
|
+
return { slug: declared ?? name, node, declaresKind: declared !== null };
|
|
3304
|
+
}
|
|
3305
|
+
function inlineRefNode(refNode, resolved) {
|
|
3306
|
+
const { $ref: _ref, ...beside } = refNode;
|
|
3307
|
+
return { ...resolved.node, ...beside };
|
|
3304
3308
|
}
|
|
3305
3309
|
function refToObjectField(resolved, path, ctx) {
|
|
3306
3310
|
if (ctx.refsInProgress.has(resolved.slug)) return;
|
|
@@ -3370,6 +3374,29 @@ function convertPropertyCore(fieldName, node, required, path, ctx) {
|
|
|
3370
3374
|
});
|
|
3371
3375
|
return null;
|
|
3372
3376
|
}
|
|
3377
|
+
if (!resolved.declaresKind) {
|
|
3378
|
+
const guard = `$def:${node.$ref}`;
|
|
3379
|
+
if (ctx.refsInProgress.has(guard)) {
|
|
3380
|
+
ctx.problems.push({
|
|
3381
|
+
severity: "info",
|
|
3382
|
+
path,
|
|
3383
|
+
message: `Self-referencing structure "${node.$ref}" \u2014 carried as any JSON value (json).`
|
|
3384
|
+
});
|
|
3385
|
+
return { ...requiredNullableFlags(required), type: "json" };
|
|
3386
|
+
}
|
|
3387
|
+
ctx.refsInProgress.add(guard);
|
|
3388
|
+
try {
|
|
3389
|
+
return convertPropertyCore(
|
|
3390
|
+
fieldName,
|
|
3391
|
+
inlineRefNode(node, resolved),
|
|
3392
|
+
required,
|
|
3393
|
+
path,
|
|
3394
|
+
ctx
|
|
3395
|
+
);
|
|
3396
|
+
} finally {
|
|
3397
|
+
ctx.refsInProgress.delete(guard);
|
|
3398
|
+
}
|
|
3399
|
+
}
|
|
3373
3400
|
refToObjectField(resolved, path, ctx);
|
|
3374
3401
|
return {
|
|
3375
3402
|
...requiredNullableFlags(required),
|
|
@@ -3401,6 +3428,10 @@ function convertPropertyCore(fieldName, node, required, path, ctx) {
|
|
|
3401
3428
|
unsupported = true;
|
|
3402
3429
|
continue;
|
|
3403
3430
|
}
|
|
3431
|
+
if (!resolvedVariant.declaresKind) {
|
|
3432
|
+
anonymousObjects.push(inlineRefNode(variant, resolvedVariant));
|
|
3433
|
+
continue;
|
|
3434
|
+
}
|
|
3404
3435
|
refToObjectField(resolvedVariant, path, ctx);
|
|
3405
3436
|
memberKinds.push(resolvedVariant.slug);
|
|
3406
3437
|
continue;
|
|
@@ -6401,6 +6432,12 @@ function findTableEnd(lines, start) {
|
|
|
6401
6432
|
while (end < lines.length && continuesTable(lines[end] ?? "", container)) end += 1;
|
|
6402
6433
|
return end;
|
|
6403
6434
|
}
|
|
6435
|
+
function startsLikeTableRow(line) {
|
|
6436
|
+
return /^\s*\|/.test(line);
|
|
6437
|
+
}
|
|
6438
|
+
function isGrowingDelimiterRow(line) {
|
|
6439
|
+
return /^[\s|:-]*-[\s|:-]*$/.test(line);
|
|
6440
|
+
}
|
|
6404
6441
|
|
|
6405
6442
|
// source/tokenize.ts
|
|
6406
6443
|
var QUOTE_PREFIX = /^ {0,3}>(?: ?>)* ?/;
|
|
@@ -8479,12 +8516,6 @@ function findWholeTableStart(lines, from = 0) {
|
|
|
8479
8516
|
for (let i = Math.max(0, from); i + 1 < lines.length; i += 1) if (tableStartsAt(lines, i)) return i;
|
|
8480
8517
|
return -1;
|
|
8481
8518
|
}
|
|
8482
|
-
function startsLikeTableRow(line) {
|
|
8483
|
-
return /^\s*\|/.test(line);
|
|
8484
|
-
}
|
|
8485
|
-
function isGrowingDelimiterRow(line) {
|
|
8486
|
-
return /^[\s|:-]*-[\s|:-]*$/.test(line);
|
|
8487
|
-
}
|
|
8488
8519
|
function trailingTableStart(lines, end = lines.length) {
|
|
8489
8520
|
const isTableLine = (line) => startsLikeTableRow(line) || continuesTable(line.trimStart());
|
|
8490
8521
|
let start = end;
|