archgraph-argo 0.18.0 → 0.18.1

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.
@@ -1813,9 +1813,13 @@ async function buildMutationResult(context, mutations, write, dependencies) {
1813
1813
  }
1814
1814
 
1815
1815
  // L1 advisory: semantic near-duplicate suggestions for element adds. Never
1816
- // blocks or fails the write; preview and apply both surface it.
1816
+ // blocks or fails the write; preview and apply both surface it. Only adds the
1817
+ // applied mutation actually CREATED are advised — a reuse that found an exact
1818
+ // natural-key match creates nothing and is skipped, while a reuse that fell
1819
+ // through to creation is advised like any other new element.
1817
1820
  if (errors.length === 0) {
1818
- const semanticDedup = await buildSemanticDedupAdvisory(context, mutations, dependencies);
1821
+ const createdAdds = selectCreatedElementAdds(mutations, mutationResult.mutationSummaries);
1822
+ const semanticDedup = await buildSemanticDedupAdvisory(context, createdAdds, dependencies);
1819
1823
  if (semanticDedup) {
1820
1824
  result.semanticDedup = semanticDedup;
1821
1825
  }
@@ -2695,6 +2699,24 @@ function collectViewMemberElementIds(document, viewIds) {
2695
2699
  return ids;
2696
2700
  }
2697
2701
 
2702
+ // Only element adds that the applied mutation actually CREATED are subject to
2703
+ // the L1 advisory. A reuse that found an exact natural-key match creates nothing
2704
+ // (created:false) and is skipped; a reuse that fell through to creation
2705
+ // (created:true, id === requested id) is advised like any other new element.
2706
+ function selectCreatedElementAdds(mutations, mutationSummaries) {
2707
+ const createdIds = new Set(
2708
+ (Array.isArray(mutationSummaries) ? mutationSummaries : [])
2709
+ .filter(summary => summary && summary.type === 'addElement' && summary.created === true)
2710
+ .map(summary => summary.id),
2711
+ );
2712
+ return (Array.isArray(mutations) ? mutations : []).filter(mutation => (
2713
+ mutation
2714
+ && mutation.type === 'addElement'
2715
+ && mutation.element
2716
+ && createdIds.has(mutation.element.id)
2717
+ ));
2718
+ }
2719
+
2698
2720
  async function buildSemanticDedupAdvisory(context, mutations, dependencies) {
2699
2721
  if (process.env.ARGO_MCP_SEMANTIC_DEDUP === '0') {
2700
2722
  return undefined;
@@ -2705,7 +2727,6 @@ async function buildSemanticDedupAdvisory(context, mutations, dependencies) {
2705
2727
  && mutation.element
2706
2728
  && typeof mutation.element.name === 'string'
2707
2729
  && mutation.element.name.trim() !== ''
2708
- && mutation.onConflict !== 'reuse'
2709
2730
  ));
2710
2731
  if (addedElements.length === 0) {
2711
2732
  return undefined;
@@ -4106,6 +4127,7 @@ module.exports = {
4106
4127
  TOOLS,
4107
4128
  applyMutations,
4108
4129
  buildSemanticDedupAdvisory,
4130
+ selectCreatedElementAdds,
4109
4131
  callTool,
4110
4132
  compactMutationResponse,
4111
4133
  createDefaultCanonicalSemanticInitComposition,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "archgraph-argo",
3
- "version": "0.18.0",
3
+ "version": "0.18.1",
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": {