agent-swarm-kit 1.1.19 → 1.1.21
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 +7 -5
- package/build/index.mjs +7 -5
- package/package.json +1 -1
- package/types.d.ts +2 -1
package/build/index.cjs
CHANGED
|
@@ -14817,7 +14817,7 @@ class NavigationValidationService {
|
|
|
14817
14817
|
swarmName,
|
|
14818
14818
|
agentName,
|
|
14819
14819
|
});
|
|
14820
|
-
const routeStr = Array.from(navigationRoute).join("->");
|
|
14820
|
+
const routeStr = Array.from(navigationRoute).concat(agentName).join("->");
|
|
14821
14821
|
console.warn(`agent-swarm navigation skipped due to recursion`, {
|
|
14822
14822
|
clientId,
|
|
14823
14823
|
agentName,
|
|
@@ -16065,8 +16065,9 @@ const METHOD_NAME$Y = "function.template.navigateToTriageAgent";
|
|
|
16065
16065
|
* Will send tool output directly to the model without any additions
|
|
16066
16066
|
*/
|
|
16067
16067
|
const DEFAULT_EXECUTE_MESSAGE$1 = "";
|
|
16068
|
-
const DEFAULT_ACCEPT_FN = (_, defaultAgent) => `Successfully navigated to ${defaultAgent}
|
|
16069
|
-
const DEFAULT_REJECT_FN = (_, defaultAgent) => `Already on ${defaultAgent}
|
|
16068
|
+
const DEFAULT_ACCEPT_FN = (_, defaultAgent) => `Successfully navigated to ${defaultAgent}. Continue conversation based on the last message.`;
|
|
16069
|
+
const DEFAULT_REJECT_FN = (_, defaultAgent) => `Already on ${defaultAgent}. No navigation needed. Continue conversation.`;
|
|
16070
|
+
const DEFAULT_LAST_MESSAGE_FN = (_, lastMessage, lastAgent) => `I have been talking with ${lastAgent}. The last message was: ${lastMessage}`;
|
|
16070
16071
|
/**
|
|
16071
16072
|
* Creates a function to navigate to a triage agent for a specific client, handling navigation, message execution, and tool output.
|
|
16072
16073
|
* The factory generates a handler that checks navigation state, commits tool outputs with accept/reject messages, and triggers execution or emission based on provided parameters.
|
|
@@ -16099,7 +16100,7 @@ const DEFAULT_REJECT_FN = (_, defaultAgent) => `Already on ${defaultAgent}`;
|
|
|
16099
16100
|
* await navigate("tool-789", "client-012");
|
|
16100
16101
|
* // Commits dynamic reject message and executes the message if already on the default agent.
|
|
16101
16102
|
*/
|
|
16102
|
-
const createNavigateToTriageAgent = ({ flushMessage, executeMessage = DEFAULT_EXECUTE_MESSAGE$1, toolOutputAccept = DEFAULT_ACCEPT_FN, toolOutputReject = DEFAULT_REJECT_FN, }) => {
|
|
16103
|
+
const createNavigateToTriageAgent = ({ flushMessage, lastMessage: lastMessageFn = DEFAULT_LAST_MESSAGE_FN, executeMessage = DEFAULT_EXECUTE_MESSAGE$1, toolOutputAccept = DEFAULT_ACCEPT_FN, toolOutputReject = DEFAULT_REJECT_FN, }) => {
|
|
16103
16104
|
/**
|
|
16104
16105
|
* Navigates to the default triage agent for a given client and tool, handling message commits and execution.
|
|
16105
16106
|
*
|
|
@@ -16116,13 +16117,14 @@ const createNavigateToTriageAgent = ({ flushMessage, executeMessage = DEFAULT_EX
|
|
|
16116
16117
|
});
|
|
16117
16118
|
const swarmName = swarm$1.sessionValidationService.getSwarm(clientId);
|
|
16118
16119
|
const { defaultAgent } = swarm$1.swarmSchemaService.get(swarmName);
|
|
16120
|
+
const lastAgent = await getAgentName(clientId);
|
|
16119
16121
|
if (await functoolsKit.not(hasNavigation(clientId, defaultAgent))) {
|
|
16120
16122
|
const lastMessage = await getLastUserMessage(clientId);
|
|
16121
16123
|
await changeToDefaultAgent(clientId);
|
|
16122
16124
|
await commitToolOutputForce(toolId, typeof toolOutputAccept === "string"
|
|
16123
16125
|
? toolOutputAccept
|
|
16124
16126
|
: await toolOutputAccept(clientId, defaultAgent), clientId);
|
|
16125
|
-
await executeForce(lastMessage, clientId);
|
|
16127
|
+
await executeForce(await lastMessageFn(clientId, lastMessage, lastAgent, defaultAgent), clientId);
|
|
16126
16128
|
return;
|
|
16127
16129
|
}
|
|
16128
16130
|
if (flushMessage) {
|
package/build/index.mjs
CHANGED
|
@@ -14815,7 +14815,7 @@ class NavigationValidationService {
|
|
|
14815
14815
|
swarmName,
|
|
14816
14816
|
agentName,
|
|
14817
14817
|
});
|
|
14818
|
-
const routeStr = Array.from(navigationRoute).join("->");
|
|
14818
|
+
const routeStr = Array.from(navigationRoute).concat(agentName).join("->");
|
|
14819
14819
|
console.warn(`agent-swarm navigation skipped due to recursion`, {
|
|
14820
14820
|
clientId,
|
|
14821
14821
|
agentName,
|
|
@@ -16063,8 +16063,9 @@ const METHOD_NAME$Y = "function.template.navigateToTriageAgent";
|
|
|
16063
16063
|
* Will send tool output directly to the model without any additions
|
|
16064
16064
|
*/
|
|
16065
16065
|
const DEFAULT_EXECUTE_MESSAGE$1 = "";
|
|
16066
|
-
const DEFAULT_ACCEPT_FN = (_, defaultAgent) => `Successfully navigated to ${defaultAgent}
|
|
16067
|
-
const DEFAULT_REJECT_FN = (_, defaultAgent) => `Already on ${defaultAgent}
|
|
16066
|
+
const DEFAULT_ACCEPT_FN = (_, defaultAgent) => `Successfully navigated to ${defaultAgent}. Continue conversation based on the last message.`;
|
|
16067
|
+
const DEFAULT_REJECT_FN = (_, defaultAgent) => `Already on ${defaultAgent}. No navigation needed. Continue conversation.`;
|
|
16068
|
+
const DEFAULT_LAST_MESSAGE_FN = (_, lastMessage, lastAgent) => `I have been talking with ${lastAgent}. The last message was: ${lastMessage}`;
|
|
16068
16069
|
/**
|
|
16069
16070
|
* Creates a function to navigate to a triage agent for a specific client, handling navigation, message execution, and tool output.
|
|
16070
16071
|
* The factory generates a handler that checks navigation state, commits tool outputs with accept/reject messages, and triggers execution or emission based on provided parameters.
|
|
@@ -16097,7 +16098,7 @@ const DEFAULT_REJECT_FN = (_, defaultAgent) => `Already on ${defaultAgent}`;
|
|
|
16097
16098
|
* await navigate("tool-789", "client-012");
|
|
16098
16099
|
* // Commits dynamic reject message and executes the message if already on the default agent.
|
|
16099
16100
|
*/
|
|
16100
|
-
const createNavigateToTriageAgent = ({ flushMessage, executeMessage = DEFAULT_EXECUTE_MESSAGE$1, toolOutputAccept = DEFAULT_ACCEPT_FN, toolOutputReject = DEFAULT_REJECT_FN, }) => {
|
|
16101
|
+
const createNavigateToTriageAgent = ({ flushMessage, lastMessage: lastMessageFn = DEFAULT_LAST_MESSAGE_FN, executeMessage = DEFAULT_EXECUTE_MESSAGE$1, toolOutputAccept = DEFAULT_ACCEPT_FN, toolOutputReject = DEFAULT_REJECT_FN, }) => {
|
|
16101
16102
|
/**
|
|
16102
16103
|
* Navigates to the default triage agent for a given client and tool, handling message commits and execution.
|
|
16103
16104
|
*
|
|
@@ -16114,13 +16115,14 @@ const createNavigateToTriageAgent = ({ flushMessage, executeMessage = DEFAULT_EX
|
|
|
16114
16115
|
});
|
|
16115
16116
|
const swarmName = swarm$1.sessionValidationService.getSwarm(clientId);
|
|
16116
16117
|
const { defaultAgent } = swarm$1.swarmSchemaService.get(swarmName);
|
|
16118
|
+
const lastAgent = await getAgentName(clientId);
|
|
16117
16119
|
if (await not(hasNavigation(clientId, defaultAgent))) {
|
|
16118
16120
|
const lastMessage = await getLastUserMessage(clientId);
|
|
16119
16121
|
await changeToDefaultAgent(clientId);
|
|
16120
16122
|
await commitToolOutputForce(toolId, typeof toolOutputAccept === "string"
|
|
16121
16123
|
? toolOutputAccept
|
|
16122
16124
|
: await toolOutputAccept(clientId, defaultAgent), clientId);
|
|
16123
|
-
await executeForce(lastMessage, clientId);
|
|
16125
|
+
await executeForce(await lastMessageFn(clientId, lastMessage, lastAgent, defaultAgent), clientId);
|
|
16124
16126
|
return;
|
|
16125
16127
|
}
|
|
16126
16128
|
if (flushMessage) {
|
package/package.json
CHANGED
package/types.d.ts
CHANGED
|
@@ -9428,6 +9428,7 @@ declare const dumpClientPerformance: {
|
|
|
9428
9428
|
* };
|
|
9429
9429
|
*/
|
|
9430
9430
|
interface INavigateToTriageParams {
|
|
9431
|
+
lastMessage?: (clientId: string, lastMessage: string, lastAgent: AgentName, defaultAgent: AgentName) => string | Promise<string>;
|
|
9431
9432
|
flushMessage?: string | ((clientId: string, defaultAgent: AgentName) => string | Promise<string>);
|
|
9432
9433
|
executeMessage?: string | ((clientId: string, defaultAgent: AgentName) => string | Promise<string>);
|
|
9433
9434
|
toolOutputAccept?: string | ((clientId: string, defaultAgent: AgentName) => string | Promise<string>);
|
|
@@ -9465,7 +9466,7 @@ interface INavigateToTriageParams {
|
|
|
9465
9466
|
* await navigate("tool-789", "client-012");
|
|
9466
9467
|
* // Commits dynamic reject message and executes the message if already on the default agent.
|
|
9467
9468
|
*/
|
|
9468
|
-
declare const createNavigateToTriageAgent: ({ flushMessage, executeMessage, toolOutputAccept, toolOutputReject, }: INavigateToTriageParams) => (toolId: string, clientId: string) => Promise<void>;
|
|
9469
|
+
declare const createNavigateToTriageAgent: ({ flushMessage, lastMessage: lastMessageFn, executeMessage, toolOutputAccept, toolOutputReject, }: INavigateToTriageParams) => (toolId: string, clientId: string) => Promise<void>;
|
|
9469
9470
|
|
|
9470
9471
|
/**
|
|
9471
9472
|
* Configuration parameters for creating a navigation handler to a specific agent.
|