agent-swarm-kit 1.0.18 → 1.0.20
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 +15 -3
- package/build/index.mjs +15 -3
- package/package.json +1 -1
- package/types.d.ts +24 -3
package/build/index.cjs
CHANGED
|
@@ -3376,6 +3376,7 @@ var getAgentName = function (clientId) { return __awaiter(void 0, void 0, void 0
|
|
|
3376
3376
|
});
|
|
3377
3377
|
}); };
|
|
3378
3378
|
|
|
3379
|
+
var SCHEDULED_DELAY$1 = 1000;
|
|
3379
3380
|
/**
|
|
3380
3381
|
* A connection factory for a client to a swarm and returns a function to send messages.
|
|
3381
3382
|
*
|
|
@@ -3418,9 +3419,11 @@ var makeConnection = function (connector, clientId, swarmName) {
|
|
|
3418
3419
|
* @param {ReceiveMessageFn} connector - The function to receive messages.
|
|
3419
3420
|
* @param {string} clientId - The unique identifier of the client.
|
|
3420
3421
|
* @param {SwarmName} swarmName - The name of the swarm.
|
|
3422
|
+
* @param {Partial<IMakeConnectionConfig>} [config] - The configuration for scheduling.
|
|
3421
3423
|
* @returns {SendMessageFn} - A function to send scheduled messages to the swarm.
|
|
3422
3424
|
*/
|
|
3423
|
-
makeConnection.scheduled = function (connector, clientId, swarmName) {
|
|
3425
|
+
makeConnection.scheduled = function (connector, clientId, swarmName, _a) {
|
|
3426
|
+
var _b = _a === void 0 ? {} : _a, _c = _b.delay, delay = _c === void 0 ? SCHEDULED_DELAY$1 : _c;
|
|
3424
3427
|
var send = makeConnection(connector, clientId, swarmName);
|
|
3425
3428
|
/**
|
|
3426
3429
|
* A wrapped send function that schedules the message sending.
|
|
@@ -3466,6 +3469,10 @@ makeConnection.scheduled = function (connector, clientId, swarmName) {
|
|
|
3466
3469
|
}
|
|
3467
3470
|
});
|
|
3468
3471
|
}); },
|
|
3472
|
+
/**
|
|
3473
|
+
* The delay for message scheduler
|
|
3474
|
+
*/
|
|
3475
|
+
delay: delay,
|
|
3469
3476
|
});
|
|
3470
3477
|
/**
|
|
3471
3478
|
* A function to send scheduled messages.
|
|
@@ -3693,6 +3700,7 @@ var complete = function (content, clientId, swarmName) { return __awaiter(void 0
|
|
|
3693
3700
|
});
|
|
3694
3701
|
}); };
|
|
3695
3702
|
|
|
3703
|
+
var SCHEDULED_DELAY = 1000;
|
|
3696
3704
|
/**
|
|
3697
3705
|
* Creates a session for the given client and swarm.
|
|
3698
3706
|
*
|
|
@@ -3746,12 +3754,15 @@ var session = function (clientId, swarmName) {
|
|
|
3746
3754
|
*
|
|
3747
3755
|
* @param {string} clientId - The ID of the client.
|
|
3748
3756
|
* @param {SwarmName} swarmName - The name of the swarm.
|
|
3757
|
+
* @param {Partial<ISessionConfig>} [config] - The configuration for the scheduled session.
|
|
3758
|
+
* @param {number} [config.delay] - The delay for the scheduled session.
|
|
3749
3759
|
* @returns {Object} An object containing the scheduled session methods.
|
|
3750
3760
|
* @returns {TComplete} complete - A function to complete the session with content.
|
|
3751
3761
|
* @returns {Function} dispose - A function to dispose of the session.
|
|
3752
3762
|
*/
|
|
3753
|
-
session.scheduled = function (clientId, swarmName) {
|
|
3754
|
-
var
|
|
3763
|
+
session.scheduled = function (clientId, swarmName, _a) {
|
|
3764
|
+
var _b = _a === void 0 ? {} : _a, _c = _b.delay, delay = _c === void 0 ? SCHEDULED_DELAY : _c;
|
|
3765
|
+
var _d = session(clientId, swarmName), complete = _d.complete, dispose = _d.dispose;
|
|
3755
3766
|
var isMounted = true;
|
|
3756
3767
|
/**
|
|
3757
3768
|
* Completes the scheduled session with the given content.
|
|
@@ -3791,6 +3802,7 @@ session.scheduled = function (clientId, swarmName) {
|
|
|
3791
3802
|
}
|
|
3792
3803
|
});
|
|
3793
3804
|
}); },
|
|
3805
|
+
delay: delay,
|
|
3794
3806
|
});
|
|
3795
3807
|
return {
|
|
3796
3808
|
/**
|
package/build/index.mjs
CHANGED
|
@@ -3374,6 +3374,7 @@ var getAgentName = function (clientId) { return __awaiter(void 0, void 0, void 0
|
|
|
3374
3374
|
});
|
|
3375
3375
|
}); };
|
|
3376
3376
|
|
|
3377
|
+
var SCHEDULED_DELAY$1 = 1000;
|
|
3377
3378
|
/**
|
|
3378
3379
|
* A connection factory for a client to a swarm and returns a function to send messages.
|
|
3379
3380
|
*
|
|
@@ -3416,9 +3417,11 @@ var makeConnection = function (connector, clientId, swarmName) {
|
|
|
3416
3417
|
* @param {ReceiveMessageFn} connector - The function to receive messages.
|
|
3417
3418
|
* @param {string} clientId - The unique identifier of the client.
|
|
3418
3419
|
* @param {SwarmName} swarmName - The name of the swarm.
|
|
3420
|
+
* @param {Partial<IMakeConnectionConfig>} [config] - The configuration for scheduling.
|
|
3419
3421
|
* @returns {SendMessageFn} - A function to send scheduled messages to the swarm.
|
|
3420
3422
|
*/
|
|
3421
|
-
makeConnection.scheduled = function (connector, clientId, swarmName) {
|
|
3423
|
+
makeConnection.scheduled = function (connector, clientId, swarmName, _a) {
|
|
3424
|
+
var _b = _a === void 0 ? {} : _a, _c = _b.delay, delay = _c === void 0 ? SCHEDULED_DELAY$1 : _c;
|
|
3422
3425
|
var send = makeConnection(connector, clientId, swarmName);
|
|
3423
3426
|
/**
|
|
3424
3427
|
* A wrapped send function that schedules the message sending.
|
|
@@ -3464,6 +3467,10 @@ makeConnection.scheduled = function (connector, clientId, swarmName) {
|
|
|
3464
3467
|
}
|
|
3465
3468
|
});
|
|
3466
3469
|
}); },
|
|
3470
|
+
/**
|
|
3471
|
+
* The delay for message scheduler
|
|
3472
|
+
*/
|
|
3473
|
+
delay: delay,
|
|
3467
3474
|
});
|
|
3468
3475
|
/**
|
|
3469
3476
|
* A function to send scheduled messages.
|
|
@@ -3691,6 +3698,7 @@ var complete = function (content, clientId, swarmName) { return __awaiter(void 0
|
|
|
3691
3698
|
});
|
|
3692
3699
|
}); };
|
|
3693
3700
|
|
|
3701
|
+
var SCHEDULED_DELAY = 1000;
|
|
3694
3702
|
/**
|
|
3695
3703
|
* Creates a session for the given client and swarm.
|
|
3696
3704
|
*
|
|
@@ -3744,12 +3752,15 @@ var session = function (clientId, swarmName) {
|
|
|
3744
3752
|
*
|
|
3745
3753
|
* @param {string} clientId - The ID of the client.
|
|
3746
3754
|
* @param {SwarmName} swarmName - The name of the swarm.
|
|
3755
|
+
* @param {Partial<ISessionConfig>} [config] - The configuration for the scheduled session.
|
|
3756
|
+
* @param {number} [config.delay] - The delay for the scheduled session.
|
|
3747
3757
|
* @returns {Object} An object containing the scheduled session methods.
|
|
3748
3758
|
* @returns {TComplete} complete - A function to complete the session with content.
|
|
3749
3759
|
* @returns {Function} dispose - A function to dispose of the session.
|
|
3750
3760
|
*/
|
|
3751
|
-
session.scheduled = function (clientId, swarmName) {
|
|
3752
|
-
var
|
|
3761
|
+
session.scheduled = function (clientId, swarmName, _a) {
|
|
3762
|
+
var _b = _a === void 0 ? {} : _a, _c = _b.delay, delay = _c === void 0 ? SCHEDULED_DELAY : _c;
|
|
3763
|
+
var _d = session(clientId, swarmName), complete = _d.complete, dispose = _d.dispose;
|
|
3753
3764
|
var isMounted = true;
|
|
3754
3765
|
/**
|
|
3755
3766
|
* Completes the scheduled session with the given content.
|
|
@@ -3789,6 +3800,7 @@ session.scheduled = function (clientId, swarmName) {
|
|
|
3789
3800
|
}
|
|
3790
3801
|
});
|
|
3791
3802
|
}); },
|
|
3803
|
+
delay: delay,
|
|
3792
3804
|
});
|
|
3793
3805
|
return {
|
|
3794
3806
|
/**
|
package/package.json
CHANGED
package/types.d.ts
CHANGED
|
@@ -1539,10 +1539,20 @@ declare const makeConnection: {
|
|
|
1539
1539
|
* @param {ReceiveMessageFn} connector - The function to receive messages.
|
|
1540
1540
|
* @param {string} clientId - The unique identifier of the client.
|
|
1541
1541
|
* @param {SwarmName} swarmName - The name of the swarm.
|
|
1542
|
+
* @param {Partial<IMakeConnectionConfig>} [config] - The configuration for scheduling.
|
|
1542
1543
|
* @returns {SendMessageFn} - A function to send scheduled messages to the swarm.
|
|
1543
1544
|
*/
|
|
1544
|
-
scheduled(connector: ReceiveMessageFn, clientId: string, swarmName: SwarmName): (content: string) => Promise<void>;
|
|
1545
|
+
scheduled(connector: ReceiveMessageFn, clientId: string, swarmName: SwarmName, { delay, }?: Partial<IMakeConnectionConfig>): (content: string) => Promise<void>;
|
|
1545
1546
|
};
|
|
1547
|
+
/**
|
|
1548
|
+
* Configuration for scheduling messages.
|
|
1549
|
+
*
|
|
1550
|
+
* @interface IMakeConnectionConfig
|
|
1551
|
+
* @property {number} [delay] - The delay in milliseconds for scheduling messages.
|
|
1552
|
+
*/
|
|
1553
|
+
interface IMakeConnectionConfig {
|
|
1554
|
+
delay?: number;
|
|
1555
|
+
}
|
|
1546
1556
|
|
|
1547
1557
|
/**
|
|
1548
1558
|
* Changes the agent for a given client session in swarm.
|
|
@@ -1596,11 +1606,13 @@ declare const session: {
|
|
|
1596
1606
|
*
|
|
1597
1607
|
* @param {string} clientId - The ID of the client.
|
|
1598
1608
|
* @param {SwarmName} swarmName - The name of the swarm.
|
|
1609
|
+
* @param {Partial<ISessionConfig>} [config] - The configuration for the scheduled session.
|
|
1610
|
+
* @param {number} [config.delay] - The delay for the scheduled session.
|
|
1599
1611
|
* @returns {Object} An object containing the scheduled session methods.
|
|
1600
1612
|
* @returns {TComplete} complete - A function to complete the session with content.
|
|
1601
1613
|
* @returns {Function} dispose - A function to dispose of the session.
|
|
1602
1614
|
*/
|
|
1603
|
-
scheduled(clientId: string, swarmName: SwarmName): {
|
|
1615
|
+
scheduled(clientId: string, swarmName: SwarmName, { delay, }?: Partial<ISessionConfig>): {
|
|
1604
1616
|
/**
|
|
1605
1617
|
* Completes the scheduled session with the given content.
|
|
1606
1618
|
*
|
|
@@ -1616,6 +1628,15 @@ declare const session: {
|
|
|
1616
1628
|
dispose(): Promise<void>;
|
|
1617
1629
|
};
|
|
1618
1630
|
};
|
|
1631
|
+
/**
|
|
1632
|
+
* Configuration options for a scheduled session.
|
|
1633
|
+
*
|
|
1634
|
+
* @interface ISessionConfig
|
|
1635
|
+
* @property {number} [delay] - The delay for the scheduled session in milliseconds.
|
|
1636
|
+
*/
|
|
1637
|
+
interface ISessionConfig {
|
|
1638
|
+
delay?: number;
|
|
1639
|
+
}
|
|
1619
1640
|
|
|
1620
1641
|
/**
|
|
1621
1642
|
* Disposes the session for a given client with all related swarms and agents.
|
|
@@ -1756,4 +1777,4 @@ declare const GLOBAL_CONFIG: {
|
|
|
1756
1777
|
};
|
|
1757
1778
|
declare const setConfig: (config: typeof GLOBAL_CONFIG) => void;
|
|
1758
1779
|
|
|
1759
|
-
export { ContextService, type IAgentSchema, type IAgentTool, type ICompletionSchema, type IIncomingMessage, type IModelMessage, type IOutgoingMessage, type ISwarmSchema, type ITool, type IToolCall, type ReceiveMessageFn, type SendMessageFn$1 as SendMessageFn, addAgent, addCompletion, addSwarm, addTool, changeAgent, commitSystemMessage, commitToolOutput, commitUserMessage, complete, disposeConnection, emit, execute, getAgentHistory, getAgentName, getAssistantHistory, getLastAssistantMessage, getLastSystemMessage, getLastUserMessage, getRawHistory, getUserHistory, makeConnection, session, setConfig, swarm };
|
|
1780
|
+
export { ContextService, type IAgentSchema, type IAgentTool, type ICompletionSchema, type IIncomingMessage, type IMakeConnectionConfig, type IModelMessage, type IOutgoingMessage, type ISessionConfig, type ISwarmSchema, type ITool, type IToolCall, type ReceiveMessageFn, type SendMessageFn$1 as SendMessageFn, addAgent, addCompletion, addSwarm, addTool, changeAgent, commitSystemMessage, commitToolOutput, commitUserMessage, complete, disposeConnection, emit, execute, getAgentHistory, getAgentName, getAssistantHistory, getLastAssistantMessage, getLastSystemMessage, getLastUserMessage, getRawHistory, getUserHistory, makeConnection, session, setConfig, swarm };
|