@ai-matrx/records 0.98.11 → 0.98.12

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 CHANGED
@@ -1,5 +1,11 @@
1
1
  # Changelog — @ai-matrx/records
2
2
 
3
+ ## 0.98.12
4
+
5
+ Automatic changed-only republish (docs/metadata drift since the last tag — see
6
+ `git diff npm/records/v0.98.11..npm/records/v0.98.12 -- apps/shared/records`).
7
+ No source changes intended and no consumer action required.
8
+
3
9
  ## 0.98.11
4
10
 
5
11
  Automatic changed-only republish (docs/metadata drift since the last tag — see
@@ -5480,6 +5480,13 @@ function tableRenderSchema(facts) {
5480
5480
  function refuse(code, message, hint) {
5481
5481
  return { ok: false, error: { code, message, hint, ours: true } };
5482
5482
  }
5483
+ function displacedSource(envelope) {
5484
+ if (envelope.src) return { src: envelope.src };
5485
+ const by = envelope.actor === "agent" ? "an agent" : envelope.actor === "system" ? "the system" : envelope.actor ? "a person" : null;
5486
+ if (by === null) return {};
5487
+ const day = typeof envelope.at === "string" && envelope.at.length >= 10 ? ` on ${envelope.at.slice(0, 10)}` : "";
5488
+ return { src: { name: `Entered by ${by}${day}` } };
5489
+ }
5483
5490
  function alternatePatch(document, field_key, alternate_index, rank) {
5484
5491
  const block = document._values ?? {};
5485
5492
  const envelope = block[field_key];
@@ -5495,7 +5502,7 @@ function alternatePatch(document, field_key, alternate_index, rank) {
5495
5502
  const taken = new Set(kept.map((a) => a.rank));
5496
5503
  let rank2 = 1;
5497
5504
  while (taken.has(rank2)) rank2 += 1;
5498
- next.push({ value: current, ...envelope.src ? { src: envelope.src } : {}, rank: rank2 });
5505
+ next.push({ value: current, ...displacedSource(envelope), rank: rank2 });
5499
5506
  }
5500
5507
  const { ver: _ver, actor: _actor, at: _at, on_behalf_of: _on, absent: _absent, alternates: _alts, src: _src, ...rest } = envelope;
5501
5508
  const changed = { ...rest, ...chosen.src ? { src: chosen.src } : {} };