@inkeep/agents-core 0.29.2 → 0.29.4

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
@@ -221461,18 +221461,22 @@ var updateFullAgentServerSide = (db, logger15 = defaultLogger) => async (scopes,
221461
221461
  "Deleted orphaned sub-agents from agent"
221462
221462
  );
221463
221463
  }
221464
- const incomingExternalAgentRelationIds = /* @__PURE__ */ new Set();
221465
- const incomingTeamAgentRelationIds = /* @__PURE__ */ new Set();
221466
- for (const [_subAgentId, agentData2] of Object.entries(typedAgentDefinition.subAgents)) {
221464
+ const incomingExternalAgentRelationIds = /* @__PURE__ */ new Map();
221465
+ const incomingTeamAgentRelationIds = /* @__PURE__ */ new Map();
221466
+ for (const [subAgentId, agentData2] of Object.entries(typedAgentDefinition.subAgents)) {
221467
221467
  if (agentData2.canDelegateTo && Array.isArray(agentData2.canDelegateTo)) {
221468
221468
  for (const delegateItem of agentData2.canDelegateTo) {
221469
221469
  if (typeof delegateItem === "object") {
221470
221470
  if ("externalAgentId" in delegateItem) {
221471
- incomingExternalAgentRelationIds.add(
221471
+ incomingExternalAgentRelationIds.set(
221472
+ subAgentId,
221472
221473
  delegateItem.subAgentExternalAgentRelationId ?? ""
221473
221474
  );
221474
221475
  } else if ("agentId" in delegateItem) {
221475
- incomingTeamAgentRelationIds.add(delegateItem.subAgentTeamAgentRelationId ?? "");
221476
+ incomingTeamAgentRelationIds.set(
221477
+ subAgentId,
221478
+ delegateItem.subAgentTeamAgentRelationId ?? ""
221479
+ );
221476
221480
  }
221477
221481
  }
221478
221482
  }
@@ -221483,7 +221487,7 @@ var updateFullAgentServerSide = (db, logger15 = defaultLogger) => async (scopes,
221483
221487
  });
221484
221488
  let deletedExternalAgentRelationCount = 0;
221485
221489
  for (const relation of existingExternalAgentRelations) {
221486
- if (!incomingExternalAgentRelationIds.has(relation.id)) {
221490
+ if (!incomingExternalAgentRelationIds.get(relation.subAgentId)?.includes(relation.id)) {
221487
221491
  try {
221488
221492
  await deleteSubAgentExternalAgentRelation(db)({
221489
221493
  scopes: {
@@ -221514,7 +221518,7 @@ var updateFullAgentServerSide = (db, logger15 = defaultLogger) => async (scopes,
221514
221518
  scopes: { tenantId, projectId, agentId: finalAgentId }
221515
221519
  });
221516
221520
  for (const relation of existingTeamAgentRelations) {
221517
- if (!incomingTeamAgentRelationIds.has(relation.id)) {
221521
+ if (!incomingTeamAgentRelationIds.get(relation.subAgentId)?.includes(relation.id)) {
221518
221522
  try {
221519
221523
  await deleteSubAgentTeamAgentRelation(db)({
221520
221524
  scopes: {
@@ -221817,6 +221821,7 @@ var updateFullAgentServerSide = (db, logger15 = defaultLogger) => async (scopes,
221817
221821
  })()
221818
221822
  );
221819
221823
  } else if ("agentId" in targetItem) {
221824
+ logger15.info({ subAgentId, targetItem }, "Processing team agent delegation");
221820
221825
  subAgentTeamAgentRelationPromises.push(
221821
221826
  (async () => {
221822
221827
  try {
@@ -221856,6 +221861,13 @@ var updateFullAgentServerSide = (db, logger15 = defaultLogger) => async (scopes,
221856
221861
  },
221857
221862
  "All sub-agent external agent relations updated"
221858
221863
  );
221864
+ await Promise.all(subAgentTeamAgentRelationPromises);
221865
+ logger15.info(
221866
+ {
221867
+ subAgentTeamAgentRelationPromisesCount: subAgentTeamAgentRelationPromises.length
221868
+ },
221869
+ "All sub-agent team agent relations updated"
221870
+ );
221859
221871
  const updatedAgent = await getFullAgentDefinition(db)({
221860
221872
  scopes: { tenantId, projectId, agentId: typedAgentDefinition.id }
221861
221873
  });
package/dist/index.js CHANGED
@@ -218563,18 +218563,22 @@ var updateFullAgentServerSide = (db, logger14 = defaultLogger) => async (scopes,
218563
218563
  "Deleted orphaned sub-agents from agent"
218564
218564
  );
218565
218565
  }
218566
- const incomingExternalAgentRelationIds = /* @__PURE__ */ new Set();
218567
- const incomingTeamAgentRelationIds = /* @__PURE__ */ new Set();
218568
- for (const [_subAgentId, agentData2] of Object.entries(typedAgentDefinition.subAgents)) {
218566
+ const incomingExternalAgentRelationIds = /* @__PURE__ */ new Map();
218567
+ const incomingTeamAgentRelationIds = /* @__PURE__ */ new Map();
218568
+ for (const [subAgentId, agentData2] of Object.entries(typedAgentDefinition.subAgents)) {
218569
218569
  if (agentData2.canDelegateTo && Array.isArray(agentData2.canDelegateTo)) {
218570
218570
  for (const delegateItem of agentData2.canDelegateTo) {
218571
218571
  if (typeof delegateItem === "object") {
218572
218572
  if ("externalAgentId" in delegateItem) {
218573
- incomingExternalAgentRelationIds.add(
218573
+ incomingExternalAgentRelationIds.set(
218574
+ subAgentId,
218574
218575
  delegateItem.subAgentExternalAgentRelationId ?? ""
218575
218576
  );
218576
218577
  } else if ("agentId" in delegateItem) {
218577
- incomingTeamAgentRelationIds.add(delegateItem.subAgentTeamAgentRelationId ?? "");
218578
+ incomingTeamAgentRelationIds.set(
218579
+ subAgentId,
218580
+ delegateItem.subAgentTeamAgentRelationId ?? ""
218581
+ );
218578
218582
  }
218579
218583
  }
218580
218584
  }
@@ -218585,7 +218589,7 @@ var updateFullAgentServerSide = (db, logger14 = defaultLogger) => async (scopes,
218585
218589
  });
218586
218590
  let deletedExternalAgentRelationCount = 0;
218587
218591
  for (const relation of existingExternalAgentRelations) {
218588
- if (!incomingExternalAgentRelationIds.has(relation.id)) {
218592
+ if (!incomingExternalAgentRelationIds.get(relation.subAgentId)?.includes(relation.id)) {
218589
218593
  try {
218590
218594
  await deleteSubAgentExternalAgentRelation(db)({
218591
218595
  scopes: {
@@ -218616,7 +218620,7 @@ var updateFullAgentServerSide = (db, logger14 = defaultLogger) => async (scopes,
218616
218620
  scopes: { tenantId, projectId, agentId: finalAgentId }
218617
218621
  });
218618
218622
  for (const relation of existingTeamAgentRelations) {
218619
- if (!incomingTeamAgentRelationIds.has(relation.id)) {
218623
+ if (!incomingTeamAgentRelationIds.get(relation.subAgentId)?.includes(relation.id)) {
218620
218624
  try {
218621
218625
  await deleteSubAgentTeamAgentRelation(db)({
218622
218626
  scopes: {
@@ -218919,6 +218923,7 @@ var updateFullAgentServerSide = (db, logger14 = defaultLogger) => async (scopes,
218919
218923
  })()
218920
218924
  );
218921
218925
  } else if ("agentId" in targetItem) {
218926
+ logger14.info({ subAgentId, targetItem }, "Processing team agent delegation");
218922
218927
  subAgentTeamAgentRelationPromises.push(
218923
218928
  (async () => {
218924
218929
  try {
@@ -218958,6 +218963,13 @@ var updateFullAgentServerSide = (db, logger14 = defaultLogger) => async (scopes,
218958
218963
  },
218959
218964
  "All sub-agent external agent relations updated"
218960
218965
  );
218966
+ await Promise.all(subAgentTeamAgentRelationPromises);
218967
+ logger14.info(
218968
+ {
218969
+ subAgentTeamAgentRelationPromisesCount: subAgentTeamAgentRelationPromises.length
218970
+ },
218971
+ "All sub-agent team agent relations updated"
218972
+ );
218961
218973
  const updatedAgent = await getFullAgentDefinition(db)({
218962
218974
  scopes: { tenantId, projectId, agentId: typedAgentDefinition.id }
218963
218975
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inkeep/agents-core",
3
- "version": "0.29.2",
3
+ "version": "0.29.4",
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",