@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.js
CHANGED
|
@@ -377,7 +377,9 @@ var FunctionTool = class {
|
|
|
377
377
|
for (const dep in deps) {
|
|
378
378
|
if (deps[dep] === false) {
|
|
379
379
|
delete deps[dep];
|
|
380
|
-
throw new Error(
|
|
380
|
+
throw new Error(
|
|
381
|
+
`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.`
|
|
382
|
+
);
|
|
381
383
|
}
|
|
382
384
|
}
|
|
383
385
|
this.config.dependencies = deps;
|
|
@@ -637,6 +639,31 @@ var Agent = class {
|
|
|
637
639
|
};
|
|
638
640
|
}
|
|
639
641
|
}
|
|
642
|
+
const processedStatusUpdates = this.statusUpdateSettings ? {
|
|
643
|
+
...this.statusUpdateSettings,
|
|
644
|
+
statusComponents: this.statusUpdateSettings.statusComponents?.map((comp) => {
|
|
645
|
+
if (comp && typeof comp.getType === "function") {
|
|
646
|
+
return {
|
|
647
|
+
type: comp.getType(),
|
|
648
|
+
description: comp.getDescription(),
|
|
649
|
+
detailsSchema: comp.getDetailsSchema()
|
|
650
|
+
};
|
|
651
|
+
}
|
|
652
|
+
if (comp && typeof comp === "object" && comp.detailsSchema && isZodSchema(comp.detailsSchema)) {
|
|
653
|
+
const jsonSchema = convertZodToJsonSchema(comp.detailsSchema);
|
|
654
|
+
return {
|
|
655
|
+
type: comp.type,
|
|
656
|
+
description: comp.description,
|
|
657
|
+
detailsSchema: {
|
|
658
|
+
type: "object",
|
|
659
|
+
properties: jsonSchema.properties || {},
|
|
660
|
+
required: jsonSchema.required || void 0
|
|
661
|
+
}
|
|
662
|
+
};
|
|
663
|
+
}
|
|
664
|
+
return comp;
|
|
665
|
+
})
|
|
666
|
+
} : void 0;
|
|
640
667
|
return {
|
|
641
668
|
id: this.agentId,
|
|
642
669
|
name: this.agentName,
|
|
@@ -647,7 +674,7 @@ var Agent = class {
|
|
|
647
674
|
...Object.keys(functionToolsObject).length > 0 && { functionTools: functionToolsObject },
|
|
648
675
|
...Object.keys(functionsObject).length > 0 && { functions: functionsObject },
|
|
649
676
|
models: this.models,
|
|
650
|
-
statusUpdates:
|
|
677
|
+
statusUpdates: processedStatusUpdates,
|
|
651
678
|
prompt: this.prompt,
|
|
652
679
|
createdAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
653
680
|
updatedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
@@ -2035,7 +2062,6 @@ var Project = class {
|
|
|
2035
2062
|
__publicField(this, "initialized", false);
|
|
2036
2063
|
__publicField(this, "models");
|
|
2037
2064
|
__publicField(this, "stopWhen");
|
|
2038
|
-
__publicField(this, "sandboxConfig");
|
|
2039
2065
|
__publicField(this, "agents", []);
|
|
2040
2066
|
__publicField(this, "agentMap", /* @__PURE__ */ new Map());
|
|
2041
2067
|
__publicField(this, "credentialReferences", []);
|
|
@@ -2049,7 +2075,6 @@ var Project = class {
|
|
|
2049
2075
|
this.baseURL = process.env.INKEEP_API_URL || "http://localhost:3002";
|
|
2050
2076
|
this.models = config.models;
|
|
2051
2077
|
this.stopWhen = config.stopWhen;
|
|
2052
|
-
this.sandboxConfig = config.sandboxConfig;
|
|
2053
2078
|
if (config.agents) {
|
|
2054
2079
|
this.agents = config.agents();
|
|
2055
2080
|
this.agentMap = new Map(this.agents.map((agent2) => [agent2.getId(), agent2]));
|
|
@@ -2608,7 +2633,6 @@ var Project = class {
|
|
|
2608
2633
|
description: this.projectDescription || "",
|
|
2609
2634
|
models: this.models,
|
|
2610
2635
|
stopWhen: this.stopWhen,
|
|
2611
|
-
sandboxConfig: this.sandboxConfig,
|
|
2612
2636
|
agents: agentsObject,
|
|
2613
2637
|
tools: toolsObject,
|
|
2614
2638
|
functions: Object.keys(functionsObject).length > 0 ? functionsObject : void 0,
|
|
@@ -2620,7 +2644,43 @@ var Project = class {
|
|
|
2620
2644
|
};
|
|
2621
2645
|
}
|
|
2622
2646
|
};
|
|
2623
|
-
var logger9 = getLogger("
|
|
2647
|
+
var logger9 = getLogger("statusComponent");
|
|
2648
|
+
var StatusComponent = class {
|
|
2649
|
+
constructor(config) {
|
|
2650
|
+
__publicField(this, "config");
|
|
2651
|
+
let processedDetailsSchema;
|
|
2652
|
+
if (config.detailsSchema && isZodSchema(config.detailsSchema)) {
|
|
2653
|
+
const jsonSchema = convertZodToJsonSchema(config.detailsSchema);
|
|
2654
|
+
processedDetailsSchema = {
|
|
2655
|
+
type: "object",
|
|
2656
|
+
properties: jsonSchema.properties || {},
|
|
2657
|
+
required: jsonSchema.required || void 0
|
|
2658
|
+
};
|
|
2659
|
+
} else {
|
|
2660
|
+
processedDetailsSchema = config.detailsSchema;
|
|
2661
|
+
}
|
|
2662
|
+
this.config = {
|
|
2663
|
+
...config,
|
|
2664
|
+
detailsSchema: processedDetailsSchema
|
|
2665
|
+
};
|
|
2666
|
+
logger9.info(
|
|
2667
|
+
{
|
|
2668
|
+
statusComponentType: config.type
|
|
2669
|
+
},
|
|
2670
|
+
"StatusComponent constructor initialized"
|
|
2671
|
+
);
|
|
2672
|
+
}
|
|
2673
|
+
getType() {
|
|
2674
|
+
return this.config.type;
|
|
2675
|
+
}
|
|
2676
|
+
getDescription() {
|
|
2677
|
+
return this.config.description;
|
|
2678
|
+
}
|
|
2679
|
+
getDetailsSchema() {
|
|
2680
|
+
return this.config.detailsSchema;
|
|
2681
|
+
}
|
|
2682
|
+
};
|
|
2683
|
+
var logger10 = getLogger("tool");
|
|
2624
2684
|
var Tool = class {
|
|
2625
2685
|
constructor(config) {
|
|
2626
2686
|
__publicField(this, "config");
|
|
@@ -2632,7 +2692,7 @@ var Tool = class {
|
|
|
2632
2692
|
this.baseURL = process.env.INKEEP_API_URL || "http://localhost:3002";
|
|
2633
2693
|
this.tenantId = "default";
|
|
2634
2694
|
this.projectId = "default";
|
|
2635
|
-
|
|
2695
|
+
logger10.info(
|
|
2636
2696
|
{
|
|
2637
2697
|
Id: this.getId(),
|
|
2638
2698
|
Name: config.name
|
|
@@ -2674,7 +2734,7 @@ var Tool = class {
|
|
|
2674
2734
|
if (!options?.skipDatabaseRegistration) {
|
|
2675
2735
|
await this.upsertTool();
|
|
2676
2736
|
}
|
|
2677
|
-
|
|
2737
|
+
logger10.info(
|
|
2678
2738
|
{
|
|
2679
2739
|
toolId: this.getId()
|
|
2680
2740
|
},
|
|
@@ -2682,7 +2742,7 @@ var Tool = class {
|
|
|
2682
2742
|
);
|
|
2683
2743
|
this.initialized = true;
|
|
2684
2744
|
} catch (error) {
|
|
2685
|
-
|
|
2745
|
+
logger10.error(
|
|
2686
2746
|
{
|
|
2687
2747
|
toolId: this.getId(),
|
|
2688
2748
|
error: error instanceof Error ? error.message : "Unknown error"
|
|
@@ -2714,7 +2774,7 @@ var Tool = class {
|
|
|
2714
2774
|
const toolDataForCreate = {
|
|
2715
2775
|
...toolDataForUpdate
|
|
2716
2776
|
};
|
|
2717
|
-
|
|
2777
|
+
logger10.info({ toolDataForCreate }, "toolDataForCreate");
|
|
2718
2778
|
const updateResponse = await fetch(
|
|
2719
2779
|
`${this.baseURL}/tenants/${this.tenantId}/projects/${this.projectId}/tools/${this.getId()}`,
|
|
2720
2780
|
{
|
|
@@ -2725,9 +2785,9 @@ var Tool = class {
|
|
|
2725
2785
|
body: JSON.stringify(toolDataForUpdate)
|
|
2726
2786
|
}
|
|
2727
2787
|
);
|
|
2728
|
-
|
|
2788
|
+
logger10.info({ updateResponse }, "tool updateResponse");
|
|
2729
2789
|
if (updateResponse.ok) {
|
|
2730
|
-
|
|
2790
|
+
logger10.info(
|
|
2731
2791
|
{
|
|
2732
2792
|
toolId: this.getId()
|
|
2733
2793
|
},
|
|
@@ -2736,7 +2796,7 @@ var Tool = class {
|
|
|
2736
2796
|
return;
|
|
2737
2797
|
}
|
|
2738
2798
|
if (updateResponse.status === 404) {
|
|
2739
|
-
|
|
2799
|
+
logger10.info(
|
|
2740
2800
|
{
|
|
2741
2801
|
toolId: this.getId()
|
|
2742
2802
|
},
|
|
@@ -2755,7 +2815,7 @@ var Tool = class {
|
|
|
2755
2815
|
if (!createResponse.ok) {
|
|
2756
2816
|
throw new Error(`Failed to create tool: ${createResponse.status}`);
|
|
2757
2817
|
}
|
|
2758
|
-
|
|
2818
|
+
logger10.info(
|
|
2759
2819
|
{
|
|
2760
2820
|
toolId: this.getId()
|
|
2761
2821
|
},
|
|
@@ -2796,7 +2856,7 @@ function normalizeAgentCanUseType(value, fallbackName) {
|
|
|
2796
2856
|
}
|
|
2797
2857
|
|
|
2798
2858
|
// src/subAgent.ts
|
|
2799
|
-
var
|
|
2859
|
+
var logger11 = getLogger("agent");
|
|
2800
2860
|
function resolveGetter2(value) {
|
|
2801
2861
|
if (typeof value === "function") {
|
|
2802
2862
|
return value();
|
|
@@ -2815,7 +2875,7 @@ var SubAgent = class {
|
|
|
2815
2875
|
this.baseURL = process.env.INKEEP_API_URL || "http://localhost:3002";
|
|
2816
2876
|
this.tenantId = "default";
|
|
2817
2877
|
this.projectId = "default";
|
|
2818
|
-
|
|
2878
|
+
logger11.info(
|
|
2819
2879
|
{
|
|
2820
2880
|
tenantId: this.tenantId,
|
|
2821
2881
|
subAgentId: this.config.id,
|
|
@@ -2965,7 +3025,7 @@ var SubAgent = class {
|
|
|
2965
3025
|
await this.saveToolsAndRelations();
|
|
2966
3026
|
await this.saveDataComponents();
|
|
2967
3027
|
await this.saveArtifactComponents();
|
|
2968
|
-
|
|
3028
|
+
logger11.info(
|
|
2969
3029
|
{
|
|
2970
3030
|
subAgentId: this.getId()
|
|
2971
3031
|
},
|
|
@@ -2973,7 +3033,7 @@ var SubAgent = class {
|
|
|
2973
3033
|
);
|
|
2974
3034
|
this.initialized = true;
|
|
2975
3035
|
} catch (error) {
|
|
2976
|
-
|
|
3036
|
+
logger11.error(
|
|
2977
3037
|
{
|
|
2978
3038
|
subAgentId: this.getId(),
|
|
2979
3039
|
error: error instanceof Error ? error.message : "Unknown error"
|
|
@@ -3005,7 +3065,7 @@ var SubAgent = class {
|
|
|
3005
3065
|
}
|
|
3006
3066
|
);
|
|
3007
3067
|
if (updateResponse.ok) {
|
|
3008
|
-
|
|
3068
|
+
logger11.info(
|
|
3009
3069
|
{
|
|
3010
3070
|
subAgentId: this.getId()
|
|
3011
3071
|
},
|
|
@@ -3014,7 +3074,7 @@ var SubAgent = class {
|
|
|
3014
3074
|
return;
|
|
3015
3075
|
}
|
|
3016
3076
|
if (updateResponse.status === 404) {
|
|
3017
|
-
|
|
3077
|
+
logger11.info(
|
|
3018
3078
|
{
|
|
3019
3079
|
subAgentId: this.getId()
|
|
3020
3080
|
},
|
|
@@ -3033,7 +3093,7 @@ var SubAgent = class {
|
|
|
3033
3093
|
`Failed to create agent: ${createResponse.status} ${createResponse.statusText} - ${errorText2}`
|
|
3034
3094
|
);
|
|
3035
3095
|
}
|
|
3036
|
-
|
|
3096
|
+
logger11.info(
|
|
3037
3097
|
{
|
|
3038
3098
|
subAgentId: this.getId()
|
|
3039
3099
|
},
|
|
@@ -3056,7 +3116,7 @@ var SubAgent = class {
|
|
|
3056
3116
|
const normalizedTool = normalizeAgentCanUseType(toolConfig, `tool-${i}`);
|
|
3057
3117
|
await this.createTool(normalizedTool.toolId, toolConfig);
|
|
3058
3118
|
} catch (error) {
|
|
3059
|
-
|
|
3119
|
+
logger11.error(
|
|
3060
3120
|
{
|
|
3061
3121
|
toolId: isAgentMcpConfig(toolConfig) ? toolConfig.server.getId() : toolConfig.getId?.(),
|
|
3062
3122
|
error: error instanceof Error ? error.message : "Unknown error"
|
|
@@ -3070,7 +3130,7 @@ var SubAgent = class {
|
|
|
3070
3130
|
}
|
|
3071
3131
|
}
|
|
3072
3132
|
async saveDataComponents() {
|
|
3073
|
-
|
|
3133
|
+
logger11.info({ dataComponents: this.config.dataComponents }, "dataComponents and config");
|
|
3074
3134
|
const components = resolveGetter2(this.config.dataComponents);
|
|
3075
3135
|
if (components) {
|
|
3076
3136
|
for (const dataComponent2 of components) {
|
|
@@ -3085,7 +3145,7 @@ var SubAgent = class {
|
|
|
3085
3145
|
}
|
|
3086
3146
|
}
|
|
3087
3147
|
async saveArtifactComponents() {
|
|
3088
|
-
|
|
3148
|
+
logger11.info(
|
|
3089
3149
|
{ artifactComponents: this.config.artifactComponents },
|
|
3090
3150
|
"artifactComponents and config"
|
|
3091
3151
|
);
|
|
@@ -3140,7 +3200,7 @@ var SubAgent = class {
|
|
|
3140
3200
|
return acc;
|
|
3141
3201
|
}, []);
|
|
3142
3202
|
this.config.dataComponents = () => uniqueComponents;
|
|
3143
|
-
|
|
3203
|
+
logger11.info(
|
|
3144
3204
|
{
|
|
3145
3205
|
subAgentId: this.getId(),
|
|
3146
3206
|
dbComponentCount: dbDataComponents.length,
|
|
@@ -3150,7 +3210,7 @@ var SubAgent = class {
|
|
|
3150
3210
|
"Loaded and merged data components"
|
|
3151
3211
|
);
|
|
3152
3212
|
} catch (error) {
|
|
3153
|
-
|
|
3213
|
+
logger11.error(
|
|
3154
3214
|
{
|
|
3155
3215
|
subAgentId: this.getId(),
|
|
3156
3216
|
error: error instanceof Error ? error.message : "Unknown error"
|
|
@@ -3197,7 +3257,7 @@ var SubAgent = class {
|
|
|
3197
3257
|
return acc;
|
|
3198
3258
|
}, []);
|
|
3199
3259
|
this.config.artifactComponents = () => uniqueComponents;
|
|
3200
|
-
|
|
3260
|
+
logger11.info(
|
|
3201
3261
|
{
|
|
3202
3262
|
subAgentId: this.getId(),
|
|
3203
3263
|
dbComponentCount: dbArtifactComponents.length,
|
|
@@ -3207,7 +3267,7 @@ var SubAgent = class {
|
|
|
3207
3267
|
"Loaded and merged artifact components"
|
|
3208
3268
|
);
|
|
3209
3269
|
} catch (error) {
|
|
3210
|
-
|
|
3270
|
+
logger11.error(
|
|
3211
3271
|
{
|
|
3212
3272
|
subAgentId: this.getId(),
|
|
3213
3273
|
error: error instanceof Error ? error.message : "Unknown error"
|
|
@@ -3221,7 +3281,7 @@ var SubAgent = class {
|
|
|
3221
3281
|
const functionData = functionTool2.serializeFunction();
|
|
3222
3282
|
const toolData = functionTool2.serializeTool();
|
|
3223
3283
|
const functionUrl = `${this.baseURL}/tenants/${this.tenantId}/crud/projects/${this.projectId}/functions`;
|
|
3224
|
-
|
|
3284
|
+
logger11.info(
|
|
3225
3285
|
{
|
|
3226
3286
|
agentId: this.getId(),
|
|
3227
3287
|
toolId,
|
|
@@ -3241,7 +3301,7 @@ var SubAgent = class {
|
|
|
3241
3301
|
dependencies: functionData.dependencies
|
|
3242
3302
|
})
|
|
3243
3303
|
});
|
|
3244
|
-
|
|
3304
|
+
logger11.info(
|
|
3245
3305
|
{
|
|
3246
3306
|
agentId: this.getId(),
|
|
3247
3307
|
toolId,
|
|
@@ -3252,7 +3312,7 @@ var SubAgent = class {
|
|
|
3252
3312
|
);
|
|
3253
3313
|
if (!functionResponse.ok) {
|
|
3254
3314
|
const errorText = await functionResponse.text();
|
|
3255
|
-
|
|
3315
|
+
logger11.error(
|
|
3256
3316
|
{
|
|
3257
3317
|
agentId: this.getId(),
|
|
3258
3318
|
toolId,
|
|
@@ -3265,7 +3325,7 @@ var SubAgent = class {
|
|
|
3265
3325
|
throw new Error(`Failed to create function: ${functionResponse.status} ${errorText}`);
|
|
3266
3326
|
}
|
|
3267
3327
|
const toolUrl = `${this.baseURL}/tenants/${this.tenantId}/crud/projects/${this.projectId}/tools`;
|
|
3268
|
-
|
|
3328
|
+
logger11.info(
|
|
3269
3329
|
{
|
|
3270
3330
|
agentId: this.getId(),
|
|
3271
3331
|
toolId,
|
|
@@ -3289,7 +3349,7 @@ var SubAgent = class {
|
|
|
3289
3349
|
}
|
|
3290
3350
|
})
|
|
3291
3351
|
});
|
|
3292
|
-
|
|
3352
|
+
logger11.info(
|
|
3293
3353
|
{
|
|
3294
3354
|
agentId: this.getId(),
|
|
3295
3355
|
toolId,
|
|
@@ -3300,7 +3360,7 @@ var SubAgent = class {
|
|
|
3300
3360
|
);
|
|
3301
3361
|
if (!toolResponse.ok) {
|
|
3302
3362
|
const errorText = await toolResponse.text();
|
|
3303
|
-
|
|
3363
|
+
logger11.error(
|
|
3304
3364
|
{
|
|
3305
3365
|
agentId: this.getId(),
|
|
3306
3366
|
toolId,
|
|
@@ -3313,7 +3373,7 @@ var SubAgent = class {
|
|
|
3313
3373
|
throw new Error(`Failed to create tool: ${toolResponse.status} ${errorText}`);
|
|
3314
3374
|
}
|
|
3315
3375
|
await this.createAgentToolRelation(toolData.id);
|
|
3316
|
-
|
|
3376
|
+
logger11.info(
|
|
3317
3377
|
{
|
|
3318
3378
|
agentId: this.getId(),
|
|
3319
3379
|
functionId: functionData.id,
|
|
@@ -3322,7 +3382,7 @@ var SubAgent = class {
|
|
|
3322
3382
|
"Function and tool created successfully"
|
|
3323
3383
|
);
|
|
3324
3384
|
} catch (error) {
|
|
3325
|
-
|
|
3385
|
+
logger11.error(
|
|
3326
3386
|
{
|
|
3327
3387
|
agentId: this.getId(),
|
|
3328
3388
|
toolId,
|
|
@@ -3341,7 +3401,7 @@ var SubAgent = class {
|
|
|
3341
3401
|
return;
|
|
3342
3402
|
}
|
|
3343
3403
|
if (toolConfig.type === "function") {
|
|
3344
|
-
|
|
3404
|
+
logger11.info(
|
|
3345
3405
|
{
|
|
3346
3406
|
subAgentId: this.getId(),
|
|
3347
3407
|
toolId
|
|
@@ -3373,7 +3433,7 @@ var SubAgent = class {
|
|
|
3373
3433
|
await tool.init();
|
|
3374
3434
|
}
|
|
3375
3435
|
await this.createAgentToolRelation(tool.getId(), selectedTools, headers);
|
|
3376
|
-
|
|
3436
|
+
logger11.info(
|
|
3377
3437
|
{
|
|
3378
3438
|
subAgentId: this.getId(),
|
|
3379
3439
|
toolId: tool.getId()
|
|
@@ -3381,7 +3441,7 @@ var SubAgent = class {
|
|
|
3381
3441
|
"Tool created and linked to agent"
|
|
3382
3442
|
);
|
|
3383
3443
|
} catch (error) {
|
|
3384
|
-
|
|
3444
|
+
logger11.error(
|
|
3385
3445
|
{
|
|
3386
3446
|
subAgentId: this.getId(),
|
|
3387
3447
|
toolId,
|
|
@@ -3403,7 +3463,7 @@ var SubAgent = class {
|
|
|
3403
3463
|
dc.setContext(this.tenantId, this.projectId);
|
|
3404
3464
|
await dc.init();
|
|
3405
3465
|
await this.createAgentDataComponentRelation(dc.getId());
|
|
3406
|
-
|
|
3466
|
+
logger11.info(
|
|
3407
3467
|
{
|
|
3408
3468
|
subAgentId: this.getId(),
|
|
3409
3469
|
dataComponentId: dc.getId()
|
|
@@ -3411,7 +3471,7 @@ var SubAgent = class {
|
|
|
3411
3471
|
"DataComponent created and linked to agent"
|
|
3412
3472
|
);
|
|
3413
3473
|
} catch (error) {
|
|
3414
|
-
|
|
3474
|
+
logger11.error(
|
|
3415
3475
|
{
|
|
3416
3476
|
subAgentId: this.getId(),
|
|
3417
3477
|
dataComponentName: dataComponent2.name,
|
|
@@ -3433,7 +3493,7 @@ var SubAgent = class {
|
|
|
3433
3493
|
ac.setContext(this.tenantId, this.projectId);
|
|
3434
3494
|
await ac.init();
|
|
3435
3495
|
await this.createAgentArtifactComponentRelation(ac.getId());
|
|
3436
|
-
|
|
3496
|
+
logger11.info(
|
|
3437
3497
|
{
|
|
3438
3498
|
subAgentId: this.getId(),
|
|
3439
3499
|
artifactComponentId: ac.getId()
|
|
@@ -3441,7 +3501,7 @@ var SubAgent = class {
|
|
|
3441
3501
|
"ArtifactComponent created and linked to agent"
|
|
3442
3502
|
);
|
|
3443
3503
|
} catch (error) {
|
|
3444
|
-
|
|
3504
|
+
logger11.error(
|
|
3445
3505
|
{
|
|
3446
3506
|
subAgentId: this.getId(),
|
|
3447
3507
|
artifactComponentName: artifactComponent2.name,
|
|
@@ -3473,7 +3533,7 @@ var SubAgent = class {
|
|
|
3473
3533
|
`Failed to create agent-dataComponent relation: ${relationResponse.status} ${relationResponse.statusText}`
|
|
3474
3534
|
);
|
|
3475
3535
|
}
|
|
3476
|
-
|
|
3536
|
+
logger11.info(
|
|
3477
3537
|
{
|
|
3478
3538
|
subAgentId: this.getId(),
|
|
3479
3539
|
dataComponentId
|
|
@@ -3502,7 +3562,7 @@ var SubAgent = class {
|
|
|
3502
3562
|
`Failed to create agent-artifactComponent relation: ${relationResponse.status} ${relationResponse.statusText}`
|
|
3503
3563
|
);
|
|
3504
3564
|
}
|
|
3505
|
-
|
|
3565
|
+
logger11.info(
|
|
3506
3566
|
{
|
|
3507
3567
|
subAgentId: this.getId(),
|
|
3508
3568
|
artifactComponentId
|
|
@@ -3600,6 +3660,9 @@ function dataComponent(config) {
|
|
|
3600
3660
|
};
|
|
3601
3661
|
return new DataComponent(configWithId);
|
|
3602
3662
|
}
|
|
3663
|
+
function statusComponent(config) {
|
|
3664
|
+
return new StatusComponent(config);
|
|
3665
|
+
}
|
|
3603
3666
|
function agentMcp(config) {
|
|
3604
3667
|
return {
|
|
3605
3668
|
server: config.server,
|
|
@@ -3672,7 +3735,7 @@ function createEnvironmentSettings(environments) {
|
|
|
3672
3735
|
function registerEnvironmentSettings(config) {
|
|
3673
3736
|
return config;
|
|
3674
3737
|
}
|
|
3675
|
-
var
|
|
3738
|
+
var logger12 = getLogger("external-agent-builder");
|
|
3676
3739
|
var ExternalAgent = class {
|
|
3677
3740
|
constructor(config) {
|
|
3678
3741
|
__publicField(this, "config");
|
|
@@ -3683,7 +3746,7 @@ var ExternalAgent = class {
|
|
|
3683
3746
|
this.config = { ...config, type: "external" };
|
|
3684
3747
|
this.tenantId = "default";
|
|
3685
3748
|
this.baseURL = process.env.INKEEP_API_URL || "http://localhost:3002";
|
|
3686
|
-
|
|
3749
|
+
logger12.debug(
|
|
3687
3750
|
{
|
|
3688
3751
|
externalAgentName: this.config.name,
|
|
3689
3752
|
baseUrl: this.config.baseUrl,
|
|
@@ -3699,7 +3762,7 @@ var ExternalAgent = class {
|
|
|
3699
3762
|
if (this.initialized) return;
|
|
3700
3763
|
try {
|
|
3701
3764
|
await this.upsertExternalAgent();
|
|
3702
|
-
|
|
3765
|
+
logger12.info(
|
|
3703
3766
|
{
|
|
3704
3767
|
externalSubAgentId: this.getId()
|
|
3705
3768
|
},
|
|
@@ -3707,7 +3770,7 @@ var ExternalAgent = class {
|
|
|
3707
3770
|
);
|
|
3708
3771
|
this.initialized = true;
|
|
3709
3772
|
} catch (error) {
|
|
3710
|
-
|
|
3773
|
+
logger12.error(
|
|
3711
3774
|
{
|
|
3712
3775
|
externalSubAgentId: this.getId(),
|
|
3713
3776
|
error: error instanceof Error ? error.message : "Unknown error"
|
|
@@ -3749,7 +3812,7 @@ var ExternalAgent = class {
|
|
|
3749
3812
|
}
|
|
3750
3813
|
);
|
|
3751
3814
|
if (updateResponse.ok) {
|
|
3752
|
-
|
|
3815
|
+
logger12.info(
|
|
3753
3816
|
{
|
|
3754
3817
|
externalSubAgentId: this.getId()
|
|
3755
3818
|
},
|
|
@@ -3758,7 +3821,7 @@ var ExternalAgent = class {
|
|
|
3758
3821
|
return;
|
|
3759
3822
|
}
|
|
3760
3823
|
if (updateResponse.status === 404) {
|
|
3761
|
-
|
|
3824
|
+
logger12.info(
|
|
3762
3825
|
{
|
|
3763
3826
|
externalSubAgentId: this.getId()
|
|
3764
3827
|
},
|
|
@@ -3780,7 +3843,7 @@ var ExternalAgent = class {
|
|
|
3780
3843
|
`Failed to create external agent: ${createResponse.status} ${createResponse.statusText} - ${errorText2}`
|
|
3781
3844
|
);
|
|
3782
3845
|
}
|
|
3783
|
-
|
|
3846
|
+
logger12.info(
|
|
3784
3847
|
{
|
|
3785
3848
|
externalSubAgentId: this.getId()
|
|
3786
3849
|
},
|
|
@@ -3855,7 +3918,7 @@ var MaxTurnsExceededError = class extends AgentError {
|
|
|
3855
3918
|
};
|
|
3856
3919
|
|
|
3857
3920
|
// src/runner.ts
|
|
3858
|
-
var
|
|
3921
|
+
var logger13 = getLogger("runner");
|
|
3859
3922
|
var Runner = class _Runner {
|
|
3860
3923
|
/**
|
|
3861
3924
|
* Run an agent until completion, handling transfers and tool calls
|
|
@@ -3867,7 +3930,7 @@ var Runner = class _Runner {
|
|
|
3867
3930
|
let turnCount = 0;
|
|
3868
3931
|
const messageHistory = _Runner.normalizeToMessageHistory(messages);
|
|
3869
3932
|
const allToolCalls = [];
|
|
3870
|
-
|
|
3933
|
+
logger13.info(
|
|
3871
3934
|
{
|
|
3872
3935
|
agentId: agent2.getId(),
|
|
3873
3936
|
defaultSubAgent: agent2.getDefaultSubAgent()?.getName(),
|
|
@@ -3877,7 +3940,7 @@ var Runner = class _Runner {
|
|
|
3877
3940
|
"Starting agent run"
|
|
3878
3941
|
);
|
|
3879
3942
|
while (turnCount < maxTurns) {
|
|
3880
|
-
|
|
3943
|
+
logger13.debug(
|
|
3881
3944
|
{
|
|
3882
3945
|
agentId: agent2.getId(),
|
|
3883
3946
|
turnCount,
|
|
@@ -3887,7 +3950,7 @@ var Runner = class _Runner {
|
|
|
3887
3950
|
);
|
|
3888
3951
|
const response = await agent2.generate(messageHistory, options);
|
|
3889
3952
|
turnCount++;
|
|
3890
|
-
|
|
3953
|
+
logger13.info(
|
|
3891
3954
|
{
|
|
3892
3955
|
agentId: agent2.getId(),
|
|
3893
3956
|
turnCount,
|
|
@@ -3907,7 +3970,7 @@ var Runner = class _Runner {
|
|
|
3907
3970
|
}
|
|
3908
3971
|
};
|
|
3909
3972
|
}
|
|
3910
|
-
|
|
3973
|
+
logger13.error(
|
|
3911
3974
|
{
|
|
3912
3975
|
agentId: agent2.getId(),
|
|
3913
3976
|
maxTurns,
|
|
@@ -3921,7 +3984,7 @@ var Runner = class _Runner {
|
|
|
3921
3984
|
* Stream an agent's response
|
|
3922
3985
|
*/
|
|
3923
3986
|
static async stream(agent2, messages, options) {
|
|
3924
|
-
|
|
3987
|
+
logger13.info(
|
|
3925
3988
|
{
|
|
3926
3989
|
agentId: agent2.getId(),
|
|
3927
3990
|
defaultSubAgent: agent2.getDefaultSubAgent()?.getName()
|
|
@@ -3937,7 +4000,7 @@ var Runner = class _Runner {
|
|
|
3937
4000
|
if (agent2.length === 0) {
|
|
3938
4001
|
throw new Error("No agent provided for race");
|
|
3939
4002
|
}
|
|
3940
|
-
|
|
4003
|
+
logger13.info(
|
|
3941
4004
|
{
|
|
3942
4005
|
agentCount: agent2.length,
|
|
3943
4006
|
agentIds: agent2.map((g) => g.getId())
|
|
@@ -3949,7 +4012,7 @@ var Runner = class _Runner {
|
|
|
3949
4012
|
const result2 = await _Runner.run(agent3, messages, options);
|
|
3950
4013
|
return { ...result2, raceIndex: index };
|
|
3951
4014
|
} catch (error) {
|
|
3952
|
-
|
|
4015
|
+
logger13.error(
|
|
3953
4016
|
{
|
|
3954
4017
|
agentId: agent3.getId(),
|
|
3955
4018
|
error: error instanceof Error ? error.message : "Unknown error"
|
|
@@ -3960,7 +4023,7 @@ var Runner = class _Runner {
|
|
|
3960
4023
|
}
|
|
3961
4024
|
});
|
|
3962
4025
|
const result = await Promise.race(promises);
|
|
3963
|
-
|
|
4026
|
+
logger13.info(
|
|
3964
4027
|
{
|
|
3965
4028
|
winningAgentId: result.agentId || "unknown",
|
|
3966
4029
|
raceIndex: result.raceIndex
|
|
@@ -4034,4 +4097,4 @@ var run = Runner.run.bind(Runner);
|
|
|
4034
4097
|
var stream = Runner.stream.bind(Runner);
|
|
4035
4098
|
var raceAgents = Runner.raceAgents.bind(Runner);
|
|
4036
4099
|
|
|
4037
|
-
export { ArtifactComponent, DataComponent, ExternalAgent, FunctionTool, Project, Runner, SubAgent, Tool, agent, agentMcp, artifactComponent, createEnvironmentSettings, createFullProjectViaAPI, credential, credentialRef, dataComponent, deleteFullProjectViaAPI, externalAgent, externalAgents, functionTool, getFullProjectViaAPI, isCredentialReference, mcpServer, mcpTool, project, raceAgents, registerEnvironmentSettings, run, stream, subAgent, transfer, updateFullProjectViaAPI };
|
|
4100
|
+
export { ArtifactComponent, DataComponent, ExternalAgent, FunctionTool, Project, Runner, StatusComponent, SubAgent, Tool, agent, agentMcp, artifactComponent, createEnvironmentSettings, createFullProjectViaAPI, credential, credentialRef, dataComponent, deleteFullProjectViaAPI, externalAgent, externalAgents, functionTool, getFullProjectViaAPI, isCredentialReference, mcpServer, mcpTool, project, raceAgents, registerEnvironmentSettings, run, statusComponent, stream, subAgent, transfer, updateFullProjectViaAPI };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@inkeep/agents-sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.22.1",
|
|
4
4
|
"description": "Agents SDK for building and managing agents in the Inkeep Agent Framework",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
"nanoid": "^5.1.5",
|
|
13
13
|
"typescript": "^5.3.3",
|
|
14
14
|
"zod": "^4.1.11",
|
|
15
|
-
"@inkeep/agents-core": "^0.
|
|
15
|
+
"@inkeep/agents-core": "^0.22.1"
|
|
16
16
|
},
|
|
17
17
|
"devDependencies": {
|
|
18
18
|
"@types/js-yaml": "^4.0.9",
|