agent-swarm-kit 1.1.118 → 1.1.120
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 +12 -2
- package/build/index.mjs +12 -2
- package/package.json +1 -1
- package/types.d.ts +8 -0
package/build/index.cjs
CHANGED
|
@@ -21251,12 +21251,21 @@ const jsonInternal = beginContext(async (outlineName, param) => {
|
|
|
21251
21251
|
const resultId = functoolsKit.randomString();
|
|
21252
21252
|
const { getOutlineHistory, completion, validations = [], maxAttempts = MAX_ATTEMPTS, format, prompt, callbacks: outlineCallbacks, } = swarm$1.outlineSchemaService.get(outlineName);
|
|
21253
21253
|
swarm$1.completionValidationService.validate(completion, METHOD_NAME$D);
|
|
21254
|
-
const { getCompletion, callbacks: completionCallbacks } = swarm$1.completionSchemaService.get(completion);
|
|
21254
|
+
const { getCompletion, flags = [], callbacks: completionCallbacks, } = swarm$1.completionSchemaService.get(completion);
|
|
21255
21255
|
let errorMessage = "";
|
|
21256
21256
|
let history;
|
|
21257
21257
|
const systemPrompt = typeof prompt === "function" ? await prompt(outlineName) : prompt;
|
|
21258
|
-
|
|
21258
|
+
const makeHistory = async () => {
|
|
21259
21259
|
history = new OutlineHistory(systemPrompt);
|
|
21260
|
+
for (const flag of flags) {
|
|
21261
|
+
await history.push({
|
|
21262
|
+
role: "system",
|
|
21263
|
+
content: flag,
|
|
21264
|
+
});
|
|
21265
|
+
}
|
|
21266
|
+
};
|
|
21267
|
+
for (let attempt = 0; attempt < maxAttempts; attempt++) {
|
|
21268
|
+
await makeHistory();
|
|
21260
21269
|
const inputArgs = {
|
|
21261
21270
|
attempt,
|
|
21262
21271
|
format,
|
|
@@ -21273,6 +21282,7 @@ const jsonInternal = beginContext(async (outlineName, param) => {
|
|
|
21273
21282
|
messages: await history.list(),
|
|
21274
21283
|
mode: "tool",
|
|
21275
21284
|
outlineName,
|
|
21285
|
+
format,
|
|
21276
21286
|
});
|
|
21277
21287
|
if (completionCallbacks?.onComplete) {
|
|
21278
21288
|
completionCallbacks.onComplete({
|
package/build/index.mjs
CHANGED
|
@@ -21249,12 +21249,21 @@ const jsonInternal = beginContext(async (outlineName, param) => {
|
|
|
21249
21249
|
const resultId = randomString();
|
|
21250
21250
|
const { getOutlineHistory, completion, validations = [], maxAttempts = MAX_ATTEMPTS, format, prompt, callbacks: outlineCallbacks, } = swarm$1.outlineSchemaService.get(outlineName);
|
|
21251
21251
|
swarm$1.completionValidationService.validate(completion, METHOD_NAME$D);
|
|
21252
|
-
const { getCompletion, callbacks: completionCallbacks } = swarm$1.completionSchemaService.get(completion);
|
|
21252
|
+
const { getCompletion, flags = [], callbacks: completionCallbacks, } = swarm$1.completionSchemaService.get(completion);
|
|
21253
21253
|
let errorMessage = "";
|
|
21254
21254
|
let history;
|
|
21255
21255
|
const systemPrompt = typeof prompt === "function" ? await prompt(outlineName) : prompt;
|
|
21256
|
-
|
|
21256
|
+
const makeHistory = async () => {
|
|
21257
21257
|
history = new OutlineHistory(systemPrompt);
|
|
21258
|
+
for (const flag of flags) {
|
|
21259
|
+
await history.push({
|
|
21260
|
+
role: "system",
|
|
21261
|
+
content: flag,
|
|
21262
|
+
});
|
|
21263
|
+
}
|
|
21264
|
+
};
|
|
21265
|
+
for (let attempt = 0; attempt < maxAttempts; attempt++) {
|
|
21266
|
+
await makeHistory();
|
|
21258
21267
|
const inputArgs = {
|
|
21259
21268
|
attempt,
|
|
21260
21269
|
format,
|
|
@@ -21271,6 +21280,7 @@ const jsonInternal = beginContext(async (outlineName, param) => {
|
|
|
21271
21280
|
messages: await history.list(),
|
|
21272
21281
|
mode: "tool",
|
|
21273
21282
|
outlineName,
|
|
21283
|
+
format,
|
|
21274
21284
|
});
|
|
21275
21285
|
if (completionCallbacks?.onComplete) {
|
|
21276
21286
|
completionCallbacks.onComplete({
|
package/package.json
CHANGED
package/types.d.ts
CHANGED
|
@@ -3399,6 +3399,14 @@ interface ICompletionArgs {
|
|
|
3399
3399
|
messages: (IModelMessage | IOutlineMessage)[];
|
|
3400
3400
|
/** Optional array of tools available for the completion process (e.g., for tool calls). */
|
|
3401
3401
|
tools?: ITool[];
|
|
3402
|
+
/**
|
|
3403
|
+
* Optional format for the outline, specifying how the completion should be structured.
|
|
3404
|
+
* This is used to define the expected output format for JSON completions.
|
|
3405
|
+
* If not provided, the default outline format will be used.
|
|
3406
|
+
* @type {IOutlineFormat}
|
|
3407
|
+
* @optional
|
|
3408
|
+
*/
|
|
3409
|
+
format?: IOutlineFormat;
|
|
3402
3410
|
}
|
|
3403
3411
|
/**
|
|
3404
3412
|
* Interface representing lifecycle callbacks for completion events.
|