traicebox 0.1.14 → 0.1.16

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.
Files changed (2) hide show
  1. package/dist/index.js +17 -11
  2. package/package.json +3 -3
package/dist/index.js CHANGED
@@ -614,6 +614,8 @@ var require_Alias = __commonJS((exports) => {
614
614
  });
615
615
  }
616
616
  resolve(doc, ctx) {
617
+ if (ctx?.maxAliasCount === 0)
618
+ throw new ReferenceError("Alias resolution is disabled");
617
619
  let nodes;
618
620
  if (ctx?.aliasResolveCache) {
619
621
  nodes = ctx.aliasResolveCache;
@@ -1663,18 +1665,18 @@ var require_merge = __commonJS((exports) => {
1663
1665
  };
1664
1666
  var isMergeKey = (ctx, key) => (merge.identify(key) || identity.isScalar(key) && (!key.type || key.type === Scalar.Scalar.PLAIN) && merge.identify(key.value)) && ctx?.doc.schema.tags.some((tag) => tag.tag === merge.tag && tag.default);
1665
1667
  function addMergeToJSMap(ctx, map, value) {
1666
- value = ctx && identity.isAlias(value) ? value.resolve(ctx.doc) : value;
1667
- if (identity.isSeq(value))
1668
- for (const it of value.items)
1668
+ const source = resolveAliasValue(ctx, value);
1669
+ if (identity.isSeq(source))
1670
+ for (const it of source.items)
1669
1671
  mergeValue(ctx, map, it);
1670
- else if (Array.isArray(value))
1671
- for (const it of value)
1672
+ else if (Array.isArray(source))
1673
+ for (const it of source)
1672
1674
  mergeValue(ctx, map, it);
1673
1675
  else
1674
- mergeValue(ctx, map, value);
1676
+ mergeValue(ctx, map, source);
1675
1677
  }
1676
1678
  function mergeValue(ctx, map, value) {
1677
- const source = ctx && identity.isAlias(value) ? value.resolve(ctx.doc) : value;
1679
+ const source = resolveAliasValue(ctx, value);
1678
1680
  if (!identity.isMap(source))
1679
1681
  throw new Error("Merge sources must be maps or map aliases");
1680
1682
  const srcMap = source.toJSON(null, ctx, Map);
@@ -1695,6 +1697,9 @@ var require_merge = __commonJS((exports) => {
1695
1697
  }
1696
1698
  return map;
1697
1699
  }
1700
+ function resolveAliasValue(ctx, value) {
1701
+ return ctx && identity.isAlias(value) ? value.resolve(ctx.doc, ctx) : value;
1702
+ }
1698
1703
  exports.addMergeToJSMap = addMergeToJSMap;
1699
1704
  exports.isMergeKey = isMergeKey;
1700
1705
  exports.merge = merge;
@@ -2270,7 +2275,7 @@ var require_stringifyNumber = __commonJS((exports) => {
2270
2275
  if (!isFinite(num))
2271
2276
  return isNaN(num) ? ".nan" : num < 0 ? "-.inf" : ".inf";
2272
2277
  let n = Object.is(value, -0) ? "-0" : JSON.stringify(value);
2273
- if (!format3 && minFractionDigits && (!tag || tag === "tag:yaml.org,2002:float") && /^\d/.test(n)) {
2278
+ if (!format3 && minFractionDigits && (!tag || tag === "tag:yaml.org,2002:float") && /^-?\d/.test(n) && !n.includes("e")) {
2274
2279
  let i = n.indexOf(".");
2275
2280
  if (i < 0) {
2276
2281
  i = n.length;
@@ -4495,7 +4500,7 @@ var require_resolve_flow_scalar = __commonJS((exports) => {
4495
4500
  while (next === " " || next === "\t")
4496
4501
  next = source[++i + 1];
4497
4502
  } else if (next === "x" || next === "u" || next === "U") {
4498
- const length = { x: 2, u: 4, U: 8 }[next];
4503
+ const length = next === "x" ? 2 : next === "u" ? 4 : 8;
4499
4504
  res += parseCharCode(source, i + 1, length, onError);
4500
4505
  i += length;
4501
4506
  } else {
@@ -4564,12 +4569,13 @@ var require_resolve_flow_scalar = __commonJS((exports) => {
4564
4569
  const cc = source.substr(offset, length);
4565
4570
  const ok = cc.length === length && /^[0-9a-fA-F]+$/.test(cc);
4566
4571
  const code = ok ? parseInt(cc, 16) : NaN;
4567
- if (isNaN(code)) {
4572
+ try {
4573
+ return String.fromCodePoint(code);
4574
+ } catch {
4568
4575
  const raw = source.substr(offset - 2, length + 2);
4569
4576
  onError(offset - 2, "BAD_DQ_ESCAPE", `Invalid escape sequence ${raw}`);
4570
4577
  return raw;
4571
4578
  }
4572
- return String.fromCodePoint(code);
4573
4579
  }
4574
4580
  exports.resolveFlowScalar = resolveFlowScalar;
4575
4581
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "traicebox",
3
- "version": "0.1.14",
3
+ "version": "0.1.16",
4
4
  "description": "A local developer stack for tracing and session tracking around LLM and AI model workflows",
5
5
  "license": "MIT",
6
6
  "author": "Fardjad Davari <public@fardjad.com>",
@@ -35,7 +35,7 @@
35
35
  "fix": "biome check --write . && dprint fmt"
36
36
  },
37
37
  "devDependencies": {
38
- "@biomejs/biome": "^2.4.13",
38
+ "@biomejs/biome": "^2.4.14",
39
39
  "@types/bun": "^1.3.13",
40
40
  "@types/yargs": "^17.0.35",
41
41
  "dprint": "^0.54.0",
@@ -43,7 +43,7 @@
43
43
  },
44
44
  "dependencies": {
45
45
  "picospinner": "^3.0.0",
46
- "yaml": "^2.8.3",
46
+ "yaml": "^2.8.4",
47
47
  "yargs": "^18.0.0"
48
48
  }
49
49
  }