signetai 0.191.2 → 0.192.0

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/dist/mcp-stdio.js CHANGED
@@ -45705,10 +45705,7 @@ function mergeEntityAspects(db, agentId, sourceId, targetId) {
45705
45705
  return aspects.length;
45706
45706
  }
45707
45707
  function mergeEntityEdges(db, agentId, sourceId, targetId) {
45708
- let relationshipChanges = 0;
45709
- relationshipChanges += db.prepare("UPDATE entity_dependencies SET source_entity_id = ? WHERE source_entity_id = ? AND agent_id = ?").run(targetId, sourceId, agentId).changes;
45710
- relationshipChanges += db.prepare("UPDATE entity_dependencies SET target_entity_id = ? WHERE target_entity_id = ? AND agent_id = ?").run(targetId, sourceId, agentId).changes;
45711
- relationshipChanges += db.prepare("DELETE FROM entity_dependencies WHERE source_entity_id = target_entity_id AND agent_id = ?").run(agentId).changes;
45708
+ let relationshipChanges = mergeEntityDependencies(db, agentId, sourceId, targetId);
45712
45709
  relationshipChanges += db.prepare("UPDATE relations SET source_entity_id = ? WHERE source_entity_id = ?").run(targetId, sourceId).changes;
45713
45710
  relationshipChanges += db.prepare("UPDATE relations SET target_entity_id = ? WHERE target_entity_id = ?").run(targetId, sourceId).changes;
45714
45711
  relationshipChanges += db.prepare("DELETE FROM relations WHERE source_entity_id = target_entity_id").run().changes;
@@ -45716,14 +45713,66 @@ function mergeEntityEdges(db, agentId, sourceId, targetId) {
45716
45713
  db.prepare("DELETE FROM memory_entity_mentions WHERE entity_id = ?").run(sourceId);
45717
45714
  return relationshipChanges;
45718
45715
  }
45716
+ function mergeEntityDependencies(db, agentId, sourceId, targetId) {
45717
+ const rows = db.prepare(`SELECT id, source_entity_id, target_entity_id, dependency_type
45718
+ FROM entity_dependencies
45719
+ WHERE agent_id = ? AND (source_entity_id = ? OR target_entity_id = ?)`).all(agentId, sourceId, sourceId);
45720
+ let changes = 0;
45721
+ for (const row of rows) {
45722
+ const nextSource = row.source_entity_id === sourceId ? targetId : row.source_entity_id;
45723
+ const nextTarget = row.target_entity_id === sourceId ? targetId : row.target_entity_id;
45724
+ if (nextSource === nextTarget) {
45725
+ changes += db.prepare("DELETE FROM entity_dependencies WHERE id = ? AND agent_id = ?").run(row.id, agentId).changes;
45726
+ continue;
45727
+ }
45728
+ const duplicate = db.prepare(`SELECT id FROM entity_dependencies
45729
+ WHERE agent_id = ? AND id != ?
45730
+ AND source_entity_id = ? AND target_entity_id = ? AND dependency_type = ?
45731
+ LIMIT 1`).get(agentId, row.id, nextSource, nextTarget, row.dependency_type);
45732
+ if (duplicate) {
45733
+ changes += db.prepare("DELETE FROM entity_dependencies WHERE id = ? AND agent_id = ?").run(row.id, agentId).changes;
45734
+ continue;
45735
+ }
45736
+ changes += db.prepare(`UPDATE entity_dependencies
45737
+ SET source_entity_id = ?, target_entity_id = ?, updated_at = datetime('now')
45738
+ WHERE id = ? AND agent_id = ?`).run(nextSource, nextTarget, row.id, agentId).changes;
45739
+ }
45740
+ return changes;
45741
+ }
45719
45742
  function applyMergeEntities(db, agentId, payload) {
45720
45743
  const sources = sourceMergeSpecs(payload);
45744
+ const target2 = resolveMergeEntityRef(db, agentId, "payload.target_entity", readString2(payload, "target_entity") ?? readString2(payload, "target") ?? null, readString2(payload, "target_entity_id") ?? readString2(payload, "target_id") ?? null);
45745
+ const alreadyMerged = sources.filter((source) => {
45746
+ if (source.id !== null) {
45747
+ return getEntityRefById(db, agentId, source.id) === null && wasEntityMergeApplied(db, agentId, source.id, target2.id, source.selector);
45748
+ }
45749
+ if (source.selector === null)
45750
+ return false;
45751
+ try {
45752
+ resolveEntityRefStrict(db, agentId, source.selector);
45753
+ return false;
45754
+ } catch (err) {
45755
+ if (!(err instanceof OntologyProposalError) || err.status !== 404)
45756
+ throw err;
45757
+ return wasEntityMergeApplied(db, agentId, null, target2.id, source.selector);
45758
+ }
45759
+ });
45760
+ const pendingSources = sources.filter((source) => !alreadyMerged.includes(source));
45761
+ if (pendingSources.length === 0 && alreadyMerged.length > 0) {
45762
+ return {
45763
+ targetEntityId: target2.id,
45764
+ targetEntityName: target2.name,
45765
+ mergedEntities: [],
45766
+ alreadyMergedEntities: alreadyMerged.map((source) => source.selector ?? source.id),
45767
+ warnings: [],
45768
+ relationshipsChanged: 0
45769
+ };
45770
+ }
45721
45771
  const plan = buildEntityMergePlan(db, {
45722
45772
  agentId,
45723
- targetEntity: readString2(payload, "target_entity") ?? readString2(payload, "target") ?? undefined,
45724
- targetEntityId: readString2(payload, "target_entity_id") ?? readString2(payload, "target_id") ?? undefined,
45725
- sourceEntities: sources.map((spec) => spec.selector).filter((selector) => selector !== null),
45726
- sourceEntityIds: sources.map((spec) => spec.id).filter((id) => id !== null),
45773
+ targetEntityId: target2.id,
45774
+ sourceEntities: pendingSources.map((spec) => spec.selector).filter((selector) => selector !== null),
45775
+ sourceEntityIds: pendingSources.map((spec) => spec.id).filter((id) => id !== null),
45727
45776
  force: truthy(payload.force)
45728
45777
  });
45729
45778
  if (plan.blocked)
@@ -45746,6 +45795,7 @@ function applyMergeEntities(db, agentId, payload) {
45746
45795
  targetEntityId: plan.target.id,
45747
45796
  targetEntityName: plan.target.name,
45748
45797
  mergedEntities: merged,
45798
+ alreadyMergedEntities: alreadyMerged.map((source) => source.selector ?? source.id),
45749
45799
  warnings: plan.warnings,
45750
45800
  relationshipsChanged: relationshipChanges
45751
45801
  };
@@ -46068,6 +46118,36 @@ function selectorMatchesEntityRef(selector, entity) {
46068
46118
  const key = canonical(selector);
46069
46119
  return selector === entity.id || key === canonical(entity.name) || key === canonical(entity.canonicalName);
46070
46120
  }
46121
+ function wasEntityMergeApplied(db, agentId, sourceId, targetId, sourceSelector) {
46122
+ const needle = sourceId ?? sourceSelector;
46123
+ if (needle === null)
46124
+ return false;
46125
+ const rows = db.prepare(`SELECT result FROM ontology_proposals
46126
+ WHERE agent_id = ? AND operation = 'merge_entities' AND status = 'applied'
46127
+ AND result LIKE ?`).all(agentId, `%${needle}%`);
46128
+ for (const row of rows) {
46129
+ if (row.result === null)
46130
+ continue;
46131
+ try {
46132
+ const result = parseJsonRecord(row.result);
46133
+ if (readString2(result, "targetEntityId") !== targetId)
46134
+ continue;
46135
+ const merged = result.mergedEntities;
46136
+ if (!Array.isArray(merged))
46137
+ continue;
46138
+ if (merged.some((item) => {
46139
+ if (!isRecord3(item))
46140
+ return false;
46141
+ if (sourceId !== null)
46142
+ return readString2(item, "entityId") === sourceId;
46143
+ const name = readString2(item, "name");
46144
+ return name !== null && canonical(name) === canonical(sourceSelector ?? "");
46145
+ }))
46146
+ return true;
46147
+ } catch {}
46148
+ }
46149
+ return false;
46150
+ }
46071
46151
  function sourceMergeSpecs(payload) {
46072
46152
  const selectors = unique2([
46073
46153
  ...readStringArray(payload, "source_entities"),
@@ -1,43 +1,43 @@
1
1
  {
2
2
  "schemaVersion": 1,
3
- "version": "0.191.2",
3
+ "version": "0.192.0",
4
4
  "assets": [
5
5
  {
6
6
  "name": "signet-darwin-arm64",
7
7
  "platform": "darwin-arm64",
8
- "sha256": "6a571803dc20220132cc7d615a9ea84698f3f0936e5ea6b09cf31fba6fdf8f70",
8
+ "sha256": "3fb93a1734ce028b0412b2b320c62f1cf329c5f7d8bacde59d6913aea13a2015",
9
9
  "size": 117523744
10
10
  },
11
11
  {
12
12
  "name": "signet-darwin-x64",
13
13
  "platform": "darwin-x64",
14
- "sha256": "3fddbdb4c6792ece033e684409618a984e7c177ceaac2f53f68b3ca6cef1b269",
14
+ "sha256": "45b9996dccf5f5b49f7d40a3bedca6936c4d415d37efc3768657d8cde5ae53f0",
15
15
  "size": 122145344
16
16
  },
17
17
  {
18
18
  "name": "signet-linux-arm64",
19
19
  "platform": "linux-arm64",
20
- "sha256": "cbc62e5485424bfb94d11017925d4100f5f32bdb7547a40ec606d5f8a1a10d92",
21
- "size": 154757037
20
+ "sha256": "340e2b531a311b8d103a143e454fd2d5c9e9bc3a44083d42dabec843351f74b4",
21
+ "size": 154761540
22
22
  },
23
23
  {
24
24
  "name": "signet-linux-x64",
25
25
  "platform": "linux-x64",
26
- "sha256": "a5bd982ff634c6df11ac31f5fdcc94251fe2a89291df5ae0de47a767a0482cb3",
27
- "size": 155316022
26
+ "sha256": "c25577a5dbbd92772459254d0404533dea9217851043d88c2204861a860ed8a7",
27
+ "size": 155320525
28
28
  },
29
29
  {
30
30
  "name": "signet-win32-x64.exe",
31
31
  "platform": "win32-x64",
32
- "sha256": "3f382e81f8d947f42664caa084f9e2377f8cd526e709275d71aba9c6847d6f29",
33
- "size": 171448320
32
+ "sha256": "4d2e3ed73f539efc30eef4f16157cdc4110fed3eb801787011670517092f3898",
33
+ "size": 171452928
34
34
  }
35
35
  ],
36
36
  "components": {
37
37
  "connectors": {
38
- "url": "signet-connectors-0.191.2.tar.gz",
39
- "sha256": "7c1f9d186b7f2c2ab544719e826004871a0e6e06f7076b042076a693261754e4",
40
- "size": 16889
38
+ "url": "signet-connectors-0.192.0.tar.gz",
39
+ "sha256": "b7dbfccba3642636a83b6b5a1eacd041556649a82b836efd7de13aaa44e47284",
40
+ "size": 16890
41
41
  }
42
42
  }
43
43
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "signetai",
3
- "version": "0.191.2",
3
+ "version": "0.192.0",
4
4
  "description": "Signet native CLI installer wrapper",
5
5
  "type": "module",
6
6
  "bin": {
@@ -65,10 +65,10 @@
65
65
  "access": "public"
66
66
  },
67
67
  "optionalDependencies": {
68
- "signetai-darwin-arm64": "https://github.com/Signet-AI/signetai/releases/download/v0.191.2/signetai-darwin-arm64-0.191.2.tgz",
69
- "signetai-darwin-x64": "https://github.com/Signet-AI/signetai/releases/download/v0.191.2/signetai-darwin-x64-0.191.2.tgz",
70
- "signetai-linux-arm64": "https://github.com/Signet-AI/signetai/releases/download/v0.191.2/signetai-linux-arm64-0.191.2.tgz",
71
- "signetai-linux-x64": "https://github.com/Signet-AI/signetai/releases/download/v0.191.2/signetai-linux-x64-0.191.2.tgz",
72
- "signetai-win32-x64": "https://github.com/Signet-AI/signetai/releases/download/v0.191.2/signetai-win32-x64-0.191.2.tgz"
68
+ "signetai-darwin-arm64": "https://github.com/Signet-AI/signetai/releases/download/v0.192.0/signetai-darwin-arm64-0.192.0.tgz",
69
+ "signetai-darwin-x64": "https://github.com/Signet-AI/signetai/releases/download/v0.192.0/signetai-darwin-x64-0.192.0.tgz",
70
+ "signetai-linux-arm64": "https://github.com/Signet-AI/signetai/releases/download/v0.192.0/signetai-linux-arm64-0.192.0.tgz",
71
+ "signetai-linux-x64": "https://github.com/Signet-AI/signetai/releases/download/v0.192.0/signetai-linux-x64-0.192.0.tgz",
72
+ "signetai-win32-x64": "https://github.com/Signet-AI/signetai/releases/download/v0.192.0/signetai-win32-x64-0.192.0.tgz"
73
73
  }
74
74
  }