@inkeep/agents-run-api 0.29.1 → 0.29.3
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 +76 -5
- package/dist/index.js +76 -5
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -10123,10 +10123,19 @@ var createTaskHandler = (config, credentialStoreRegistry) => {
|
|
|
10123
10123
|
subAgentId: relation.id
|
|
10124
10124
|
}
|
|
10125
10125
|
});
|
|
10126
|
-
const
|
|
10126
|
+
const relatedAgentTeamAgentRelations = await agentsCore.getTeamAgentsForSubAgent(dbClient_default)({
|
|
10127
|
+
scopes: {
|
|
10128
|
+
tenantId: config.tenantId,
|
|
10129
|
+
projectId: config.projectId,
|
|
10130
|
+
agentId: config.agentId,
|
|
10131
|
+
subAgentId: relation.id
|
|
10132
|
+
}
|
|
10133
|
+
});
|
|
10134
|
+
const enhancedDescription = generateDescriptionWithRelationData(
|
|
10127
10135
|
relation.description || "",
|
|
10128
10136
|
relatedAgentRelations.data,
|
|
10129
|
-
relatedAgentExternalAgentRelations.data
|
|
10137
|
+
relatedAgentExternalAgentRelations.data,
|
|
10138
|
+
relatedAgentTeamAgentRelations.data
|
|
10130
10139
|
);
|
|
10131
10140
|
return { ...relation, description: enhancedDescription };
|
|
10132
10141
|
}
|
|
@@ -10136,6 +10145,67 @@ var createTaskHandler = (config, credentialStoreRegistry) => {
|
|
|
10136
10145
|
return relation;
|
|
10137
10146
|
})
|
|
10138
10147
|
);
|
|
10148
|
+
const enhancedTeamRelations = await Promise.all(
|
|
10149
|
+
teamRelations.data.map(async (relation) => {
|
|
10150
|
+
try {
|
|
10151
|
+
const teamAgentWithDefault = await agentsCore.getAgentWithDefaultSubAgent(dbClient_default)({
|
|
10152
|
+
scopes: {
|
|
10153
|
+
tenantId: config.tenantId,
|
|
10154
|
+
projectId: config.projectId,
|
|
10155
|
+
agentId: relation.targetAgentId
|
|
10156
|
+
}
|
|
10157
|
+
});
|
|
10158
|
+
if (teamAgentWithDefault?.defaultSubAgent) {
|
|
10159
|
+
const defaultSubAgent = teamAgentWithDefault.defaultSubAgent;
|
|
10160
|
+
const relatedAgentRelations = await agentsCore.getRelatedAgentsForAgent(dbClient_default)({
|
|
10161
|
+
scopes: {
|
|
10162
|
+
tenantId: config.tenantId,
|
|
10163
|
+
projectId: config.projectId,
|
|
10164
|
+
agentId: relation.targetAgentId
|
|
10165
|
+
},
|
|
10166
|
+
subAgentId: defaultSubAgent.id
|
|
10167
|
+
});
|
|
10168
|
+
const relatedAgentExternalAgentRelations = await agentsCore.getExternalAgentsForSubAgent(
|
|
10169
|
+
dbClient_default
|
|
10170
|
+
)({
|
|
10171
|
+
scopes: {
|
|
10172
|
+
tenantId: config.tenantId,
|
|
10173
|
+
projectId: config.projectId,
|
|
10174
|
+
agentId: relation.targetAgentId,
|
|
10175
|
+
subAgentId: defaultSubAgent.id
|
|
10176
|
+
}
|
|
10177
|
+
});
|
|
10178
|
+
const relatedAgentTeamAgentRelations = await agentsCore.getTeamAgentsForSubAgent(dbClient_default)({
|
|
10179
|
+
scopes: {
|
|
10180
|
+
tenantId: config.tenantId,
|
|
10181
|
+
projectId: config.projectId,
|
|
10182
|
+
agentId: relation.targetAgentId,
|
|
10183
|
+
subAgentId: defaultSubAgent.id
|
|
10184
|
+
}
|
|
10185
|
+
});
|
|
10186
|
+
const enhancedDescription = generateDescriptionWithRelationData(
|
|
10187
|
+
teamAgentWithDefault.description || "",
|
|
10188
|
+
relatedAgentRelations.data,
|
|
10189
|
+
relatedAgentExternalAgentRelations.data,
|
|
10190
|
+
relatedAgentTeamAgentRelations.data
|
|
10191
|
+
);
|
|
10192
|
+
return {
|
|
10193
|
+
...relation,
|
|
10194
|
+
targetAgent: {
|
|
10195
|
+
...relation.targetAgent,
|
|
10196
|
+
description: enhancedDescription
|
|
10197
|
+
}
|
|
10198
|
+
};
|
|
10199
|
+
}
|
|
10200
|
+
} catch (error) {
|
|
10201
|
+
logger20.warn(
|
|
10202
|
+
{ targetAgentId: relation.targetAgentId, error },
|
|
10203
|
+
"Failed to enhance team agent description"
|
|
10204
|
+
);
|
|
10205
|
+
}
|
|
10206
|
+
return relation;
|
|
10207
|
+
})
|
|
10208
|
+
);
|
|
10139
10209
|
const prompt = "prompt" in config.agentSchema ? config.agentSchema.prompt : "";
|
|
10140
10210
|
const models = "models" in config.agentSchema ? config.agentSchema.models : void 0;
|
|
10141
10211
|
const stopWhen = "stopWhen" in config.agentSchema ? config.agentSchema.stopWhen : void 0;
|
|
@@ -10216,7 +10286,7 @@ var createTaskHandler = (config, credentialStoreRegistry) => {
|
|
|
10216
10286
|
relationType: "delegate"
|
|
10217
10287
|
}
|
|
10218
10288
|
})),
|
|
10219
|
-
...
|
|
10289
|
+
...enhancedTeamRelations.map((relation) => ({
|
|
10220
10290
|
type: "team",
|
|
10221
10291
|
config: {
|
|
10222
10292
|
id: relation.targetAgent.id,
|
|
@@ -10478,11 +10548,12 @@ function createAgentCard({
|
|
|
10478
10548
|
}
|
|
10479
10549
|
};
|
|
10480
10550
|
}
|
|
10481
|
-
function
|
|
10551
|
+
function generateDescriptionWithRelationData(baseDescription, internalRelations, externalRelations, teamRelations) {
|
|
10482
10552
|
const transfers = [...internalRelations.filter((rel) => rel.relationType === "transfer")];
|
|
10483
10553
|
const delegates = [
|
|
10484
10554
|
...internalRelations.filter((rel) => rel.relationType === "delegate"),
|
|
10485
|
-
...externalRelations.map((data) => data.externalAgent)
|
|
10555
|
+
...externalRelations.map((data) => data.externalAgent),
|
|
10556
|
+
...teamRelations.map((data) => data.targetAgent)
|
|
10486
10557
|
];
|
|
10487
10558
|
if (transfers.length === 0 && delegates.length === 0) {
|
|
10488
10559
|
return baseDescription;
|
package/dist/index.js
CHANGED
|
@@ -8650,10 +8650,19 @@ var createTaskHandler = (config, credentialStoreRegistry) => {
|
|
|
8650
8650
|
subAgentId: relation.id
|
|
8651
8651
|
}
|
|
8652
8652
|
});
|
|
8653
|
-
const
|
|
8653
|
+
const relatedAgentTeamAgentRelations = await getTeamAgentsForSubAgent(dbClient_default)({
|
|
8654
|
+
scopes: {
|
|
8655
|
+
tenantId: config.tenantId,
|
|
8656
|
+
projectId: config.projectId,
|
|
8657
|
+
agentId: config.agentId,
|
|
8658
|
+
subAgentId: relation.id
|
|
8659
|
+
}
|
|
8660
|
+
});
|
|
8661
|
+
const enhancedDescription = generateDescriptionWithRelationData(
|
|
8654
8662
|
relation.description || "",
|
|
8655
8663
|
relatedAgentRelations.data,
|
|
8656
|
-
relatedAgentExternalAgentRelations.data
|
|
8664
|
+
relatedAgentExternalAgentRelations.data,
|
|
8665
|
+
relatedAgentTeamAgentRelations.data
|
|
8657
8666
|
);
|
|
8658
8667
|
return { ...relation, description: enhancedDescription };
|
|
8659
8668
|
}
|
|
@@ -8663,6 +8672,67 @@ var createTaskHandler = (config, credentialStoreRegistry) => {
|
|
|
8663
8672
|
return relation;
|
|
8664
8673
|
})
|
|
8665
8674
|
);
|
|
8675
|
+
const enhancedTeamRelations = await Promise.all(
|
|
8676
|
+
teamRelations.data.map(async (relation) => {
|
|
8677
|
+
try {
|
|
8678
|
+
const teamAgentWithDefault = await getAgentWithDefaultSubAgent(dbClient_default)({
|
|
8679
|
+
scopes: {
|
|
8680
|
+
tenantId: config.tenantId,
|
|
8681
|
+
projectId: config.projectId,
|
|
8682
|
+
agentId: relation.targetAgentId
|
|
8683
|
+
}
|
|
8684
|
+
});
|
|
8685
|
+
if (teamAgentWithDefault?.defaultSubAgent) {
|
|
8686
|
+
const defaultSubAgent = teamAgentWithDefault.defaultSubAgent;
|
|
8687
|
+
const relatedAgentRelations = await getRelatedAgentsForAgent(dbClient_default)({
|
|
8688
|
+
scopes: {
|
|
8689
|
+
tenantId: config.tenantId,
|
|
8690
|
+
projectId: config.projectId,
|
|
8691
|
+
agentId: relation.targetAgentId
|
|
8692
|
+
},
|
|
8693
|
+
subAgentId: defaultSubAgent.id
|
|
8694
|
+
});
|
|
8695
|
+
const relatedAgentExternalAgentRelations = await getExternalAgentsForSubAgent(
|
|
8696
|
+
dbClient_default
|
|
8697
|
+
)({
|
|
8698
|
+
scopes: {
|
|
8699
|
+
tenantId: config.tenantId,
|
|
8700
|
+
projectId: config.projectId,
|
|
8701
|
+
agentId: relation.targetAgentId,
|
|
8702
|
+
subAgentId: defaultSubAgent.id
|
|
8703
|
+
}
|
|
8704
|
+
});
|
|
8705
|
+
const relatedAgentTeamAgentRelations = await getTeamAgentsForSubAgent(dbClient_default)({
|
|
8706
|
+
scopes: {
|
|
8707
|
+
tenantId: config.tenantId,
|
|
8708
|
+
projectId: config.projectId,
|
|
8709
|
+
agentId: relation.targetAgentId,
|
|
8710
|
+
subAgentId: defaultSubAgent.id
|
|
8711
|
+
}
|
|
8712
|
+
});
|
|
8713
|
+
const enhancedDescription = generateDescriptionWithRelationData(
|
|
8714
|
+
teamAgentWithDefault.description || "",
|
|
8715
|
+
relatedAgentRelations.data,
|
|
8716
|
+
relatedAgentExternalAgentRelations.data,
|
|
8717
|
+
relatedAgentTeamAgentRelations.data
|
|
8718
|
+
);
|
|
8719
|
+
return {
|
|
8720
|
+
...relation,
|
|
8721
|
+
targetAgent: {
|
|
8722
|
+
...relation.targetAgent,
|
|
8723
|
+
description: enhancedDescription
|
|
8724
|
+
}
|
|
8725
|
+
};
|
|
8726
|
+
}
|
|
8727
|
+
} catch (error) {
|
|
8728
|
+
logger16.warn(
|
|
8729
|
+
{ targetAgentId: relation.targetAgentId, error },
|
|
8730
|
+
"Failed to enhance team agent description"
|
|
8731
|
+
);
|
|
8732
|
+
}
|
|
8733
|
+
return relation;
|
|
8734
|
+
})
|
|
8735
|
+
);
|
|
8666
8736
|
const prompt = "prompt" in config.agentSchema ? config.agentSchema.prompt : "";
|
|
8667
8737
|
const models = "models" in config.agentSchema ? config.agentSchema.models : void 0;
|
|
8668
8738
|
const stopWhen = "stopWhen" in config.agentSchema ? config.agentSchema.stopWhen : void 0;
|
|
@@ -8743,7 +8813,7 @@ var createTaskHandler = (config, credentialStoreRegistry) => {
|
|
|
8743
8813
|
relationType: "delegate"
|
|
8744
8814
|
}
|
|
8745
8815
|
})),
|
|
8746
|
-
...
|
|
8816
|
+
...enhancedTeamRelations.map((relation) => ({
|
|
8747
8817
|
type: "team",
|
|
8748
8818
|
config: {
|
|
8749
8819
|
id: relation.targetAgent.id,
|
|
@@ -9003,11 +9073,12 @@ function createAgentCard({
|
|
|
9003
9073
|
}
|
|
9004
9074
|
};
|
|
9005
9075
|
}
|
|
9006
|
-
function
|
|
9076
|
+
function generateDescriptionWithRelationData(baseDescription, internalRelations, externalRelations, teamRelations) {
|
|
9007
9077
|
const transfers = [...internalRelations.filter((rel) => rel.relationType === "transfer")];
|
|
9008
9078
|
const delegates = [
|
|
9009
9079
|
...internalRelations.filter((rel) => rel.relationType === "delegate"),
|
|
9010
|
-
...externalRelations.map((data) => data.externalAgent)
|
|
9080
|
+
...externalRelations.map((data) => data.externalAgent),
|
|
9081
|
+
...teamRelations.map((data) => data.targetAgent)
|
|
9011
9082
|
];
|
|
9012
9083
|
if (transfers.length === 0 && delegates.length === 0) {
|
|
9013
9084
|
return baseDescription;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@inkeep/agents-run-api",
|
|
3
|
-
"version": "0.29.
|
|
3
|
+
"version": "0.29.3",
|
|
4
4
|
"description": "Agents Run API for Inkeep Agent Framework - handles chat, agent execution, and streaming",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
"traverse": "^0.6.11",
|
|
53
53
|
"ts-pattern": "^5.7.1",
|
|
54
54
|
"zod": "^4.1.11",
|
|
55
|
-
"@inkeep/agents-core": "^0.29.
|
|
55
|
+
"@inkeep/agents-core": "^0.29.3"
|
|
56
56
|
},
|
|
57
57
|
"optionalDependencies": {
|
|
58
58
|
"keytar": "^7.9.0"
|