@inkeep/agents-core 0.0.0-dev-20250930012707 → 0.0.0-dev-20250930044500

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/index.cjs CHANGED
@@ -6706,6 +6706,53 @@ var updateFullGraphServerSide = (db, logger12 = defaultLogger) => async (scopes,
6706
6706
  ([_, agentData]) => isExternalAgent(agentData)
6707
6707
  ).length;
6708
6708
  logger12.info({ externalAgentCount }, "All external agents created/updated successfully");
6709
+ const incomingAgentIds = new Set(Object.keys(typedGraphDefinition.agents));
6710
+ const existingInternalAgents = await listAgents(db)({
6711
+ scopes: { tenantId, projectId, graphId: finalGraphId }
6712
+ });
6713
+ const existingExternalAgents = await listExternalAgents(db)({
6714
+ scopes: { tenantId, projectId, graphId: finalGraphId }
6715
+ });
6716
+ let deletedInternalCount = 0;
6717
+ for (const agent of existingInternalAgents) {
6718
+ if (!incomingAgentIds.has(agent.id)) {
6719
+ try {
6720
+ await deleteAgent(db)({
6721
+ scopes: { tenantId, projectId, graphId: finalGraphId },
6722
+ agentId: agent.id
6723
+ });
6724
+ deletedInternalCount++;
6725
+ logger12.info({ agentId: agent.id }, "Deleted orphaned internal agent");
6726
+ } catch (error) {
6727
+ logger12.error({ agentId: agent.id, error }, "Failed to delete orphaned internal agent");
6728
+ }
6729
+ }
6730
+ }
6731
+ let deletedExternalCount = 0;
6732
+ for (const agent of existingExternalAgents) {
6733
+ if (!incomingAgentIds.has(agent.id)) {
6734
+ try {
6735
+ await deleteExternalAgent(db)({
6736
+ scopes: { tenantId, projectId, graphId: finalGraphId },
6737
+ agentId: agent.id
6738
+ });
6739
+ deletedExternalCount++;
6740
+ logger12.info({ agentId: agent.id }, "Deleted orphaned external agent");
6741
+ } catch (error) {
6742
+ logger12.error({ agentId: agent.id, error }, "Failed to delete orphaned external agent");
6743
+ }
6744
+ }
6745
+ }
6746
+ if (deletedInternalCount > 0 || deletedExternalCount > 0) {
6747
+ logger12.info(
6748
+ {
6749
+ deletedInternalCount,
6750
+ deletedExternalCount,
6751
+ totalDeleted: deletedInternalCount + deletedExternalCount
6752
+ },
6753
+ "Deleted orphaned agents from graph"
6754
+ );
6755
+ }
6709
6756
  await updateAgentGraph(db)({
6710
6757
  scopes: { tenantId, projectId, graphId: typedGraphDefinition.id },
6711
6758
  data: {
@@ -8154,6 +8201,36 @@ var updateFullProjectServerSide = (db, logger12 = defaultLogger2) => async (scop
8154
8201
  "All project artifactComponents updated successfully"
8155
8202
  );
8156
8203
  }
8204
+ const incomingGraphIds = new Set(Object.keys(typed.graphs || {}));
8205
+ const existingGraphs = await listAgentGraphs(db)({
8206
+ scopes: { tenantId, projectId: typed.id }
8207
+ });
8208
+ let deletedGraphCount = 0;
8209
+ for (const graph of existingGraphs) {
8210
+ if (!incomingGraphIds.has(graph.id)) {
8211
+ try {
8212
+ await deleteFullGraph(db, logger12)({
8213
+ scopes: { tenantId, projectId: typed.id, graphId: graph.id }
8214
+ });
8215
+ deletedGraphCount++;
8216
+ logger12.info({ graphId: graph.id }, "Deleted orphaned graph from project");
8217
+ } catch (error) {
8218
+ logger12.error(
8219
+ { graphId: graph.id, error },
8220
+ "Failed to delete orphaned graph from project"
8221
+ );
8222
+ }
8223
+ }
8224
+ }
8225
+ if (deletedGraphCount > 0) {
8226
+ logger12.info(
8227
+ {
8228
+ deletedGraphCount,
8229
+ projectId: typed.id
8230
+ },
8231
+ "Deleted orphaned graphs from project"
8232
+ );
8233
+ }
8157
8234
  if (typed.graphs && Object.keys(typed.graphs).length > 0) {
8158
8235
  logger12.info(
8159
8236
  {
package/dist/index.js CHANGED
@@ -4967,6 +4967,53 @@ var updateFullGraphServerSide = (db, logger12 = defaultLogger) => async (scopes,
4967
4967
  ([_, agentData]) => isExternalAgent(agentData)
4968
4968
  ).length;
4969
4969
  logger12.info({ externalAgentCount }, "All external agents created/updated successfully");
4970
+ const incomingAgentIds = new Set(Object.keys(typedGraphDefinition.agents));
4971
+ const existingInternalAgents = await listAgents(db)({
4972
+ scopes: { tenantId, projectId, graphId: finalGraphId }
4973
+ });
4974
+ const existingExternalAgents = await listExternalAgents(db)({
4975
+ scopes: { tenantId, projectId, graphId: finalGraphId }
4976
+ });
4977
+ let deletedInternalCount = 0;
4978
+ for (const agent of existingInternalAgents) {
4979
+ if (!incomingAgentIds.has(agent.id)) {
4980
+ try {
4981
+ await deleteAgent(db)({
4982
+ scopes: { tenantId, projectId, graphId: finalGraphId },
4983
+ agentId: agent.id
4984
+ });
4985
+ deletedInternalCount++;
4986
+ logger12.info({ agentId: agent.id }, "Deleted orphaned internal agent");
4987
+ } catch (error) {
4988
+ logger12.error({ agentId: agent.id, error }, "Failed to delete orphaned internal agent");
4989
+ }
4990
+ }
4991
+ }
4992
+ let deletedExternalCount = 0;
4993
+ for (const agent of existingExternalAgents) {
4994
+ if (!incomingAgentIds.has(agent.id)) {
4995
+ try {
4996
+ await deleteExternalAgent(db)({
4997
+ scopes: { tenantId, projectId, graphId: finalGraphId },
4998
+ agentId: agent.id
4999
+ });
5000
+ deletedExternalCount++;
5001
+ logger12.info({ agentId: agent.id }, "Deleted orphaned external agent");
5002
+ } catch (error) {
5003
+ logger12.error({ agentId: agent.id, error }, "Failed to delete orphaned external agent");
5004
+ }
5005
+ }
5006
+ }
5007
+ if (deletedInternalCount > 0 || deletedExternalCount > 0) {
5008
+ logger12.info(
5009
+ {
5010
+ deletedInternalCount,
5011
+ deletedExternalCount,
5012
+ totalDeleted: deletedInternalCount + deletedExternalCount
5013
+ },
5014
+ "Deleted orphaned agents from graph"
5015
+ );
5016
+ }
4970
5017
  await updateAgentGraph(db)({
4971
5018
  scopes: { tenantId, projectId, graphId: typedGraphDefinition.id },
4972
5019
  data: {
@@ -6415,6 +6462,36 @@ var updateFullProjectServerSide = (db, logger12 = defaultLogger2) => async (scop
6415
6462
  "All project artifactComponents updated successfully"
6416
6463
  );
6417
6464
  }
6465
+ const incomingGraphIds = new Set(Object.keys(typed.graphs || {}));
6466
+ const existingGraphs = await listAgentGraphs(db)({
6467
+ scopes: { tenantId, projectId: typed.id }
6468
+ });
6469
+ let deletedGraphCount = 0;
6470
+ for (const graph of existingGraphs) {
6471
+ if (!incomingGraphIds.has(graph.id)) {
6472
+ try {
6473
+ await deleteFullGraph(db, logger12)({
6474
+ scopes: { tenantId, projectId: typed.id, graphId: graph.id }
6475
+ });
6476
+ deletedGraphCount++;
6477
+ logger12.info({ graphId: graph.id }, "Deleted orphaned graph from project");
6478
+ } catch (error) {
6479
+ logger12.error(
6480
+ { graphId: graph.id, error },
6481
+ "Failed to delete orphaned graph from project"
6482
+ );
6483
+ }
6484
+ }
6485
+ }
6486
+ if (deletedGraphCount > 0) {
6487
+ logger12.info(
6488
+ {
6489
+ deletedGraphCount,
6490
+ projectId: typed.id
6491
+ },
6492
+ "Deleted orphaned graphs from project"
6493
+ );
6494
+ }
6418
6495
  if (typed.graphs && Object.keys(typed.graphs).length > 0) {
6419
6496
  logger12.info(
6420
6497
  {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inkeep/agents-core",
3
- "version": "0.0.0-dev-20250930012707",
3
+ "version": "0.0.0-dev-20250930044500",
4
4
  "description": "Agents Core contains the database schema, types, and validation schemas for Inkeep Agent Framework, along with core components.",
5
5
  "type": "module",
6
6
  "license": "SEE LICENSE IN LICENSE.md",