agent-swarm-kit 1.1.69 → 1.1.71
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/build/index.cjs +66 -17
- package/build/index.mjs +66 -17
- package/package.json +1 -1
package/build/index.cjs
CHANGED
|
@@ -13344,29 +13344,58 @@ class DocService {
|
|
|
13344
13344
|
result.push("");
|
|
13345
13345
|
}
|
|
13346
13346
|
}
|
|
13347
|
-
|
|
13347
|
+
const getPrompt = async () => {
|
|
13348
|
+
try {
|
|
13349
|
+
if (typeof agentSchema.prompt === "string") {
|
|
13350
|
+
return agentSchema.prompt;
|
|
13351
|
+
}
|
|
13352
|
+
if (typeof agentSchema.prompt === "function") {
|
|
13353
|
+
return await agentSchema.prompt("docs", agentSchema.agentName);
|
|
13354
|
+
}
|
|
13355
|
+
return null;
|
|
13356
|
+
}
|
|
13357
|
+
catch {
|
|
13358
|
+
return null;
|
|
13359
|
+
}
|
|
13360
|
+
};
|
|
13361
|
+
const prompt = await getPrompt();
|
|
13362
|
+
if (prompt) {
|
|
13348
13363
|
result.push(`## Main prompt`);
|
|
13349
13364
|
result.push("");
|
|
13350
13365
|
result.push("```");
|
|
13351
|
-
result.push(
|
|
13366
|
+
result.push(prompt);
|
|
13352
13367
|
result.push("```");
|
|
13353
13368
|
result.push("");
|
|
13354
13369
|
}
|
|
13355
|
-
|
|
13370
|
+
const getSystem = async () => {
|
|
13371
|
+
let system = [];
|
|
13372
|
+
try {
|
|
13373
|
+
if (agentSchema.systemStatic) {
|
|
13374
|
+
system = system.concat(agentSchema.systemStatic);
|
|
13375
|
+
}
|
|
13376
|
+
if (agentSchema.system) {
|
|
13377
|
+
system = system.concat(agentSchema.system);
|
|
13378
|
+
}
|
|
13379
|
+
if (agentSchema.systemDynamic) {
|
|
13380
|
+
system = system.concat(await agentSchema.systemDynamic("docs", agentSchema.agentName));
|
|
13381
|
+
}
|
|
13382
|
+
}
|
|
13383
|
+
finally {
|
|
13384
|
+
return system;
|
|
13385
|
+
}
|
|
13386
|
+
};
|
|
13387
|
+
const system = await getSystem();
|
|
13388
|
+
if (system.length) {
|
|
13356
13389
|
result.push(`## System prompt`);
|
|
13357
13390
|
result.push("");
|
|
13358
|
-
for (let i = 0; i !==
|
|
13359
|
-
if (!
|
|
13391
|
+
for (let i = 0; i !== system.length; i++) {
|
|
13392
|
+
if (!system[i]) {
|
|
13360
13393
|
continue;
|
|
13361
13394
|
}
|
|
13362
|
-
result.push(`${i + 1}. \`${
|
|
13395
|
+
result.push(`${i + 1}. \`${system[i]}\``);
|
|
13363
13396
|
result.push("");
|
|
13364
13397
|
}
|
|
13365
13398
|
}
|
|
13366
|
-
if (agentSchema.systemDynamic) {
|
|
13367
|
-
result.push("***Dynamic system prompt found***");
|
|
13368
|
-
result.push("");
|
|
13369
|
-
}
|
|
13370
13399
|
if (agentSchema.dependsOn) {
|
|
13371
13400
|
result.push(`## Depends on`);
|
|
13372
13401
|
result.push("");
|
|
@@ -13399,17 +13428,37 @@ class DocService {
|
|
|
13399
13428
|
result.push("");
|
|
13400
13429
|
}
|
|
13401
13430
|
}
|
|
13402
|
-
|
|
13431
|
+
const getTools = async () => {
|
|
13432
|
+
try {
|
|
13433
|
+
if (!agentSchema.tools) {
|
|
13434
|
+
return null;
|
|
13435
|
+
}
|
|
13436
|
+
return await Promise.all(agentSchema.tools
|
|
13437
|
+
.map((toolName) => this.toolSchemaService.get(toolName))
|
|
13438
|
+
.map(async (tool) => {
|
|
13439
|
+
const { function: upperFn, ...other } = tool;
|
|
13440
|
+
const fn = typeof upperFn === "function"
|
|
13441
|
+
? await upperFn("docs", agentSchema.agentName)
|
|
13442
|
+
: upperFn;
|
|
13443
|
+
return {
|
|
13444
|
+
...other,
|
|
13445
|
+
function: fn,
|
|
13446
|
+
};
|
|
13447
|
+
}));
|
|
13448
|
+
}
|
|
13449
|
+
catch {
|
|
13450
|
+
return null;
|
|
13451
|
+
}
|
|
13452
|
+
};
|
|
13453
|
+
const tools = await getTools();
|
|
13454
|
+
if (tools) {
|
|
13403
13455
|
result.push(`## Used tools`);
|
|
13404
13456
|
result.push("");
|
|
13405
|
-
for (let i = 0; i !==
|
|
13406
|
-
if (!
|
|
13407
|
-
continue;
|
|
13408
|
-
}
|
|
13409
|
-
const { function: fn, docNote, callbacks, } = this.toolSchemaService.get(agentSchema.tools[i]);
|
|
13410
|
-
if (typeof fn === "function") {
|
|
13457
|
+
for (let i = 0; i !== tools.length; i++) {
|
|
13458
|
+
if (!tools[i]) {
|
|
13411
13459
|
continue;
|
|
13412
13460
|
}
|
|
13461
|
+
const { function: fn, docNote, callbacks } = tools[i];
|
|
13413
13462
|
result.push(`### ${i + 1}. ${agentSchema.tools[i]}`);
|
|
13414
13463
|
if (fn.name) {
|
|
13415
13464
|
result.push("");
|
package/build/index.mjs
CHANGED
|
@@ -13342,29 +13342,58 @@ class DocService {
|
|
|
13342
13342
|
result.push("");
|
|
13343
13343
|
}
|
|
13344
13344
|
}
|
|
13345
|
-
|
|
13345
|
+
const getPrompt = async () => {
|
|
13346
|
+
try {
|
|
13347
|
+
if (typeof agentSchema.prompt === "string") {
|
|
13348
|
+
return agentSchema.prompt;
|
|
13349
|
+
}
|
|
13350
|
+
if (typeof agentSchema.prompt === "function") {
|
|
13351
|
+
return await agentSchema.prompt("docs", agentSchema.agentName);
|
|
13352
|
+
}
|
|
13353
|
+
return null;
|
|
13354
|
+
}
|
|
13355
|
+
catch {
|
|
13356
|
+
return null;
|
|
13357
|
+
}
|
|
13358
|
+
};
|
|
13359
|
+
const prompt = await getPrompt();
|
|
13360
|
+
if (prompt) {
|
|
13346
13361
|
result.push(`## Main prompt`);
|
|
13347
13362
|
result.push("");
|
|
13348
13363
|
result.push("```");
|
|
13349
|
-
result.push(
|
|
13364
|
+
result.push(prompt);
|
|
13350
13365
|
result.push("```");
|
|
13351
13366
|
result.push("");
|
|
13352
13367
|
}
|
|
13353
|
-
|
|
13368
|
+
const getSystem = async () => {
|
|
13369
|
+
let system = [];
|
|
13370
|
+
try {
|
|
13371
|
+
if (agentSchema.systemStatic) {
|
|
13372
|
+
system = system.concat(agentSchema.systemStatic);
|
|
13373
|
+
}
|
|
13374
|
+
if (agentSchema.system) {
|
|
13375
|
+
system = system.concat(agentSchema.system);
|
|
13376
|
+
}
|
|
13377
|
+
if (agentSchema.systemDynamic) {
|
|
13378
|
+
system = system.concat(await agentSchema.systemDynamic("docs", agentSchema.agentName));
|
|
13379
|
+
}
|
|
13380
|
+
}
|
|
13381
|
+
finally {
|
|
13382
|
+
return system;
|
|
13383
|
+
}
|
|
13384
|
+
};
|
|
13385
|
+
const system = await getSystem();
|
|
13386
|
+
if (system.length) {
|
|
13354
13387
|
result.push(`## System prompt`);
|
|
13355
13388
|
result.push("");
|
|
13356
|
-
for (let i = 0; i !==
|
|
13357
|
-
if (!
|
|
13389
|
+
for (let i = 0; i !== system.length; i++) {
|
|
13390
|
+
if (!system[i]) {
|
|
13358
13391
|
continue;
|
|
13359
13392
|
}
|
|
13360
|
-
result.push(`${i + 1}. \`${
|
|
13393
|
+
result.push(`${i + 1}. \`${system[i]}\``);
|
|
13361
13394
|
result.push("");
|
|
13362
13395
|
}
|
|
13363
13396
|
}
|
|
13364
|
-
if (agentSchema.systemDynamic) {
|
|
13365
|
-
result.push("***Dynamic system prompt found***");
|
|
13366
|
-
result.push("");
|
|
13367
|
-
}
|
|
13368
13397
|
if (agentSchema.dependsOn) {
|
|
13369
13398
|
result.push(`## Depends on`);
|
|
13370
13399
|
result.push("");
|
|
@@ -13397,17 +13426,37 @@ class DocService {
|
|
|
13397
13426
|
result.push("");
|
|
13398
13427
|
}
|
|
13399
13428
|
}
|
|
13400
|
-
|
|
13429
|
+
const getTools = async () => {
|
|
13430
|
+
try {
|
|
13431
|
+
if (!agentSchema.tools) {
|
|
13432
|
+
return null;
|
|
13433
|
+
}
|
|
13434
|
+
return await Promise.all(agentSchema.tools
|
|
13435
|
+
.map((toolName) => this.toolSchemaService.get(toolName))
|
|
13436
|
+
.map(async (tool) => {
|
|
13437
|
+
const { function: upperFn, ...other } = tool;
|
|
13438
|
+
const fn = typeof upperFn === "function"
|
|
13439
|
+
? await upperFn("docs", agentSchema.agentName)
|
|
13440
|
+
: upperFn;
|
|
13441
|
+
return {
|
|
13442
|
+
...other,
|
|
13443
|
+
function: fn,
|
|
13444
|
+
};
|
|
13445
|
+
}));
|
|
13446
|
+
}
|
|
13447
|
+
catch {
|
|
13448
|
+
return null;
|
|
13449
|
+
}
|
|
13450
|
+
};
|
|
13451
|
+
const tools = await getTools();
|
|
13452
|
+
if (tools) {
|
|
13401
13453
|
result.push(`## Used tools`);
|
|
13402
13454
|
result.push("");
|
|
13403
|
-
for (let i = 0; i !==
|
|
13404
|
-
if (!
|
|
13405
|
-
continue;
|
|
13406
|
-
}
|
|
13407
|
-
const { function: fn, docNote, callbacks, } = this.toolSchemaService.get(agentSchema.tools[i]);
|
|
13408
|
-
if (typeof fn === "function") {
|
|
13455
|
+
for (let i = 0; i !== tools.length; i++) {
|
|
13456
|
+
if (!tools[i]) {
|
|
13409
13457
|
continue;
|
|
13410
13458
|
}
|
|
13459
|
+
const { function: fn, docNote, callbacks } = tools[i];
|
|
13411
13460
|
result.push(`### ${i + 1}. ${agentSchema.tools[i]}`);
|
|
13412
13461
|
if (fn.name) {
|
|
13413
13462
|
result.push("");
|