agent-swarm-kit 1.0.7 → 1.0.9

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agent-swarm-kit",
3
- "version": "1.0.7",
3
+ "version": "1.0.9",
4
4
  "description": "A TypeScript library for building orchestrated framework-agnostic multi-agent AI systems",
5
5
  "author": {
6
6
  "name": "Petr Tripolsky",
@@ -40,7 +40,7 @@
40
40
  "build": "rollup -c",
41
41
  "test": "npm run build && node ./test/index.mjs",
42
42
  "build:docs": "rimraf docs && mkdir docs && node ./scripts/dts-docs.cjs ./types.d.ts ./docs",
43
- "docs:gpt": "node ./scripts/gpt-docs.mjs",
43
+ "docs:gpt": "npm run build && node ./scripts/gpt-docs.mjs",
44
44
  "repl": "dotenv -e .env -- npm run build && node -e \"import('./scripts/repl.mjs')\" --interactive"
45
45
  },
46
46
  "main": "build/index.cjs",
package/types.d.ts CHANGED
@@ -158,6 +158,7 @@ declare class ClientAgent implements IAgent {
158
158
  declare class AgentConnectionService implements IAgent {
159
159
  private readonly loggerService;
160
160
  private readonly contextService;
161
+ private readonly sessionValidationService;
161
162
  private readonly historyConnectionService;
162
163
  private readonly agentSchemaService;
163
164
  private readonly toolSchemaService;
@@ -181,7 +182,8 @@ declare class ClientHistory implements IHistory {
181
182
  declare class HistoryConnectionService implements IHistory {
182
183
  private readonly loggerService;
183
184
  private readonly contextService;
184
- getItems: ((clientId: string) => IPubsubArray<IModelMessage>) & functools_kit.IClearableMemoize<string> & functools_kit.IControlMemoize<string, IPubsubArray<IModelMessage>>;
185
+ private readonly sessionValidationService;
186
+ getItems: ((clientId: string, agentName: AgentName) => IPubsubArray<IModelMessage>) & functools_kit.IClearableMemoize<string> & functools_kit.IControlMemoize<string, IPubsubArray<IModelMessage>>;
185
187
  getHistory: ((clientId: string, agentName: string) => ClientHistory) & functools_kit.IClearableMemoize<string> & functools_kit.IControlMemoize<string, ClientHistory>;
186
188
  push: (message: IModelMessage) => Promise<void>;
187
189
  toArrayForAgent: (prompt: string) => Promise<IModelMessage[]>;
@@ -258,11 +260,11 @@ interface ISessionParams extends ISessionSchema {
258
260
  }
259
261
  interface ISessionSchema {
260
262
  }
261
- type SendMessageFn = (outgoing: IOutgoingMessage) => Promise<void> | void;
263
+ type SendMessageFn$1 = (outgoing: IOutgoingMessage) => Promise<void> | void;
262
264
  type ReceiveMessageFn = (incoming: IIncomingMessage) => Promise<void> | void;
263
265
  interface ISession {
264
266
  execute(content: string): Promise<string>;
265
- connect(connector: SendMessageFn): ReceiveMessageFn;
267
+ connect(connector: SendMessageFn$1): ReceiveMessageFn;
266
268
  commitToolOutput(content: string): Promise<void>;
267
269
  commitSystemMessage(message: string): Promise<void>;
268
270
  }
@@ -270,11 +272,12 @@ type SessionId = string;
270
272
 
271
273
  declare class ClientSession implements ISession {
272
274
  readonly params: ISessionParams;
275
+ readonly _emitSubject: Subject<string>;
273
276
  constructor(params: ISessionParams);
274
- execute: (message: string) => Promise<string>;
277
+ execute: (message: string, noEmit?: boolean) => Promise<string>;
275
278
  commitToolOutput: (content: string) => Promise<void>;
276
279
  commitSystemMessage: (message: string) => Promise<void>;
277
- connect: (connector: SendMessageFn) => ReceiveMessageFn;
280
+ connect: (connector: SendMessageFn$1) => ReceiveMessageFn;
278
281
  }
279
282
 
280
283
  declare class SessionConnectionService implements ISession {
@@ -283,7 +286,7 @@ declare class SessionConnectionService implements ISession {
283
286
  private readonly swarmConnectionService;
284
287
  getSession: ((clientId: string, swarmName: string) => ClientSession) & functools_kit.IClearableMemoize<string> & functools_kit.IControlMemoize<string, ClientSession>;
285
288
  execute: (content: string) => Promise<string>;
286
- connect: (connector: SendMessageFn) => ReceiveMessageFn;
289
+ connect: (connector: SendMessageFn$1) => ReceiveMessageFn;
287
290
  commitToolOutput: (content: string) => Promise<void>;
288
291
  commitSystemMessage: (message: string) => Promise<void>;
289
292
  dispose: () => Promise<void>;
@@ -337,7 +340,7 @@ declare class SessionPublicService implements TSessionConnectionService {
337
340
  private readonly loggerService;
338
341
  private readonly sessionConnectionService;
339
342
  execute: (content: string, clientId: string, swarmName: SwarmName) => Promise<string>;
340
- connect: (connector: SendMessageFn, clientId: string, swarmName: SwarmName) => ReceiveMessageFn;
343
+ connect: (connector: SendMessageFn$1, clientId: string, swarmName: SwarmName) => ReceiveMessageFn;
341
344
  commitToolOutput: (content: string, clientId: string, swarmName: SwarmName) => Promise<void>;
342
345
  commitSystemMessage: (message: string, clientId: string, swarmName: SwarmName) => Promise<void>;
343
346
  dispose: (clientId: string, swarmName: SwarmName) => Promise<void>;
@@ -379,9 +382,17 @@ declare class ToolValidationService {
379
382
 
380
383
  declare class SessionValidationService {
381
384
  private readonly loggerService;
382
- private _sessionMap;
385
+ private _historySwarmMap;
386
+ private _sessionSwarmMap;
387
+ private _agentSwarmMap;
383
388
  addSession: (clientId: SessionId, swarmName: SwarmName) => void;
389
+ addAgentUsage: (sessionId: SessionId, agentName: AgentName) => void;
390
+ addHistoryUsage: (sessionId: SessionId, agentName: AgentName) => void;
391
+ removeAgentUsage: (sessionId: SessionId, agentName: AgentName) => void;
392
+ removeHistoryUsage: (sessionId: SessionId, agentName: AgentName) => void;
384
393
  getSessionList: () => string[];
394
+ getSessionAgentList: (clientId: string) => string[];
395
+ getSessionHistoryList: (clientId: string) => string[];
385
396
  getSwarm: (clientId: SessionId) => string;
386
397
  validate: (clientId: SessionId, source: string) => void;
387
398
  removeSession: (clientId: SessionId) => void;
@@ -435,6 +446,7 @@ declare const addSwarm: (swarmSchema: ISwarmSchema) => string;
435
446
 
436
447
  declare const addTool: (toolSchema: IAgentTool) => string;
437
448
 
449
+ type SendMessageFn = (outgoing: string) => Promise<void>;
438
450
  declare const makeConnection: (connector: ReceiveMessageFn, clientId: string, swarmName: SwarmName) => SendMessageFn;
439
451
 
440
452
  declare const changeAgent: (agentName: AgentName, clientId: string) => Promise<void>;
@@ -453,18 +465,19 @@ declare const getRawHistory: (clientId: string) => Promise<IModelMessage[]>;
453
465
 
454
466
  declare const getAgentHistory: (clientId: string, agentName: AgentName) => Promise<IModelMessage[]>;
455
467
 
456
- declare const commitToolOutput: (content: string, clientId: string) => void;
468
+ declare const commitToolOutput: (content: string, clientId: string, agentName: AgentName) => Promise<void>;
457
469
 
458
- declare const commitSystemMessage: (content: string, clientId: string) => void;
470
+ declare const commitSystemMessage: (content: string, clientId: string, agentName: string) => Promise<void>;
459
471
 
460
- declare const execute: (content: string, clientId: string) => Promise<string>;
472
+ declare const execute: (content: string, clientId: string, agentName: AgentName) => Promise<string>;
461
473
 
462
474
  declare const GLOBAL_CONFIG: {
463
475
  CC_TOOL_CALL_EXCEPTION_PROMPT: string;
464
476
  CC_EMPTY_OUTPUT_PLACEHOLDERS: string[];
465
477
  CC_KEEP_MESSAGES: number;
466
478
  CC_ANSWER_TIMEOUT_SECONDS: number;
479
+ CC_GET_AGENT_HISTORY: (clientId: string, agentName: AgentName) => IPubsubArray<IModelMessage>;
467
480
  };
468
481
  declare const setConfig: (config: typeof GLOBAL_CONFIG) => void;
469
482
 
470
- export { ContextService, type IAgentSchema, type IAgentTool, type ICompletionSchema, type ISwarmSchema, type ReceiveMessageFn, type SendMessageFn, addAgent, addCompletion, addSwarm, addTool, changeAgent, commitSystemMessage, commitToolOutput, complete, disposeConnection, execute, getAgentHistory, getRawHistory, makeConnection, session, setConfig, swarm };
483
+ export { ContextService, type IAgentSchema, type IAgentTool, type ICompletionSchema, type ISwarmSchema, type ReceiveMessageFn, type SendMessageFn$1 as SendMessageFn, addAgent, addCompletion, addSwarm, addTool, changeAgent, commitSystemMessage, commitToolOutput, complete, disposeConnection, execute, getAgentHistory, getRawHistory, makeConnection, session, setConfig, swarm };