agent-swarm-kit 1.0.47 → 1.0.48
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 +164 -3
- package/build/index.mjs +159 -4
- package/package.json +1 -1
- package/types.d.ts +62 -8
package/build/index.cjs
CHANGED
|
@@ -4222,6 +4222,23 @@ var getAgentHistory = function (clientId, agentName) { return __awaiter(void 0,
|
|
|
4222
4222
|
});
|
|
4223
4223
|
}); };
|
|
4224
4224
|
|
|
4225
|
+
/**
|
|
4226
|
+
* Return the session mode (`"session" | "makeConnection" | "complete"`) for clientId
|
|
4227
|
+
*
|
|
4228
|
+
* @param {string} clientId - The client ID of the session.
|
|
4229
|
+
*/
|
|
4230
|
+
var getSessionMode = function (clientId) { return __awaiter(void 0, void 0, void 0, function () {
|
|
4231
|
+
var swarmName;
|
|
4232
|
+
return __generator(this, function (_a) {
|
|
4233
|
+
swarm.loggerService.log("function getSessionMode", {
|
|
4234
|
+
clientId: clientId,
|
|
4235
|
+
});
|
|
4236
|
+
swarmName = swarm.sessionValidationService.getSwarm(clientId);
|
|
4237
|
+
swarm.swarmValidationService.validate(swarmName, "getSessionMode");
|
|
4238
|
+
return [2 /*return*/, swarm.sessionValidationService.getSessionMode(clientId)];
|
|
4239
|
+
});
|
|
4240
|
+
}); };
|
|
4241
|
+
|
|
4225
4242
|
/**
|
|
4226
4243
|
* Commits the tool output to the active agent in a swarm session
|
|
4227
4244
|
*
|
|
@@ -4408,10 +4425,10 @@ var emit = function (content, clientId, agentName) { return __awaiter(void 0, vo
|
|
|
4408
4425
|
if (swarm.sessionValidationService.getSessionMode(clientId) !== "makeConnection") {
|
|
4409
4426
|
throw new Error("agent-swarm-kit emit session is not makeConnection clientId=".concat(clientId));
|
|
4410
4427
|
}
|
|
4411
|
-
swarm.agentValidationService.validate(agentName, "
|
|
4412
|
-
swarm.sessionValidationService.validate(clientId, "
|
|
4428
|
+
swarm.agentValidationService.validate(agentName, "emit");
|
|
4429
|
+
swarm.sessionValidationService.validate(clientId, "emit");
|
|
4413
4430
|
swarmName = swarm.sessionValidationService.getSwarm(clientId);
|
|
4414
|
-
swarm.swarmValidationService.validate(swarmName, "
|
|
4431
|
+
swarm.swarmValidationService.validate(swarmName, "emit");
|
|
4415
4432
|
return [4 /*yield*/, swarm.swarmPublicService.getAgentName(clientId, swarmName)];
|
|
4416
4433
|
case 1:
|
|
4417
4434
|
currentAgentName = _a.sent();
|
|
@@ -4429,6 +4446,144 @@ var emit = function (content, clientId, agentName) { return __awaiter(void 0, vo
|
|
|
4429
4446
|
});
|
|
4430
4447
|
}); };
|
|
4431
4448
|
|
|
4449
|
+
/**
|
|
4450
|
+
* Commits the tool output to the active agent in a swarm session without checking active agent
|
|
4451
|
+
*
|
|
4452
|
+
* @param {string} content - The content to be committed.
|
|
4453
|
+
* @param {string} clientId - The client ID associated with the session.
|
|
4454
|
+
* @returns {Promise<void>} - A promise that resolves when the operation is complete.
|
|
4455
|
+
*/
|
|
4456
|
+
var commitToolOutputForce = function (toolId, content, clientId) { return __awaiter(void 0, void 0, void 0, function () {
|
|
4457
|
+
var swarmName;
|
|
4458
|
+
return __generator(this, function (_a) {
|
|
4459
|
+
switch (_a.label) {
|
|
4460
|
+
case 0:
|
|
4461
|
+
swarm.loggerService.log('function commitToolOutputForce', {
|
|
4462
|
+
toolId: toolId,
|
|
4463
|
+
content: content,
|
|
4464
|
+
clientId: clientId,
|
|
4465
|
+
});
|
|
4466
|
+
swarm.sessionValidationService.validate(clientId, "commitToolOutputForce");
|
|
4467
|
+
swarmName = swarm.sessionValidationService.getSwarm(clientId);
|
|
4468
|
+
swarm.swarmValidationService.validate(swarmName, "commitToolOutputForce");
|
|
4469
|
+
return [4 /*yield*/, swarm.sessionPublicService.commitToolOutput(toolId, content, clientId, swarmName)];
|
|
4470
|
+
case 1:
|
|
4471
|
+
_a.sent();
|
|
4472
|
+
return [2 /*return*/];
|
|
4473
|
+
}
|
|
4474
|
+
});
|
|
4475
|
+
}); };
|
|
4476
|
+
|
|
4477
|
+
/**
|
|
4478
|
+
* Commits a system message to the active agent in as swarm without checking active agent.
|
|
4479
|
+
*
|
|
4480
|
+
* @param {string} content - The content of the system message.
|
|
4481
|
+
* @param {string} clientId - The ID of the client.
|
|
4482
|
+
* @returns {Promise<void>} - A promise that resolves when the message is committed.
|
|
4483
|
+
*/
|
|
4484
|
+
var commitSystemMessageForce = function (content, clientId) { return __awaiter(void 0, void 0, void 0, function () {
|
|
4485
|
+
var swarmName;
|
|
4486
|
+
return __generator(this, function (_a) {
|
|
4487
|
+
switch (_a.label) {
|
|
4488
|
+
case 0:
|
|
4489
|
+
swarm.loggerService.log('function commitSystemMessageForce', {
|
|
4490
|
+
content: content,
|
|
4491
|
+
clientId: clientId,
|
|
4492
|
+
});
|
|
4493
|
+
swarm.sessionValidationService.validate(clientId, "commitSystemMessageForce");
|
|
4494
|
+
swarmName = swarm.sessionValidationService.getSwarm(clientId);
|
|
4495
|
+
swarm.swarmValidationService.validate(swarmName, "commitSystemMessageForce");
|
|
4496
|
+
return [4 /*yield*/, swarm.sessionPublicService.commitSystemMessage(content, clientId, swarmName)];
|
|
4497
|
+
case 1:
|
|
4498
|
+
_a.sent();
|
|
4499
|
+
return [2 /*return*/];
|
|
4500
|
+
}
|
|
4501
|
+
});
|
|
4502
|
+
}); };
|
|
4503
|
+
|
|
4504
|
+
/**
|
|
4505
|
+
* Commits flush of agent history without active agent check
|
|
4506
|
+
*
|
|
4507
|
+
* @param {string} clientId - The ID of the client.
|
|
4508
|
+
* @returns {Promise<void>} - A promise that resolves when the message is committed.
|
|
4509
|
+
*/
|
|
4510
|
+
var commitFlushForce = function (clientId) { return __awaiter(void 0, void 0, void 0, function () {
|
|
4511
|
+
var swarmName;
|
|
4512
|
+
return __generator(this, function (_a) {
|
|
4513
|
+
switch (_a.label) {
|
|
4514
|
+
case 0:
|
|
4515
|
+
swarm.loggerService.log('function commitFlushForce', {
|
|
4516
|
+
clientId: clientId,
|
|
4517
|
+
});
|
|
4518
|
+
swarm.sessionValidationService.validate(clientId, "commitFlushForce");
|
|
4519
|
+
swarmName = swarm.sessionValidationService.getSwarm(clientId);
|
|
4520
|
+
swarm.swarmValidationService.validate(swarmName, "commitFlushForce");
|
|
4521
|
+
return [4 /*yield*/, swarm.sessionPublicService.commitFlush(clientId, swarmName)];
|
|
4522
|
+
case 1:
|
|
4523
|
+
_a.sent();
|
|
4524
|
+
return [2 /*return*/];
|
|
4525
|
+
}
|
|
4526
|
+
});
|
|
4527
|
+
}); };
|
|
4528
|
+
|
|
4529
|
+
/**
|
|
4530
|
+
* Commits a user message to the active agent history in as swarm without answer and checking active agent
|
|
4531
|
+
*
|
|
4532
|
+
* @param {string} content - The content of the message.
|
|
4533
|
+
* @param {string} clientId - The ID of the client.
|
|
4534
|
+
* @returns {Promise<void>} - A promise that resolves when the message is committed.
|
|
4535
|
+
*/
|
|
4536
|
+
var commitUserMessageForce = function (content, clientId) { return __awaiter(void 0, void 0, void 0, function () {
|
|
4537
|
+
var swarmName;
|
|
4538
|
+
return __generator(this, function (_a) {
|
|
4539
|
+
switch (_a.label) {
|
|
4540
|
+
case 0:
|
|
4541
|
+
swarm.loggerService.log('function commitSystemMessage', {
|
|
4542
|
+
content: content,
|
|
4543
|
+
clientId: clientId,
|
|
4544
|
+
});
|
|
4545
|
+
swarm.sessionValidationService.validate(clientId, "commitUserMessageForce");
|
|
4546
|
+
swarmName = swarm.sessionValidationService.getSwarm(clientId);
|
|
4547
|
+
swarm.swarmValidationService.validate(swarmName, "commitUserMessageForce");
|
|
4548
|
+
return [4 /*yield*/, swarm.sessionPublicService.commitUserMessage(content, clientId, swarmName)];
|
|
4549
|
+
case 1:
|
|
4550
|
+
_a.sent();
|
|
4551
|
+
return [2 /*return*/];
|
|
4552
|
+
}
|
|
4553
|
+
});
|
|
4554
|
+
}); };
|
|
4555
|
+
|
|
4556
|
+
/**
|
|
4557
|
+
* Emits a string constant as the model output without executing incoming message and checking active agent
|
|
4558
|
+
* Works only for `makeConnection`
|
|
4559
|
+
*
|
|
4560
|
+
* @param {string} content - The content to be emitted.
|
|
4561
|
+
* @param {string} clientId - The client ID of the session.
|
|
4562
|
+
* @param {AgentName} agentName - The name of the agent to emit the content to.
|
|
4563
|
+
* @throws Will throw an error if the session mode is not "makeConnection".
|
|
4564
|
+
* @returns {Promise<void>} A promise that resolves when the content is emitted.
|
|
4565
|
+
*/
|
|
4566
|
+
var emitForce = function (content, clientId) { return __awaiter(void 0, void 0, void 0, function () {
|
|
4567
|
+
var swarmName;
|
|
4568
|
+
return __generator(this, function (_a) {
|
|
4569
|
+
switch (_a.label) {
|
|
4570
|
+
case 0:
|
|
4571
|
+
swarm.loggerService.log("function emitForce", {
|
|
4572
|
+
content: content,
|
|
4573
|
+
clientId: clientId,
|
|
4574
|
+
});
|
|
4575
|
+
if (swarm.sessionValidationService.getSessionMode(clientId) !== "makeConnection") {
|
|
4576
|
+
throw new Error("agent-swarm-kit emitForce session is not makeConnection clientId=".concat(clientId));
|
|
4577
|
+
}
|
|
4578
|
+
swarm.sessionValidationService.validate(clientId, "emitForce");
|
|
4579
|
+
swarmName = swarm.sessionValidationService.getSwarm(clientId);
|
|
4580
|
+
swarm.swarmValidationService.validate(swarmName, "emitForce");
|
|
4581
|
+
return [4 /*yield*/, swarm.sessionPublicService.emit(content, clientId, swarmName)];
|
|
4582
|
+
case 1: return [2 /*return*/, _a.sent()];
|
|
4583
|
+
}
|
|
4584
|
+
});
|
|
4585
|
+
}); };
|
|
4586
|
+
|
|
4432
4587
|
/**
|
|
4433
4588
|
* Retrieves the last message sent by the user from the client's message history.
|
|
4434
4589
|
*
|
|
@@ -4618,12 +4773,17 @@ exports.addSwarm = addSwarm;
|
|
|
4618
4773
|
exports.addTool = addTool;
|
|
4619
4774
|
exports.changeAgent = changeAgent;
|
|
4620
4775
|
exports.commitFlush = commitFlush;
|
|
4776
|
+
exports.commitFlushForce = commitFlushForce;
|
|
4621
4777
|
exports.commitSystemMessage = commitSystemMessage;
|
|
4778
|
+
exports.commitSystemMessageForce = commitSystemMessageForce;
|
|
4622
4779
|
exports.commitToolOutput = commitToolOutput;
|
|
4780
|
+
exports.commitToolOutputForce = commitToolOutputForce;
|
|
4623
4781
|
exports.commitUserMessage = commitUserMessage;
|
|
4782
|
+
exports.commitUserMessageForce = commitUserMessageForce;
|
|
4624
4783
|
exports.complete = complete;
|
|
4625
4784
|
exports.disposeConnection = disposeConnection;
|
|
4626
4785
|
exports.emit = emit;
|
|
4786
|
+
exports.emitForce = emitForce;
|
|
4627
4787
|
exports.execute = execute;
|
|
4628
4788
|
exports.getAgentHistory = getAgentHistory;
|
|
4629
4789
|
exports.getAgentName = getAgentName;
|
|
@@ -4632,6 +4792,7 @@ exports.getLastAssistantMessage = getLastAssistantMessage;
|
|
|
4632
4792
|
exports.getLastSystemMessage = getLastSystemMessage;
|
|
4633
4793
|
exports.getLastUserMessage = getLastUserMessage;
|
|
4634
4794
|
exports.getRawHistory = getRawHistory;
|
|
4795
|
+
exports.getSessionMode = getSessionMode;
|
|
4635
4796
|
exports.getUserHistory = getUserHistory;
|
|
4636
4797
|
exports.makeAutoDispose = makeAutoDispose;
|
|
4637
4798
|
exports.makeConnection = makeConnection;
|
package/build/index.mjs
CHANGED
|
@@ -4220,6 +4220,23 @@ var getAgentHistory = function (clientId, agentName) { return __awaiter(void 0,
|
|
|
4220
4220
|
});
|
|
4221
4221
|
}); };
|
|
4222
4222
|
|
|
4223
|
+
/**
|
|
4224
|
+
* Return the session mode (`"session" | "makeConnection" | "complete"`) for clientId
|
|
4225
|
+
*
|
|
4226
|
+
* @param {string} clientId - The client ID of the session.
|
|
4227
|
+
*/
|
|
4228
|
+
var getSessionMode = function (clientId) { return __awaiter(void 0, void 0, void 0, function () {
|
|
4229
|
+
var swarmName;
|
|
4230
|
+
return __generator(this, function (_a) {
|
|
4231
|
+
swarm.loggerService.log("function getSessionMode", {
|
|
4232
|
+
clientId: clientId,
|
|
4233
|
+
});
|
|
4234
|
+
swarmName = swarm.sessionValidationService.getSwarm(clientId);
|
|
4235
|
+
swarm.swarmValidationService.validate(swarmName, "getSessionMode");
|
|
4236
|
+
return [2 /*return*/, swarm.sessionValidationService.getSessionMode(clientId)];
|
|
4237
|
+
});
|
|
4238
|
+
}); };
|
|
4239
|
+
|
|
4223
4240
|
/**
|
|
4224
4241
|
* Commits the tool output to the active agent in a swarm session
|
|
4225
4242
|
*
|
|
@@ -4406,10 +4423,10 @@ var emit = function (content, clientId, agentName) { return __awaiter(void 0, vo
|
|
|
4406
4423
|
if (swarm.sessionValidationService.getSessionMode(clientId) !== "makeConnection") {
|
|
4407
4424
|
throw new Error("agent-swarm-kit emit session is not makeConnection clientId=".concat(clientId));
|
|
4408
4425
|
}
|
|
4409
|
-
swarm.agentValidationService.validate(agentName, "
|
|
4410
|
-
swarm.sessionValidationService.validate(clientId, "
|
|
4426
|
+
swarm.agentValidationService.validate(agentName, "emit");
|
|
4427
|
+
swarm.sessionValidationService.validate(clientId, "emit");
|
|
4411
4428
|
swarmName = swarm.sessionValidationService.getSwarm(clientId);
|
|
4412
|
-
swarm.swarmValidationService.validate(swarmName, "
|
|
4429
|
+
swarm.swarmValidationService.validate(swarmName, "emit");
|
|
4413
4430
|
return [4 /*yield*/, swarm.swarmPublicService.getAgentName(clientId, swarmName)];
|
|
4414
4431
|
case 1:
|
|
4415
4432
|
currentAgentName = _a.sent();
|
|
@@ -4427,6 +4444,144 @@ var emit = function (content, clientId, agentName) { return __awaiter(void 0, vo
|
|
|
4427
4444
|
});
|
|
4428
4445
|
}); };
|
|
4429
4446
|
|
|
4447
|
+
/**
|
|
4448
|
+
* Commits the tool output to the active agent in a swarm session without checking active agent
|
|
4449
|
+
*
|
|
4450
|
+
* @param {string} content - The content to be committed.
|
|
4451
|
+
* @param {string} clientId - The client ID associated with the session.
|
|
4452
|
+
* @returns {Promise<void>} - A promise that resolves when the operation is complete.
|
|
4453
|
+
*/
|
|
4454
|
+
var commitToolOutputForce = function (toolId, content, clientId) { return __awaiter(void 0, void 0, void 0, function () {
|
|
4455
|
+
var swarmName;
|
|
4456
|
+
return __generator(this, function (_a) {
|
|
4457
|
+
switch (_a.label) {
|
|
4458
|
+
case 0:
|
|
4459
|
+
swarm.loggerService.log('function commitToolOutputForce', {
|
|
4460
|
+
toolId: toolId,
|
|
4461
|
+
content: content,
|
|
4462
|
+
clientId: clientId,
|
|
4463
|
+
});
|
|
4464
|
+
swarm.sessionValidationService.validate(clientId, "commitToolOutputForce");
|
|
4465
|
+
swarmName = swarm.sessionValidationService.getSwarm(clientId);
|
|
4466
|
+
swarm.swarmValidationService.validate(swarmName, "commitToolOutputForce");
|
|
4467
|
+
return [4 /*yield*/, swarm.sessionPublicService.commitToolOutput(toolId, content, clientId, swarmName)];
|
|
4468
|
+
case 1:
|
|
4469
|
+
_a.sent();
|
|
4470
|
+
return [2 /*return*/];
|
|
4471
|
+
}
|
|
4472
|
+
});
|
|
4473
|
+
}); };
|
|
4474
|
+
|
|
4475
|
+
/**
|
|
4476
|
+
* Commits a system message to the active agent in as swarm without checking active agent.
|
|
4477
|
+
*
|
|
4478
|
+
* @param {string} content - The content of the system message.
|
|
4479
|
+
* @param {string} clientId - The ID of the client.
|
|
4480
|
+
* @returns {Promise<void>} - A promise that resolves when the message is committed.
|
|
4481
|
+
*/
|
|
4482
|
+
var commitSystemMessageForce = function (content, clientId) { return __awaiter(void 0, void 0, void 0, function () {
|
|
4483
|
+
var swarmName;
|
|
4484
|
+
return __generator(this, function (_a) {
|
|
4485
|
+
switch (_a.label) {
|
|
4486
|
+
case 0:
|
|
4487
|
+
swarm.loggerService.log('function commitSystemMessageForce', {
|
|
4488
|
+
content: content,
|
|
4489
|
+
clientId: clientId,
|
|
4490
|
+
});
|
|
4491
|
+
swarm.sessionValidationService.validate(clientId, "commitSystemMessageForce");
|
|
4492
|
+
swarmName = swarm.sessionValidationService.getSwarm(clientId);
|
|
4493
|
+
swarm.swarmValidationService.validate(swarmName, "commitSystemMessageForce");
|
|
4494
|
+
return [4 /*yield*/, swarm.sessionPublicService.commitSystemMessage(content, clientId, swarmName)];
|
|
4495
|
+
case 1:
|
|
4496
|
+
_a.sent();
|
|
4497
|
+
return [2 /*return*/];
|
|
4498
|
+
}
|
|
4499
|
+
});
|
|
4500
|
+
}); };
|
|
4501
|
+
|
|
4502
|
+
/**
|
|
4503
|
+
* Commits flush of agent history without active agent check
|
|
4504
|
+
*
|
|
4505
|
+
* @param {string} clientId - The ID of the client.
|
|
4506
|
+
* @returns {Promise<void>} - A promise that resolves when the message is committed.
|
|
4507
|
+
*/
|
|
4508
|
+
var commitFlushForce = function (clientId) { return __awaiter(void 0, void 0, void 0, function () {
|
|
4509
|
+
var swarmName;
|
|
4510
|
+
return __generator(this, function (_a) {
|
|
4511
|
+
switch (_a.label) {
|
|
4512
|
+
case 0:
|
|
4513
|
+
swarm.loggerService.log('function commitFlushForce', {
|
|
4514
|
+
clientId: clientId,
|
|
4515
|
+
});
|
|
4516
|
+
swarm.sessionValidationService.validate(clientId, "commitFlushForce");
|
|
4517
|
+
swarmName = swarm.sessionValidationService.getSwarm(clientId);
|
|
4518
|
+
swarm.swarmValidationService.validate(swarmName, "commitFlushForce");
|
|
4519
|
+
return [4 /*yield*/, swarm.sessionPublicService.commitFlush(clientId, swarmName)];
|
|
4520
|
+
case 1:
|
|
4521
|
+
_a.sent();
|
|
4522
|
+
return [2 /*return*/];
|
|
4523
|
+
}
|
|
4524
|
+
});
|
|
4525
|
+
}); };
|
|
4526
|
+
|
|
4527
|
+
/**
|
|
4528
|
+
* Commits a user message to the active agent history in as swarm without answer and checking active agent
|
|
4529
|
+
*
|
|
4530
|
+
* @param {string} content - The content of the message.
|
|
4531
|
+
* @param {string} clientId - The ID of the client.
|
|
4532
|
+
* @returns {Promise<void>} - A promise that resolves when the message is committed.
|
|
4533
|
+
*/
|
|
4534
|
+
var commitUserMessageForce = function (content, clientId) { return __awaiter(void 0, void 0, void 0, function () {
|
|
4535
|
+
var swarmName;
|
|
4536
|
+
return __generator(this, function (_a) {
|
|
4537
|
+
switch (_a.label) {
|
|
4538
|
+
case 0:
|
|
4539
|
+
swarm.loggerService.log('function commitSystemMessage', {
|
|
4540
|
+
content: content,
|
|
4541
|
+
clientId: clientId,
|
|
4542
|
+
});
|
|
4543
|
+
swarm.sessionValidationService.validate(clientId, "commitUserMessageForce");
|
|
4544
|
+
swarmName = swarm.sessionValidationService.getSwarm(clientId);
|
|
4545
|
+
swarm.swarmValidationService.validate(swarmName, "commitUserMessageForce");
|
|
4546
|
+
return [4 /*yield*/, swarm.sessionPublicService.commitUserMessage(content, clientId, swarmName)];
|
|
4547
|
+
case 1:
|
|
4548
|
+
_a.sent();
|
|
4549
|
+
return [2 /*return*/];
|
|
4550
|
+
}
|
|
4551
|
+
});
|
|
4552
|
+
}); };
|
|
4553
|
+
|
|
4554
|
+
/**
|
|
4555
|
+
* Emits a string constant as the model output without executing incoming message and checking active agent
|
|
4556
|
+
* Works only for `makeConnection`
|
|
4557
|
+
*
|
|
4558
|
+
* @param {string} content - The content to be emitted.
|
|
4559
|
+
* @param {string} clientId - The client ID of the session.
|
|
4560
|
+
* @param {AgentName} agentName - The name of the agent to emit the content to.
|
|
4561
|
+
* @throws Will throw an error if the session mode is not "makeConnection".
|
|
4562
|
+
* @returns {Promise<void>} A promise that resolves when the content is emitted.
|
|
4563
|
+
*/
|
|
4564
|
+
var emitForce = function (content, clientId) { return __awaiter(void 0, void 0, void 0, function () {
|
|
4565
|
+
var swarmName;
|
|
4566
|
+
return __generator(this, function (_a) {
|
|
4567
|
+
switch (_a.label) {
|
|
4568
|
+
case 0:
|
|
4569
|
+
swarm.loggerService.log("function emitForce", {
|
|
4570
|
+
content: content,
|
|
4571
|
+
clientId: clientId,
|
|
4572
|
+
});
|
|
4573
|
+
if (swarm.sessionValidationService.getSessionMode(clientId) !== "makeConnection") {
|
|
4574
|
+
throw new Error("agent-swarm-kit emitForce session is not makeConnection clientId=".concat(clientId));
|
|
4575
|
+
}
|
|
4576
|
+
swarm.sessionValidationService.validate(clientId, "emitForce");
|
|
4577
|
+
swarmName = swarm.sessionValidationService.getSwarm(clientId);
|
|
4578
|
+
swarm.swarmValidationService.validate(swarmName, "emitForce");
|
|
4579
|
+
return [4 /*yield*/, swarm.sessionPublicService.emit(content, clientId, swarmName)];
|
|
4580
|
+
case 1: return [2 /*return*/, _a.sent()];
|
|
4581
|
+
}
|
|
4582
|
+
});
|
|
4583
|
+
}); };
|
|
4584
|
+
|
|
4430
4585
|
/**
|
|
4431
4586
|
* Retrieves the last message sent by the user from the client's message history.
|
|
4432
4587
|
*
|
|
@@ -4609,4 +4764,4 @@ var makeAutoDispose = function (clientId, swarmName, _a) {
|
|
|
4609
4764
|
};
|
|
4610
4765
|
};
|
|
4611
4766
|
|
|
4612
|
-
export { ContextService, addAgent, addCompletion, addSwarm, addTool, changeAgent, commitFlush, commitSystemMessage, commitToolOutput, commitUserMessage, complete, disposeConnection, emit, execute, getAgentHistory, getAgentName, getAssistantHistory, getLastAssistantMessage, getLastSystemMessage, getLastUserMessage, getRawHistory, getUserHistory, makeAutoDispose, makeConnection, session, setConfig, swarm };
|
|
4767
|
+
export { ContextService, addAgent, addCompletion, addSwarm, addTool, changeAgent, commitFlush, commitFlushForce, commitSystemMessage, commitSystemMessageForce, commitToolOutput, commitToolOutputForce, commitUserMessage, commitUserMessageForce, complete, disposeConnection, emit, emitForce, execute, getAgentHistory, getAgentName, getAssistantHistory, getLastAssistantMessage, getLastSystemMessage, getLastUserMessage, getRawHistory, getSessionMode, getUserHistory, makeAutoDispose, makeConnection, session, setConfig, swarm };
|
package/package.json
CHANGED
package/types.d.ts
CHANGED
|
@@ -1947,6 +1947,13 @@ declare const getRawHistory: (clientId: string) => Promise<IModelMessage[]>;
|
|
|
1947
1947
|
*/
|
|
1948
1948
|
declare const getAgentHistory: (clientId: string, agentName: AgentName) => Promise<IModelMessage[]>;
|
|
1949
1949
|
|
|
1950
|
+
/**
|
|
1951
|
+
* Return the session mode (`"session" | "makeConnection" | "complete"`) for clientId
|
|
1952
|
+
*
|
|
1953
|
+
* @param {string} clientId - The client ID of the session.
|
|
1954
|
+
*/
|
|
1955
|
+
declare const getSessionMode: (clientId: string) => Promise<SessionMode>;
|
|
1956
|
+
|
|
1950
1957
|
/**
|
|
1951
1958
|
* Commits the tool output to the active agent in a swarm session
|
|
1952
1959
|
*
|
|
@@ -1976,6 +1983,16 @@ declare const commitSystemMessage: (content: string, clientId: string, agentName
|
|
|
1976
1983
|
*/
|
|
1977
1984
|
declare const commitFlush: (clientId: string, agentName: string) => Promise<void>;
|
|
1978
1985
|
|
|
1986
|
+
/**
|
|
1987
|
+
* Commits a user message to the active agent history in as swarm without answer.
|
|
1988
|
+
*
|
|
1989
|
+
* @param {string} content - The content of the message.
|
|
1990
|
+
* @param {string} clientId - The ID of the client.
|
|
1991
|
+
* @param {string} agentName - The name of the agent.
|
|
1992
|
+
* @returns {Promise<void>} - A promise that resolves when the message is committed.
|
|
1993
|
+
*/
|
|
1994
|
+
declare const commitUserMessage: (content: string, clientId: string, agentName: string) => Promise<void>;
|
|
1995
|
+
|
|
1979
1996
|
/**
|
|
1980
1997
|
* Send the message to the active agent in the swarm content like it income from client side
|
|
1981
1998
|
* Should be used to review tool output and initiate conversation from the model side to client
|
|
@@ -2000,22 +2017,59 @@ declare const execute: (content: string, clientId: string, agentName: AgentName)
|
|
|
2000
2017
|
declare const emit: (content: string, clientId: string, agentName: AgentName) => Promise<void>;
|
|
2001
2018
|
|
|
2002
2019
|
/**
|
|
2003
|
-
*
|
|
2020
|
+
* Commits the tool output to the active agent in a swarm session without checking active agent
|
|
2004
2021
|
*
|
|
2005
|
-
* @param {string}
|
|
2006
|
-
* @
|
|
2022
|
+
* @param {string} content - The content to be committed.
|
|
2023
|
+
* @param {string} clientId - The client ID associated with the session.
|
|
2024
|
+
* @returns {Promise<void>} - A promise that resolves when the operation is complete.
|
|
2007
2025
|
*/
|
|
2008
|
-
declare const
|
|
2026
|
+
declare const commitToolOutputForce: (toolId: string, content: string, clientId: string) => Promise<void>;
|
|
2009
2027
|
|
|
2010
2028
|
/**
|
|
2011
|
-
* Commits a
|
|
2029
|
+
* Commits a system message to the active agent in as swarm without checking active agent.
|
|
2030
|
+
*
|
|
2031
|
+
* @param {string} content - The content of the system message.
|
|
2032
|
+
* @param {string} clientId - The ID of the client.
|
|
2033
|
+
* @returns {Promise<void>} - A promise that resolves when the message is committed.
|
|
2034
|
+
*/
|
|
2035
|
+
declare const commitSystemMessageForce: (content: string, clientId: string) => Promise<void>;
|
|
2036
|
+
|
|
2037
|
+
/**
|
|
2038
|
+
* Commits flush of agent history without active agent check
|
|
2039
|
+
*
|
|
2040
|
+
* @param {string} clientId - The ID of the client.
|
|
2041
|
+
* @returns {Promise<void>} - A promise that resolves when the message is committed.
|
|
2042
|
+
*/
|
|
2043
|
+
declare const commitFlushForce: (clientId: string) => Promise<void>;
|
|
2044
|
+
|
|
2045
|
+
/**
|
|
2046
|
+
* Commits a user message to the active agent history in as swarm without answer and checking active agent
|
|
2012
2047
|
*
|
|
2013
2048
|
* @param {string} content - The content of the message.
|
|
2014
2049
|
* @param {string} clientId - The ID of the client.
|
|
2015
|
-
* @param {string} agentName - The name of the agent.
|
|
2016
2050
|
* @returns {Promise<void>} - A promise that resolves when the message is committed.
|
|
2017
2051
|
*/
|
|
2018
|
-
declare const
|
|
2052
|
+
declare const commitUserMessageForce: (content: string, clientId: string) => Promise<void>;
|
|
2053
|
+
|
|
2054
|
+
/**
|
|
2055
|
+
* Emits a string constant as the model output without executing incoming message and checking active agent
|
|
2056
|
+
* Works only for `makeConnection`
|
|
2057
|
+
*
|
|
2058
|
+
* @param {string} content - The content to be emitted.
|
|
2059
|
+
* @param {string} clientId - The client ID of the session.
|
|
2060
|
+
* @param {AgentName} agentName - The name of the agent to emit the content to.
|
|
2061
|
+
* @throws Will throw an error if the session mode is not "makeConnection".
|
|
2062
|
+
* @returns {Promise<void>} A promise that resolves when the content is emitted.
|
|
2063
|
+
*/
|
|
2064
|
+
declare const emitForce: (content: string, clientId: string) => Promise<void>;
|
|
2065
|
+
|
|
2066
|
+
/**
|
|
2067
|
+
* Retrieves the last message sent by the user from the client's message history.
|
|
2068
|
+
*
|
|
2069
|
+
* @param {string} clientId - The ID of the client whose message history is being retrieved.
|
|
2070
|
+
* @returns {Promise<string | null>} - The content of the last user message, or null if no user message is found.
|
|
2071
|
+
*/
|
|
2072
|
+
declare const getLastUserMessage: (clientId: string) => Promise<string>;
|
|
2019
2073
|
|
|
2020
2074
|
/**
|
|
2021
2075
|
* Retrieves the agent name for a given client ID.
|
|
@@ -2108,4 +2162,4 @@ declare const GLOBAL_CONFIG: {
|
|
|
2108
2162
|
};
|
|
2109
2163
|
declare const setConfig: (config: Partial<typeof GLOBAL_CONFIG>) => void;
|
|
2110
2164
|
|
|
2111
|
-
export { ContextService, type IAgentSchema, type IAgentTool, type ICompletionArgs, type ICompletionSchema, type IIncomingMessage, type IMakeConnectionConfig, type IMakeDisposeParams, type IModelMessage, type IOutgoingMessage, type ISessionConfig, type ISwarmSchema, type ITool, type IToolCall, type ReceiveMessageFn, type SendMessageFn$1 as SendMessageFn, addAgent, addCompletion, addSwarm, addTool, changeAgent, commitFlush, commitSystemMessage, commitToolOutput, commitUserMessage, complete, disposeConnection, emit, execute, getAgentHistory, getAgentName, getAssistantHistory, getLastAssistantMessage, getLastSystemMessage, getLastUserMessage, getRawHistory, getUserHistory, makeAutoDispose, makeConnection, session, setConfig, swarm };
|
|
2165
|
+
export { ContextService, type IAgentSchema, type IAgentTool, type ICompletionArgs, type ICompletionSchema, type IIncomingMessage, type IMakeConnectionConfig, type IMakeDisposeParams, type IModelMessage, type IOutgoingMessage, type ISessionConfig, type ISwarmSchema, type ITool, type IToolCall, type ReceiveMessageFn, type SendMessageFn$1 as SendMessageFn, addAgent, addCompletion, addSwarm, addTool, changeAgent, commitFlush, commitFlushForce, commitSystemMessage, commitSystemMessageForce, commitToolOutput, commitToolOutputForce, commitUserMessage, commitUserMessageForce, complete, disposeConnection, emit, emitForce, execute, getAgentHistory, getAgentName, getAssistantHistory, getLastAssistantMessage, getLastSystemMessage, getLastUserMessage, getRawHistory, getSessionMode, getUserHistory, makeAutoDispose, makeConnection, session, setConfig, swarm };
|