@inkeep/agents-sdk 0.21.1 → 0.22.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.
- package/dist/index.cjs +126 -61
- package/dist/index.d.cts +50 -5
- package/dist/index.d.ts +50 -5
- package/dist/index.js +125 -62
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -404,7 +404,9 @@ var FunctionTool = class {
|
|
|
404
404
|
for (const dep in deps) {
|
|
405
405
|
if (deps[dep] === false) {
|
|
406
406
|
delete deps[dep];
|
|
407
|
-
throw new Error(
|
|
407
|
+
throw new Error(
|
|
408
|
+
`Dependency \x1B[1;32m${dep}\x1B[0m used in function tool \x1B[1;32m${config.name}\x1B[0m is neither installed nor in dependencies object.`
|
|
409
|
+
);
|
|
408
410
|
}
|
|
409
411
|
}
|
|
410
412
|
this.config.dependencies = deps;
|
|
@@ -664,6 +666,31 @@ var Agent = class {
|
|
|
664
666
|
};
|
|
665
667
|
}
|
|
666
668
|
}
|
|
669
|
+
const processedStatusUpdates = this.statusUpdateSettings ? {
|
|
670
|
+
...this.statusUpdateSettings,
|
|
671
|
+
statusComponents: this.statusUpdateSettings.statusComponents?.map((comp) => {
|
|
672
|
+
if (comp && typeof comp.getType === "function") {
|
|
673
|
+
return {
|
|
674
|
+
type: comp.getType(),
|
|
675
|
+
description: comp.getDescription(),
|
|
676
|
+
detailsSchema: comp.getDetailsSchema()
|
|
677
|
+
};
|
|
678
|
+
}
|
|
679
|
+
if (comp && typeof comp === "object" && comp.detailsSchema && schemaConversion.isZodSchema(comp.detailsSchema)) {
|
|
680
|
+
const jsonSchema = schemaConversion.convertZodToJsonSchema(comp.detailsSchema);
|
|
681
|
+
return {
|
|
682
|
+
type: comp.type,
|
|
683
|
+
description: comp.description,
|
|
684
|
+
detailsSchema: {
|
|
685
|
+
type: "object",
|
|
686
|
+
properties: jsonSchema.properties || {},
|
|
687
|
+
required: jsonSchema.required || void 0
|
|
688
|
+
}
|
|
689
|
+
};
|
|
690
|
+
}
|
|
691
|
+
return comp;
|
|
692
|
+
})
|
|
693
|
+
} : void 0;
|
|
667
694
|
return {
|
|
668
695
|
id: this.agentId,
|
|
669
696
|
name: this.agentName,
|
|
@@ -674,7 +701,7 @@ var Agent = class {
|
|
|
674
701
|
...Object.keys(functionToolsObject).length > 0 && { functionTools: functionToolsObject },
|
|
675
702
|
...Object.keys(functionsObject).length > 0 && { functions: functionsObject },
|
|
676
703
|
models: this.models,
|
|
677
|
-
statusUpdates:
|
|
704
|
+
statusUpdates: processedStatusUpdates,
|
|
678
705
|
prompt: this.prompt,
|
|
679
706
|
createdAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
680
707
|
updatedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
@@ -2062,7 +2089,6 @@ var Project = class {
|
|
|
2062
2089
|
__publicField(this, "initialized", false);
|
|
2063
2090
|
__publicField(this, "models");
|
|
2064
2091
|
__publicField(this, "stopWhen");
|
|
2065
|
-
__publicField(this, "sandboxConfig");
|
|
2066
2092
|
__publicField(this, "agents", []);
|
|
2067
2093
|
__publicField(this, "agentMap", /* @__PURE__ */ new Map());
|
|
2068
2094
|
__publicField(this, "credentialReferences", []);
|
|
@@ -2076,7 +2102,6 @@ var Project = class {
|
|
|
2076
2102
|
this.baseURL = process.env.INKEEP_API_URL || "http://localhost:3002";
|
|
2077
2103
|
this.models = config.models;
|
|
2078
2104
|
this.stopWhen = config.stopWhen;
|
|
2079
|
-
this.sandboxConfig = config.sandboxConfig;
|
|
2080
2105
|
if (config.agents) {
|
|
2081
2106
|
this.agents = config.agents();
|
|
2082
2107
|
this.agentMap = new Map(this.agents.map((agent2) => [agent2.getId(), agent2]));
|
|
@@ -2635,7 +2660,6 @@ var Project = class {
|
|
|
2635
2660
|
description: this.projectDescription || "",
|
|
2636
2661
|
models: this.models,
|
|
2637
2662
|
stopWhen: this.stopWhen,
|
|
2638
|
-
sandboxConfig: this.sandboxConfig,
|
|
2639
2663
|
agents: agentsObject,
|
|
2640
2664
|
tools: toolsObject,
|
|
2641
2665
|
functions: Object.keys(functionsObject).length > 0 ? functionsObject : void 0,
|
|
@@ -2647,7 +2671,43 @@ var Project = class {
|
|
|
2647
2671
|
};
|
|
2648
2672
|
}
|
|
2649
2673
|
};
|
|
2650
|
-
var logger9 = agentsCore.getLogger("
|
|
2674
|
+
var logger9 = agentsCore.getLogger("statusComponent");
|
|
2675
|
+
var StatusComponent = class {
|
|
2676
|
+
constructor(config) {
|
|
2677
|
+
__publicField(this, "config");
|
|
2678
|
+
let processedDetailsSchema;
|
|
2679
|
+
if (config.detailsSchema && schemaConversion.isZodSchema(config.detailsSchema)) {
|
|
2680
|
+
const jsonSchema = schemaConversion.convertZodToJsonSchema(config.detailsSchema);
|
|
2681
|
+
processedDetailsSchema = {
|
|
2682
|
+
type: "object",
|
|
2683
|
+
properties: jsonSchema.properties || {},
|
|
2684
|
+
required: jsonSchema.required || void 0
|
|
2685
|
+
};
|
|
2686
|
+
} else {
|
|
2687
|
+
processedDetailsSchema = config.detailsSchema;
|
|
2688
|
+
}
|
|
2689
|
+
this.config = {
|
|
2690
|
+
...config,
|
|
2691
|
+
detailsSchema: processedDetailsSchema
|
|
2692
|
+
};
|
|
2693
|
+
logger9.info(
|
|
2694
|
+
{
|
|
2695
|
+
statusComponentType: config.type
|
|
2696
|
+
},
|
|
2697
|
+
"StatusComponent constructor initialized"
|
|
2698
|
+
);
|
|
2699
|
+
}
|
|
2700
|
+
getType() {
|
|
2701
|
+
return this.config.type;
|
|
2702
|
+
}
|
|
2703
|
+
getDescription() {
|
|
2704
|
+
return this.config.description;
|
|
2705
|
+
}
|
|
2706
|
+
getDetailsSchema() {
|
|
2707
|
+
return this.config.detailsSchema;
|
|
2708
|
+
}
|
|
2709
|
+
};
|
|
2710
|
+
var logger10 = agentsCore.getLogger("tool");
|
|
2651
2711
|
var Tool = class {
|
|
2652
2712
|
constructor(config) {
|
|
2653
2713
|
__publicField(this, "config");
|
|
@@ -2659,7 +2719,7 @@ var Tool = class {
|
|
|
2659
2719
|
this.baseURL = process.env.INKEEP_API_URL || "http://localhost:3002";
|
|
2660
2720
|
this.tenantId = "default";
|
|
2661
2721
|
this.projectId = "default";
|
|
2662
|
-
|
|
2722
|
+
logger10.info(
|
|
2663
2723
|
{
|
|
2664
2724
|
Id: this.getId(),
|
|
2665
2725
|
Name: config.name
|
|
@@ -2701,7 +2761,7 @@ var Tool = class {
|
|
|
2701
2761
|
if (!options?.skipDatabaseRegistration) {
|
|
2702
2762
|
await this.upsertTool();
|
|
2703
2763
|
}
|
|
2704
|
-
|
|
2764
|
+
logger10.info(
|
|
2705
2765
|
{
|
|
2706
2766
|
toolId: this.getId()
|
|
2707
2767
|
},
|
|
@@ -2709,7 +2769,7 @@ var Tool = class {
|
|
|
2709
2769
|
);
|
|
2710
2770
|
this.initialized = true;
|
|
2711
2771
|
} catch (error) {
|
|
2712
|
-
|
|
2772
|
+
logger10.error(
|
|
2713
2773
|
{
|
|
2714
2774
|
toolId: this.getId(),
|
|
2715
2775
|
error: error instanceof Error ? error.message : "Unknown error"
|
|
@@ -2741,7 +2801,7 @@ var Tool = class {
|
|
|
2741
2801
|
const toolDataForCreate = {
|
|
2742
2802
|
...toolDataForUpdate
|
|
2743
2803
|
};
|
|
2744
|
-
|
|
2804
|
+
logger10.info({ toolDataForCreate }, "toolDataForCreate");
|
|
2745
2805
|
const updateResponse = await fetch(
|
|
2746
2806
|
`${this.baseURL}/tenants/${this.tenantId}/projects/${this.projectId}/tools/${this.getId()}`,
|
|
2747
2807
|
{
|
|
@@ -2752,9 +2812,9 @@ var Tool = class {
|
|
|
2752
2812
|
body: JSON.stringify(toolDataForUpdate)
|
|
2753
2813
|
}
|
|
2754
2814
|
);
|
|
2755
|
-
|
|
2815
|
+
logger10.info({ updateResponse }, "tool updateResponse");
|
|
2756
2816
|
if (updateResponse.ok) {
|
|
2757
|
-
|
|
2817
|
+
logger10.info(
|
|
2758
2818
|
{
|
|
2759
2819
|
toolId: this.getId()
|
|
2760
2820
|
},
|
|
@@ -2763,7 +2823,7 @@ var Tool = class {
|
|
|
2763
2823
|
return;
|
|
2764
2824
|
}
|
|
2765
2825
|
if (updateResponse.status === 404) {
|
|
2766
|
-
|
|
2826
|
+
logger10.info(
|
|
2767
2827
|
{
|
|
2768
2828
|
toolId: this.getId()
|
|
2769
2829
|
},
|
|
@@ -2782,7 +2842,7 @@ var Tool = class {
|
|
|
2782
2842
|
if (!createResponse.ok) {
|
|
2783
2843
|
throw new Error(`Failed to create tool: ${createResponse.status}`);
|
|
2784
2844
|
}
|
|
2785
|
-
|
|
2845
|
+
logger10.info(
|
|
2786
2846
|
{
|
|
2787
2847
|
toolId: this.getId()
|
|
2788
2848
|
},
|
|
@@ -2823,7 +2883,7 @@ function normalizeAgentCanUseType(value, fallbackName) {
|
|
|
2823
2883
|
}
|
|
2824
2884
|
|
|
2825
2885
|
// src/subAgent.ts
|
|
2826
|
-
var
|
|
2886
|
+
var logger11 = agentsCore.getLogger("agent");
|
|
2827
2887
|
function resolveGetter2(value) {
|
|
2828
2888
|
if (typeof value === "function") {
|
|
2829
2889
|
return value();
|
|
@@ -2842,7 +2902,7 @@ var SubAgent = class {
|
|
|
2842
2902
|
this.baseURL = process.env.INKEEP_API_URL || "http://localhost:3002";
|
|
2843
2903
|
this.tenantId = "default";
|
|
2844
2904
|
this.projectId = "default";
|
|
2845
|
-
|
|
2905
|
+
logger11.info(
|
|
2846
2906
|
{
|
|
2847
2907
|
tenantId: this.tenantId,
|
|
2848
2908
|
subAgentId: this.config.id,
|
|
@@ -2992,7 +3052,7 @@ var SubAgent = class {
|
|
|
2992
3052
|
await this.saveToolsAndRelations();
|
|
2993
3053
|
await this.saveDataComponents();
|
|
2994
3054
|
await this.saveArtifactComponents();
|
|
2995
|
-
|
|
3055
|
+
logger11.info(
|
|
2996
3056
|
{
|
|
2997
3057
|
subAgentId: this.getId()
|
|
2998
3058
|
},
|
|
@@ -3000,7 +3060,7 @@ var SubAgent = class {
|
|
|
3000
3060
|
);
|
|
3001
3061
|
this.initialized = true;
|
|
3002
3062
|
} catch (error) {
|
|
3003
|
-
|
|
3063
|
+
logger11.error(
|
|
3004
3064
|
{
|
|
3005
3065
|
subAgentId: this.getId(),
|
|
3006
3066
|
error: error instanceof Error ? error.message : "Unknown error"
|
|
@@ -3032,7 +3092,7 @@ var SubAgent = class {
|
|
|
3032
3092
|
}
|
|
3033
3093
|
);
|
|
3034
3094
|
if (updateResponse.ok) {
|
|
3035
|
-
|
|
3095
|
+
logger11.info(
|
|
3036
3096
|
{
|
|
3037
3097
|
subAgentId: this.getId()
|
|
3038
3098
|
},
|
|
@@ -3041,7 +3101,7 @@ var SubAgent = class {
|
|
|
3041
3101
|
return;
|
|
3042
3102
|
}
|
|
3043
3103
|
if (updateResponse.status === 404) {
|
|
3044
|
-
|
|
3104
|
+
logger11.info(
|
|
3045
3105
|
{
|
|
3046
3106
|
subAgentId: this.getId()
|
|
3047
3107
|
},
|
|
@@ -3060,7 +3120,7 @@ var SubAgent = class {
|
|
|
3060
3120
|
`Failed to create agent: ${createResponse.status} ${createResponse.statusText} - ${errorText2}`
|
|
3061
3121
|
);
|
|
3062
3122
|
}
|
|
3063
|
-
|
|
3123
|
+
logger11.info(
|
|
3064
3124
|
{
|
|
3065
3125
|
subAgentId: this.getId()
|
|
3066
3126
|
},
|
|
@@ -3083,7 +3143,7 @@ var SubAgent = class {
|
|
|
3083
3143
|
const normalizedTool = normalizeAgentCanUseType(toolConfig, `tool-${i}`);
|
|
3084
3144
|
await this.createTool(normalizedTool.toolId, toolConfig);
|
|
3085
3145
|
} catch (error) {
|
|
3086
|
-
|
|
3146
|
+
logger11.error(
|
|
3087
3147
|
{
|
|
3088
3148
|
toolId: isAgentMcpConfig(toolConfig) ? toolConfig.server.getId() : toolConfig.getId?.(),
|
|
3089
3149
|
error: error instanceof Error ? error.message : "Unknown error"
|
|
@@ -3097,7 +3157,7 @@ var SubAgent = class {
|
|
|
3097
3157
|
}
|
|
3098
3158
|
}
|
|
3099
3159
|
async saveDataComponents() {
|
|
3100
|
-
|
|
3160
|
+
logger11.info({ dataComponents: this.config.dataComponents }, "dataComponents and config");
|
|
3101
3161
|
const components = resolveGetter2(this.config.dataComponents);
|
|
3102
3162
|
if (components) {
|
|
3103
3163
|
for (const dataComponent2 of components) {
|
|
@@ -3112,7 +3172,7 @@ var SubAgent = class {
|
|
|
3112
3172
|
}
|
|
3113
3173
|
}
|
|
3114
3174
|
async saveArtifactComponents() {
|
|
3115
|
-
|
|
3175
|
+
logger11.info(
|
|
3116
3176
|
{ artifactComponents: this.config.artifactComponents },
|
|
3117
3177
|
"artifactComponents and config"
|
|
3118
3178
|
);
|
|
@@ -3167,7 +3227,7 @@ var SubAgent = class {
|
|
|
3167
3227
|
return acc;
|
|
3168
3228
|
}, []);
|
|
3169
3229
|
this.config.dataComponents = () => uniqueComponents;
|
|
3170
|
-
|
|
3230
|
+
logger11.info(
|
|
3171
3231
|
{
|
|
3172
3232
|
subAgentId: this.getId(),
|
|
3173
3233
|
dbComponentCount: dbDataComponents.length,
|
|
@@ -3177,7 +3237,7 @@ var SubAgent = class {
|
|
|
3177
3237
|
"Loaded and merged data components"
|
|
3178
3238
|
);
|
|
3179
3239
|
} catch (error) {
|
|
3180
|
-
|
|
3240
|
+
logger11.error(
|
|
3181
3241
|
{
|
|
3182
3242
|
subAgentId: this.getId(),
|
|
3183
3243
|
error: error instanceof Error ? error.message : "Unknown error"
|
|
@@ -3224,7 +3284,7 @@ var SubAgent = class {
|
|
|
3224
3284
|
return acc;
|
|
3225
3285
|
}, []);
|
|
3226
3286
|
this.config.artifactComponents = () => uniqueComponents;
|
|
3227
|
-
|
|
3287
|
+
logger11.info(
|
|
3228
3288
|
{
|
|
3229
3289
|
subAgentId: this.getId(),
|
|
3230
3290
|
dbComponentCount: dbArtifactComponents.length,
|
|
@@ -3234,7 +3294,7 @@ var SubAgent = class {
|
|
|
3234
3294
|
"Loaded and merged artifact components"
|
|
3235
3295
|
);
|
|
3236
3296
|
} catch (error) {
|
|
3237
|
-
|
|
3297
|
+
logger11.error(
|
|
3238
3298
|
{
|
|
3239
3299
|
subAgentId: this.getId(),
|
|
3240
3300
|
error: error instanceof Error ? error.message : "Unknown error"
|
|
@@ -3248,7 +3308,7 @@ var SubAgent = class {
|
|
|
3248
3308
|
const functionData = functionTool2.serializeFunction();
|
|
3249
3309
|
const toolData = functionTool2.serializeTool();
|
|
3250
3310
|
const functionUrl = `${this.baseURL}/tenants/${this.tenantId}/crud/projects/${this.projectId}/functions`;
|
|
3251
|
-
|
|
3311
|
+
logger11.info(
|
|
3252
3312
|
{
|
|
3253
3313
|
agentId: this.getId(),
|
|
3254
3314
|
toolId,
|
|
@@ -3268,7 +3328,7 @@ var SubAgent = class {
|
|
|
3268
3328
|
dependencies: functionData.dependencies
|
|
3269
3329
|
})
|
|
3270
3330
|
});
|
|
3271
|
-
|
|
3331
|
+
logger11.info(
|
|
3272
3332
|
{
|
|
3273
3333
|
agentId: this.getId(),
|
|
3274
3334
|
toolId,
|
|
@@ -3279,7 +3339,7 @@ var SubAgent = class {
|
|
|
3279
3339
|
);
|
|
3280
3340
|
if (!functionResponse.ok) {
|
|
3281
3341
|
const errorText = await functionResponse.text();
|
|
3282
|
-
|
|
3342
|
+
logger11.error(
|
|
3283
3343
|
{
|
|
3284
3344
|
agentId: this.getId(),
|
|
3285
3345
|
toolId,
|
|
@@ -3292,7 +3352,7 @@ var SubAgent = class {
|
|
|
3292
3352
|
throw new Error(`Failed to create function: ${functionResponse.status} ${errorText}`);
|
|
3293
3353
|
}
|
|
3294
3354
|
const toolUrl = `${this.baseURL}/tenants/${this.tenantId}/crud/projects/${this.projectId}/tools`;
|
|
3295
|
-
|
|
3355
|
+
logger11.info(
|
|
3296
3356
|
{
|
|
3297
3357
|
agentId: this.getId(),
|
|
3298
3358
|
toolId,
|
|
@@ -3316,7 +3376,7 @@ var SubAgent = class {
|
|
|
3316
3376
|
}
|
|
3317
3377
|
})
|
|
3318
3378
|
});
|
|
3319
|
-
|
|
3379
|
+
logger11.info(
|
|
3320
3380
|
{
|
|
3321
3381
|
agentId: this.getId(),
|
|
3322
3382
|
toolId,
|
|
@@ -3327,7 +3387,7 @@ var SubAgent = class {
|
|
|
3327
3387
|
);
|
|
3328
3388
|
if (!toolResponse.ok) {
|
|
3329
3389
|
const errorText = await toolResponse.text();
|
|
3330
|
-
|
|
3390
|
+
logger11.error(
|
|
3331
3391
|
{
|
|
3332
3392
|
agentId: this.getId(),
|
|
3333
3393
|
toolId,
|
|
@@ -3340,7 +3400,7 @@ var SubAgent = class {
|
|
|
3340
3400
|
throw new Error(`Failed to create tool: ${toolResponse.status} ${errorText}`);
|
|
3341
3401
|
}
|
|
3342
3402
|
await this.createAgentToolRelation(toolData.id);
|
|
3343
|
-
|
|
3403
|
+
logger11.info(
|
|
3344
3404
|
{
|
|
3345
3405
|
agentId: this.getId(),
|
|
3346
3406
|
functionId: functionData.id,
|
|
@@ -3349,7 +3409,7 @@ var SubAgent = class {
|
|
|
3349
3409
|
"Function and tool created successfully"
|
|
3350
3410
|
);
|
|
3351
3411
|
} catch (error) {
|
|
3352
|
-
|
|
3412
|
+
logger11.error(
|
|
3353
3413
|
{
|
|
3354
3414
|
agentId: this.getId(),
|
|
3355
3415
|
toolId,
|
|
@@ -3368,7 +3428,7 @@ var SubAgent = class {
|
|
|
3368
3428
|
return;
|
|
3369
3429
|
}
|
|
3370
3430
|
if (toolConfig.type === "function") {
|
|
3371
|
-
|
|
3431
|
+
logger11.info(
|
|
3372
3432
|
{
|
|
3373
3433
|
subAgentId: this.getId(),
|
|
3374
3434
|
toolId
|
|
@@ -3400,7 +3460,7 @@ var SubAgent = class {
|
|
|
3400
3460
|
await tool.init();
|
|
3401
3461
|
}
|
|
3402
3462
|
await this.createAgentToolRelation(tool.getId(), selectedTools, headers);
|
|
3403
|
-
|
|
3463
|
+
logger11.info(
|
|
3404
3464
|
{
|
|
3405
3465
|
subAgentId: this.getId(),
|
|
3406
3466
|
toolId: tool.getId()
|
|
@@ -3408,7 +3468,7 @@ var SubAgent = class {
|
|
|
3408
3468
|
"Tool created and linked to agent"
|
|
3409
3469
|
);
|
|
3410
3470
|
} catch (error) {
|
|
3411
|
-
|
|
3471
|
+
logger11.error(
|
|
3412
3472
|
{
|
|
3413
3473
|
subAgentId: this.getId(),
|
|
3414
3474
|
toolId,
|
|
@@ -3430,7 +3490,7 @@ var SubAgent = class {
|
|
|
3430
3490
|
dc.setContext(this.tenantId, this.projectId);
|
|
3431
3491
|
await dc.init();
|
|
3432
3492
|
await this.createAgentDataComponentRelation(dc.getId());
|
|
3433
|
-
|
|
3493
|
+
logger11.info(
|
|
3434
3494
|
{
|
|
3435
3495
|
subAgentId: this.getId(),
|
|
3436
3496
|
dataComponentId: dc.getId()
|
|
@@ -3438,7 +3498,7 @@ var SubAgent = class {
|
|
|
3438
3498
|
"DataComponent created and linked to agent"
|
|
3439
3499
|
);
|
|
3440
3500
|
} catch (error) {
|
|
3441
|
-
|
|
3501
|
+
logger11.error(
|
|
3442
3502
|
{
|
|
3443
3503
|
subAgentId: this.getId(),
|
|
3444
3504
|
dataComponentName: dataComponent2.name,
|
|
@@ -3460,7 +3520,7 @@ var SubAgent = class {
|
|
|
3460
3520
|
ac.setContext(this.tenantId, this.projectId);
|
|
3461
3521
|
await ac.init();
|
|
3462
3522
|
await this.createAgentArtifactComponentRelation(ac.getId());
|
|
3463
|
-
|
|
3523
|
+
logger11.info(
|
|
3464
3524
|
{
|
|
3465
3525
|
subAgentId: this.getId(),
|
|
3466
3526
|
artifactComponentId: ac.getId()
|
|
@@ -3468,7 +3528,7 @@ var SubAgent = class {
|
|
|
3468
3528
|
"ArtifactComponent created and linked to agent"
|
|
3469
3529
|
);
|
|
3470
3530
|
} catch (error) {
|
|
3471
|
-
|
|
3531
|
+
logger11.error(
|
|
3472
3532
|
{
|
|
3473
3533
|
subAgentId: this.getId(),
|
|
3474
3534
|
artifactComponentName: artifactComponent2.name,
|
|
@@ -3500,7 +3560,7 @@ var SubAgent = class {
|
|
|
3500
3560
|
`Failed to create agent-dataComponent relation: ${relationResponse.status} ${relationResponse.statusText}`
|
|
3501
3561
|
);
|
|
3502
3562
|
}
|
|
3503
|
-
|
|
3563
|
+
logger11.info(
|
|
3504
3564
|
{
|
|
3505
3565
|
subAgentId: this.getId(),
|
|
3506
3566
|
dataComponentId
|
|
@@ -3529,7 +3589,7 @@ var SubAgent = class {
|
|
|
3529
3589
|
`Failed to create agent-artifactComponent relation: ${relationResponse.status} ${relationResponse.statusText}`
|
|
3530
3590
|
);
|
|
3531
3591
|
}
|
|
3532
|
-
|
|
3592
|
+
logger11.info(
|
|
3533
3593
|
{
|
|
3534
3594
|
subAgentId: this.getId(),
|
|
3535
3595
|
artifactComponentId
|
|
@@ -3627,6 +3687,9 @@ function dataComponent(config) {
|
|
|
3627
3687
|
};
|
|
3628
3688
|
return new DataComponent(configWithId);
|
|
3629
3689
|
}
|
|
3690
|
+
function statusComponent(config) {
|
|
3691
|
+
return new StatusComponent(config);
|
|
3692
|
+
}
|
|
3630
3693
|
function agentMcp(config) {
|
|
3631
3694
|
return {
|
|
3632
3695
|
server: config.server,
|
|
@@ -3699,7 +3762,7 @@ function createEnvironmentSettings(environments) {
|
|
|
3699
3762
|
function registerEnvironmentSettings(config) {
|
|
3700
3763
|
return config;
|
|
3701
3764
|
}
|
|
3702
|
-
var
|
|
3765
|
+
var logger12 = agentsCore.getLogger("external-agent-builder");
|
|
3703
3766
|
var ExternalAgent = class {
|
|
3704
3767
|
constructor(config) {
|
|
3705
3768
|
__publicField(this, "config");
|
|
@@ -3710,7 +3773,7 @@ var ExternalAgent = class {
|
|
|
3710
3773
|
this.config = { ...config, type: "external" };
|
|
3711
3774
|
this.tenantId = "default";
|
|
3712
3775
|
this.baseURL = process.env.INKEEP_API_URL || "http://localhost:3002";
|
|
3713
|
-
|
|
3776
|
+
logger12.debug(
|
|
3714
3777
|
{
|
|
3715
3778
|
externalAgentName: this.config.name,
|
|
3716
3779
|
baseUrl: this.config.baseUrl,
|
|
@@ -3726,7 +3789,7 @@ var ExternalAgent = class {
|
|
|
3726
3789
|
if (this.initialized) return;
|
|
3727
3790
|
try {
|
|
3728
3791
|
await this.upsertExternalAgent();
|
|
3729
|
-
|
|
3792
|
+
logger12.info(
|
|
3730
3793
|
{
|
|
3731
3794
|
externalSubAgentId: this.getId()
|
|
3732
3795
|
},
|
|
@@ -3734,7 +3797,7 @@ var ExternalAgent = class {
|
|
|
3734
3797
|
);
|
|
3735
3798
|
this.initialized = true;
|
|
3736
3799
|
} catch (error) {
|
|
3737
|
-
|
|
3800
|
+
logger12.error(
|
|
3738
3801
|
{
|
|
3739
3802
|
externalSubAgentId: this.getId(),
|
|
3740
3803
|
error: error instanceof Error ? error.message : "Unknown error"
|
|
@@ -3776,7 +3839,7 @@ var ExternalAgent = class {
|
|
|
3776
3839
|
}
|
|
3777
3840
|
);
|
|
3778
3841
|
if (updateResponse.ok) {
|
|
3779
|
-
|
|
3842
|
+
logger12.info(
|
|
3780
3843
|
{
|
|
3781
3844
|
externalSubAgentId: this.getId()
|
|
3782
3845
|
},
|
|
@@ -3785,7 +3848,7 @@ var ExternalAgent = class {
|
|
|
3785
3848
|
return;
|
|
3786
3849
|
}
|
|
3787
3850
|
if (updateResponse.status === 404) {
|
|
3788
|
-
|
|
3851
|
+
logger12.info(
|
|
3789
3852
|
{
|
|
3790
3853
|
externalSubAgentId: this.getId()
|
|
3791
3854
|
},
|
|
@@ -3807,7 +3870,7 @@ var ExternalAgent = class {
|
|
|
3807
3870
|
`Failed to create external agent: ${createResponse.status} ${createResponse.statusText} - ${errorText2}`
|
|
3808
3871
|
);
|
|
3809
3872
|
}
|
|
3810
|
-
|
|
3873
|
+
logger12.info(
|
|
3811
3874
|
{
|
|
3812
3875
|
externalSubAgentId: this.getId()
|
|
3813
3876
|
},
|
|
@@ -3882,7 +3945,7 @@ var MaxTurnsExceededError = class extends AgentError {
|
|
|
3882
3945
|
};
|
|
3883
3946
|
|
|
3884
3947
|
// src/runner.ts
|
|
3885
|
-
var
|
|
3948
|
+
var logger13 = agentsCore.getLogger("runner");
|
|
3886
3949
|
var Runner = class _Runner {
|
|
3887
3950
|
/**
|
|
3888
3951
|
* Run an agent until completion, handling transfers and tool calls
|
|
@@ -3894,7 +3957,7 @@ var Runner = class _Runner {
|
|
|
3894
3957
|
let turnCount = 0;
|
|
3895
3958
|
const messageHistory = _Runner.normalizeToMessageHistory(messages);
|
|
3896
3959
|
const allToolCalls = [];
|
|
3897
|
-
|
|
3960
|
+
logger13.info(
|
|
3898
3961
|
{
|
|
3899
3962
|
agentId: agent2.getId(),
|
|
3900
3963
|
defaultSubAgent: agent2.getDefaultSubAgent()?.getName(),
|
|
@@ -3904,7 +3967,7 @@ var Runner = class _Runner {
|
|
|
3904
3967
|
"Starting agent run"
|
|
3905
3968
|
);
|
|
3906
3969
|
while (turnCount < maxTurns) {
|
|
3907
|
-
|
|
3970
|
+
logger13.debug(
|
|
3908
3971
|
{
|
|
3909
3972
|
agentId: agent2.getId(),
|
|
3910
3973
|
turnCount,
|
|
@@ -3914,7 +3977,7 @@ var Runner = class _Runner {
|
|
|
3914
3977
|
);
|
|
3915
3978
|
const response = await agent2.generate(messageHistory, options);
|
|
3916
3979
|
turnCount++;
|
|
3917
|
-
|
|
3980
|
+
logger13.info(
|
|
3918
3981
|
{
|
|
3919
3982
|
agentId: agent2.getId(),
|
|
3920
3983
|
turnCount,
|
|
@@ -3934,7 +3997,7 @@ var Runner = class _Runner {
|
|
|
3934
3997
|
}
|
|
3935
3998
|
};
|
|
3936
3999
|
}
|
|
3937
|
-
|
|
4000
|
+
logger13.error(
|
|
3938
4001
|
{
|
|
3939
4002
|
agentId: agent2.getId(),
|
|
3940
4003
|
maxTurns,
|
|
@@ -3948,7 +4011,7 @@ var Runner = class _Runner {
|
|
|
3948
4011
|
* Stream an agent's response
|
|
3949
4012
|
*/
|
|
3950
4013
|
static async stream(agent2, messages, options) {
|
|
3951
|
-
|
|
4014
|
+
logger13.info(
|
|
3952
4015
|
{
|
|
3953
4016
|
agentId: agent2.getId(),
|
|
3954
4017
|
defaultSubAgent: agent2.getDefaultSubAgent()?.getName()
|
|
@@ -3964,7 +4027,7 @@ var Runner = class _Runner {
|
|
|
3964
4027
|
if (agent2.length === 0) {
|
|
3965
4028
|
throw new Error("No agent provided for race");
|
|
3966
4029
|
}
|
|
3967
|
-
|
|
4030
|
+
logger13.info(
|
|
3968
4031
|
{
|
|
3969
4032
|
agentCount: agent2.length,
|
|
3970
4033
|
agentIds: agent2.map((g) => g.getId())
|
|
@@ -3976,7 +4039,7 @@ var Runner = class _Runner {
|
|
|
3976
4039
|
const result2 = await _Runner.run(agent3, messages, options);
|
|
3977
4040
|
return { ...result2, raceIndex: index };
|
|
3978
4041
|
} catch (error) {
|
|
3979
|
-
|
|
4042
|
+
logger13.error(
|
|
3980
4043
|
{
|
|
3981
4044
|
agentId: agent3.getId(),
|
|
3982
4045
|
error: error instanceof Error ? error.message : "Unknown error"
|
|
@@ -3987,7 +4050,7 @@ var Runner = class _Runner {
|
|
|
3987
4050
|
}
|
|
3988
4051
|
});
|
|
3989
4052
|
const result = await Promise.race(promises);
|
|
3990
|
-
|
|
4053
|
+
logger13.info(
|
|
3991
4054
|
{
|
|
3992
4055
|
winningAgentId: result.agentId || "unknown",
|
|
3993
4056
|
raceIndex: result.raceIndex
|
|
@@ -4079,6 +4142,7 @@ exports.ExternalAgent = ExternalAgent;
|
|
|
4079
4142
|
exports.FunctionTool = FunctionTool;
|
|
4080
4143
|
exports.Project = Project;
|
|
4081
4144
|
exports.Runner = Runner;
|
|
4145
|
+
exports.StatusComponent = StatusComponent;
|
|
4082
4146
|
exports.SubAgent = SubAgent;
|
|
4083
4147
|
exports.Tool = Tool;
|
|
4084
4148
|
exports.agent = agent;
|
|
@@ -4101,6 +4165,7 @@ exports.project = project;
|
|
|
4101
4165
|
exports.raceAgents = raceAgents;
|
|
4102
4166
|
exports.registerEnvironmentSettings = registerEnvironmentSettings;
|
|
4103
4167
|
exports.run = run;
|
|
4168
|
+
exports.statusComponent = statusComponent;
|
|
4104
4169
|
exports.stream = stream;
|
|
4105
4170
|
exports.subAgent = subAgent;
|
|
4106
4171
|
exports.transfer = transfer;
|