archgraph-argo 0.26.1 → 0.26.2

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.
@@ -629,29 +629,42 @@ function validateDocument(document, schema, options = {}) {
629
629
  // also NOT the semantic match surface — semantic retrieval embeds attributes and
630
630
  // testcase descriptions (semanticRecordText.js), so semantic results keep them;
631
631
  // and the focus element of an intent-element read always keeps its own.
632
+ function byteLenLocal(value) {
633
+ try { return Buffer.byteLength(JSON.stringify(value)); } catch (_) { return 0; }
634
+ }
635
+
632
636
  function projectAgentFields(record, opts = {}) {
633
637
  const value = clone(record);
634
638
  let omittedAttributes = 0;
635
639
  let omittedTestcases = 0;
640
+ let omittedBytes = 0;
636
641
  if (!opts.includeAttributes && Array.isArray(value.attributes) && value.attributes.length) {
637
642
  omittedAttributes = value.attributes.length;
643
+ omittedBytes += byteLenLocal(value.attributes);
638
644
  delete value.attributes;
639
645
  }
640
646
  if (!opts.includeTestcases && Array.isArray(value.testcases) && value.testcases.length) {
641
647
  omittedTestcases = value.testcases.length;
648
+ omittedBytes += byteLenLocal(value.testcases);
642
649
  delete value.testcases;
643
650
  }
644
- return { value, omittedAttributes, omittedTestcases };
651
+ return { value, omittedAttributes, omittedTestcases, omittedBytes };
645
652
  }
646
653
 
647
654
  function buildAgentProjection(omitted) {
648
655
  if (!omitted || (omitted.attributes === 0 && omitted.testcases === 0)) {
649
656
  return null;
650
657
  }
658
+ // Only attach the explanation when the omission actually saves more than the
659
+ // note costs, so trimming a read can NEVER make it larger (cross-scenario
660
+ // no-degradation). The opt-in flags are documented in the tool description.
661
+ if ((omitted.bytes || 0) < 160) {
662
+ return null;
663
+ }
651
664
  return {
652
665
  attributesOmitted: omitted.attributes,
653
666
  testcasesOmitted: omitted.testcases,
654
- note: 'Member attributes/testcases are bookkeeping (commit/session/release ledgers, acceptance cases) and are omitted from this structural read by default. Pass includeAttributes:true / includeTestcases:true to include them verbatim. Semantic retrieval already embeds their text, so semantic hits keep them.',
667
+ note: 'includeAttributes/includeTestcases=true to include (omitted by default; semantic hits keep them).',
655
668
  };
656
669
  }
657
670
 
@@ -740,7 +753,7 @@ function buildIntentElementContext(context, args = {}) {
740
753
  const subgraph = buildNativeSubgraph(context.document, includedElementIds, includedRelationshipIds);
741
754
  const includeAttributes = args.includeAttributes === true;
742
755
  const includeTestcases = args.includeTestcases === true;
743
- const omitted = { attributes: 0, testcases: 0 };
756
+ const omitted = { attributes: 0, testcases: 0, bytes: 0 };
744
757
  if (!(includeAttributes && includeTestcases)) {
745
758
  subgraph.elements = subgraph.elements.map((element) => {
746
759
  if (element.id === focusElement.id) {
@@ -749,11 +762,13 @@ function buildIntentElementContext(context, args = {}) {
749
762
  const projected = projectAgentFields(element, { includeAttributes, includeTestcases });
750
763
  omitted.attributes += projected.omittedAttributes;
751
764
  omitted.testcases += projected.omittedTestcases;
765
+ omitted.bytes += projected.omittedBytes;
752
766
  return projected.value;
753
767
  });
754
768
  subgraph.relationships = subgraph.relationships.map((relationship) => {
755
769
  const projected = projectAgentFields(relationship, { includeAttributes });
756
770
  omitted.attributes += projected.omittedAttributes;
771
+ omitted.bytes += projected.omittedBytes;
757
772
  return projected.value;
758
773
  });
759
774
  }
@@ -851,11 +866,12 @@ function buildViewContext(context, args = {}) {
851
866
 
852
867
  const includeAttributes = args.includeAttributes === true;
853
868
  const includeTestcases = args.includeTestcases === true;
854
- const omitted = { attributes: 0, testcases: 0 };
869
+ const omitted = { attributes: 0, testcases: 0, bytes: 0 };
855
870
  const project = (record) => {
856
871
  const projected = projectAgentFields(record, { includeAttributes, includeTestcases });
857
872
  omitted.attributes += projected.omittedAttributes;
858
873
  omitted.testcases += projected.omittedTestcases;
874
+ omitted.bytes += projected.omittedBytes;
859
875
  return projected.value;
860
876
  };
861
877
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "archgraph-argo",
3
- "version": "0.26.1",
3
+ "version": "0.26.2",
4
4
  "description": "Deploy the ArchGraph ARGO toolchain, skills, and rules (schema, scripts, argo-init skill, global rule) with one command.",
5
5
  "license": "MIT",
6
6
  "bin": {