agent-swarm-kit 3.1.0 → 4.0.0
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/LICENSE +21 -21
- package/README.md +639 -639
- package/build/index.cjs +1382 -613
- package/build/index.mjs +1379 -612
- package/package.json +89 -89
- package/types.d.ts +125 -18
- package/build/index.cjs.map +0 -1
- package/build/index.mjs.map +0 -1
package/package.json
CHANGED
|
@@ -1,89 +1,89 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "agent-swarm-kit",
|
|
3
|
-
"version": "
|
|
4
|
-
"description": "A TypeScript library for building orchestrated framework-agnostic multi-agent AI systems",
|
|
5
|
-
"author": {
|
|
6
|
-
"name": "Petr Tripolsky",
|
|
7
|
-
"email": "tripolskypetr@gmail.com",
|
|
8
|
-
"url": "https://github.com/tripolskypetr"
|
|
9
|
-
},
|
|
10
|
-
"funding": {
|
|
11
|
-
"type": "individual",
|
|
12
|
-
"url": "http://paypal.me/tripolskypetr"
|
|
13
|
-
},
|
|
14
|
-
"license": "MIT",
|
|
15
|
-
"homepage": "https://agent-swarm.github.io/modules.html",
|
|
16
|
-
"keywords": [
|
|
17
|
-
"NVIDIA NIM",
|
|
18
|
-
"OpenAI",
|
|
19
|
-
"GPT4All",
|
|
20
|
-
"Ollama",
|
|
21
|
-
"LM Studio",
|
|
22
|
-
"llama",
|
|
23
|
-
"gpt",
|
|
24
|
-
"mistral"
|
|
25
|
-
],
|
|
26
|
-
"files": [
|
|
27
|
-
"build",
|
|
28
|
-
"types.d.ts",
|
|
29
|
-
"README.md"
|
|
30
|
-
],
|
|
31
|
-
"repository": {
|
|
32
|
-
"type": "git",
|
|
33
|
-
"url": "https://github.com/tripolskypetr/agent-swarm-kit",
|
|
34
|
-
"documentation": "https://github.com/tripolskypetr/agent-swarm-kit/tree/master/docs"
|
|
35
|
-
},
|
|
36
|
-
"bugs": {
|
|
37
|
-
"url": "https://github.com/tripolskypetr/agent-swarm-kit/issues"
|
|
38
|
-
},
|
|
39
|
-
"scripts": {
|
|
40
|
-
"build": "rollup -c",
|
|
41
|
-
"test": "npm run build && node ./test/index.mjs",
|
|
42
|
-
"benchmark": "npm run build && node ./benchmark/index.mjs",
|
|
43
|
-
"build:docs": "rimraf docs && mkdir docs && node ./scripts/dts-docs.cjs ./types.d.ts ./docs",
|
|
44
|
-
"docs:gpt": "npm run build && node ./scripts/gpt-docs.mjs",
|
|
45
|
-
"docs:uml": "npm run build && node ./scripts/uml.mjs",
|
|
46
|
-
"docs:www": "rimraf docs/wwwroot && typedoc && node ./packages/typedoc-yandex-metrica/index.mjs",
|
|
47
|
-
"docs:demo:win": ".\\scripts\\win\\build_demo_docs.bat",
|
|
48
|
-
"docs:demo": "sh ./scripts/linux/build_demo_docs.sh",
|
|
49
|
-
"docs:demo:concat": "node ./packages/concat-demo-docs/index.mjs",
|
|
50
|
-
"repl": "dotenv -e .env -- npm run build && node -e \"import('./scripts/repl.mjs')\" --interactive"
|
|
51
|
-
},
|
|
52
|
-
"main": "build/index.cjs",
|
|
53
|
-
"module": "build/index.mjs",
|
|
54
|
-
"source": "src/index.ts",
|
|
55
|
-
"types": "./types.d.ts",
|
|
56
|
-
"exports": {
|
|
57
|
-
"require": "./build/index.cjs",
|
|
58
|
-
"types": "./types.d.ts",
|
|
59
|
-
"import": "./build/index.mjs",
|
|
60
|
-
"default": "./build/index.cjs"
|
|
61
|
-
},
|
|
62
|
-
"devDependencies": {
|
|
63
|
-
"@rollup/plugin-typescript": "11.1.6",
|
|
64
|
-
"@types/lodash-es": "4.17.12",
|
|
65
|
-
"@types/node": "22.9.0",
|
|
66
|
-
"@types/xml2js": "0.4.14",
|
|
67
|
-
"glob": "11.0.1",
|
|
68
|
-
"ollama": "0.5.14",
|
|
69
|
-
"rimraf": "6.0.1",
|
|
70
|
-
"rollup": "3.29.5",
|
|
71
|
-
"rollup-plugin-dts": "6.1.1",
|
|
72
|
-
"rollup-plugin-peer-deps-external": "2.2.4",
|
|
73
|
-
"tslib": "2.7.0",
|
|
74
|
-
"typedoc": "0.27.9",
|
|
75
|
-
"undici": "6.21.2",
|
|
76
|
-
"worker-testbed": "
|
|
77
|
-
},
|
|
78
|
-
"peerDependencies": {
|
|
79
|
-
"typescript": "^5.0.0"
|
|
80
|
-
},
|
|
81
|
-
"dependencies": {
|
|
82
|
-
"di-kit": "^1.1.1",
|
|
83
|
-
"di-scoped": "^1.0.21",
|
|
84
|
-
"functools-kit": "^
|
|
85
|
-
"get-moment-stamp": "^2.0.0",
|
|
86
|
-
"lodash-es": "4.17.21",
|
|
87
|
-
"xml2js": "0.6.2"
|
|
88
|
-
}
|
|
89
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "agent-swarm-kit",
|
|
3
|
+
"version": "4.0.0",
|
|
4
|
+
"description": "A TypeScript library for building orchestrated framework-agnostic multi-agent AI systems",
|
|
5
|
+
"author": {
|
|
6
|
+
"name": "Petr Tripolsky",
|
|
7
|
+
"email": "tripolskypetr@gmail.com",
|
|
8
|
+
"url": "https://github.com/tripolskypetr"
|
|
9
|
+
},
|
|
10
|
+
"funding": {
|
|
11
|
+
"type": "individual",
|
|
12
|
+
"url": "http://paypal.me/tripolskypetr"
|
|
13
|
+
},
|
|
14
|
+
"license": "MIT",
|
|
15
|
+
"homepage": "https://agent-swarm.github.io/modules.html",
|
|
16
|
+
"keywords": [
|
|
17
|
+
"NVIDIA NIM",
|
|
18
|
+
"OpenAI",
|
|
19
|
+
"GPT4All",
|
|
20
|
+
"Ollama",
|
|
21
|
+
"LM Studio",
|
|
22
|
+
"llama",
|
|
23
|
+
"gpt",
|
|
24
|
+
"mistral"
|
|
25
|
+
],
|
|
26
|
+
"files": [
|
|
27
|
+
"build",
|
|
28
|
+
"types.d.ts",
|
|
29
|
+
"README.md"
|
|
30
|
+
],
|
|
31
|
+
"repository": {
|
|
32
|
+
"type": "git",
|
|
33
|
+
"url": "https://github.com/tripolskypetr/agent-swarm-kit",
|
|
34
|
+
"documentation": "https://github.com/tripolskypetr/agent-swarm-kit/tree/master/docs"
|
|
35
|
+
},
|
|
36
|
+
"bugs": {
|
|
37
|
+
"url": "https://github.com/tripolskypetr/agent-swarm-kit/issues"
|
|
38
|
+
},
|
|
39
|
+
"scripts": {
|
|
40
|
+
"build": "rollup -c",
|
|
41
|
+
"test": "npm run build && node ./test/index.mjs",
|
|
42
|
+
"benchmark": "npm run build && node ./benchmark/index.mjs",
|
|
43
|
+
"build:docs": "rimraf docs && mkdir docs && node ./scripts/dts-docs.cjs ./types.d.ts ./docs",
|
|
44
|
+
"docs:gpt": "npm run build && node ./scripts/gpt-docs.mjs",
|
|
45
|
+
"docs:uml": "npm run build && node ./scripts/uml.mjs",
|
|
46
|
+
"docs:www": "rimraf docs/wwwroot && typedoc && node ./packages/typedoc-yandex-metrica/index.mjs",
|
|
47
|
+
"docs:demo:win": ".\\scripts\\win\\build_demo_docs.bat",
|
|
48
|
+
"docs:demo": "sh ./scripts/linux/build_demo_docs.sh",
|
|
49
|
+
"docs:demo:concat": "node ./packages/concat-demo-docs/index.mjs",
|
|
50
|
+
"repl": "dotenv -e .env -- npm run build && node -e \"import('./scripts/repl.mjs')\" --interactive"
|
|
51
|
+
},
|
|
52
|
+
"main": "build/index.cjs",
|
|
53
|
+
"module": "build/index.mjs",
|
|
54
|
+
"source": "src/index.ts",
|
|
55
|
+
"types": "./types.d.ts",
|
|
56
|
+
"exports": {
|
|
57
|
+
"require": "./build/index.cjs",
|
|
58
|
+
"types": "./types.d.ts",
|
|
59
|
+
"import": "./build/index.mjs",
|
|
60
|
+
"default": "./build/index.cjs"
|
|
61
|
+
},
|
|
62
|
+
"devDependencies": {
|
|
63
|
+
"@rollup/plugin-typescript": "11.1.6",
|
|
64
|
+
"@types/lodash-es": "4.17.12",
|
|
65
|
+
"@types/node": "22.9.0",
|
|
66
|
+
"@types/xml2js": "0.4.14",
|
|
67
|
+
"glob": "11.0.1",
|
|
68
|
+
"ollama": "0.5.14",
|
|
69
|
+
"rimraf": "6.0.1",
|
|
70
|
+
"rollup": "3.29.5",
|
|
71
|
+
"rollup-plugin-dts": "6.1.1",
|
|
72
|
+
"rollup-plugin-peer-deps-external": "2.2.4",
|
|
73
|
+
"tslib": "2.7.0",
|
|
74
|
+
"typedoc": "0.27.9",
|
|
75
|
+
"undici": "6.21.2",
|
|
76
|
+
"worker-testbed": "3.0.0"
|
|
77
|
+
},
|
|
78
|
+
"peerDependencies": {
|
|
79
|
+
"typescript": "^5.0.0"
|
|
80
|
+
},
|
|
81
|
+
"dependencies": {
|
|
82
|
+
"di-kit": "^1.1.1",
|
|
83
|
+
"di-scoped": "^1.0.21",
|
|
84
|
+
"functools-kit": "^4.0.0",
|
|
85
|
+
"get-moment-stamp": "^2.0.0",
|
|
86
|
+
"lodash-es": "4.17.21",
|
|
87
|
+
"xml2js": "0.6.2"
|
|
88
|
+
}
|
|
89
|
+
}
|
package/types.d.ts
CHANGED
|
@@ -3197,6 +3197,35 @@ declare class ClientAgent implements IAgent {
|
|
|
3197
3197
|
* @readonly
|
|
3198
3198
|
*/
|
|
3199
3199
|
readonly _toolAbortController: ToolAbortController;
|
|
3200
|
+
/**
|
|
3201
|
+
* Count of tool calls currently executing for this agent.
|
|
3202
|
+
* Non-zero while any targetFn.call promise is pending; ClientSession uses it to
|
|
3203
|
+
* detect nested tool-mode executions that must join the parent output waiter.
|
|
3204
|
+
*/
|
|
3205
|
+
_runningToolCalls: number;
|
|
3206
|
+
/**
|
|
3207
|
+
* Count of EXECUTE_FN tool status chains still consuming tool events.
|
|
3208
|
+
* While non-zero, tool errors are handled by the chain (stop + resurrect);
|
|
3209
|
+
* once it drops to zero a late tool error must recover on its own in
|
|
3210
|
+
* createToolCall, or the pending execution output would never be emitted.
|
|
3211
|
+
*/
|
|
3212
|
+
_activeToolChains: number;
|
|
3213
|
+
/**
|
|
3214
|
+
* Count of EXECUTE_FN executions currently in flight for this agent instance.
|
|
3215
|
+
* dispose() checks it: tearing the instance down mid-execution (e.g. a
|
|
3216
|
+
* server-side changeToAgent while the completion is still running) must
|
|
3217
|
+
* resolve the pending output waiter with an empty result — otherwise the
|
|
3218
|
+
* waiter and the session busy lock would hang forever.
|
|
3219
|
+
*/
|
|
3220
|
+
_activeExecutions: number;
|
|
3221
|
+
/**
|
|
3222
|
+
* Generation counter for output emissions. Bumped by commitCancelOutput and by
|
|
3223
|
+
* swarm-level output substitution (emit). Executions capture the epoch at start
|
|
3224
|
+
* and _emitOutput drops their result when the epoch moved on — otherwise the
|
|
3225
|
+
* stale output of a cancelled/substituted execution would resolve the waiter
|
|
3226
|
+
* of the NEXT message, poisoning that exchange.
|
|
3227
|
+
*/
|
|
3228
|
+
_outputEpoch: number;
|
|
3200
3229
|
/**
|
|
3201
3230
|
* Subject for signaling agent changes, halting subsequent tool executions via commitAgentChange.
|
|
3202
3231
|
* @readonly
|
|
@@ -3259,13 +3288,19 @@ declare class ClientAgent implements IAgent {
|
|
|
3259
3288
|
* Supports SwarmConnectionService by broadcasting agent outputs within the swarm.
|
|
3260
3289
|
* @throws {Error} If validation fails after model resurrection, indicating an unrecoverable state.
|
|
3261
3290
|
**/
|
|
3262
|
-
_emitOutput(mode: ExecutionMode, rawResult: string): Promise<void>;
|
|
3291
|
+
_emitOutput(mode: ExecutionMode, rawResult: string, outputEpoch?: number): Promise<void>;
|
|
3263
3292
|
/**
|
|
3264
3293
|
* Resurrects the model in case of failures using configured strategies (flush, recomplete, custom).
|
|
3265
3294
|
* Updates history with failure details and returns a placeholder or transformed result, signaling via _resqueSubject.
|
|
3266
3295
|
* Supports error recovery for CompletionSchemaService’s getCompletion calls.
|
|
3267
3296
|
*/
|
|
3268
3297
|
_resurrectModel(mode: ExecutionMode, reason?: string): Promise<string>;
|
|
3298
|
+
/**
|
|
3299
|
+
* Marks in-flight executions as substituted: the swarm emitted a replacement
|
|
3300
|
+
* output (ClientSwarm.emit), so results of executions started earlier must not
|
|
3301
|
+
* reach _outputSubject — they would pair with the next waiter otherwise.
|
|
3302
|
+
*/
|
|
3303
|
+
commitOutputSubstituted(): void;
|
|
3269
3304
|
/**
|
|
3270
3305
|
* Waits for the next output to be emitted via _outputSubject, typically after execute or run.
|
|
3271
3306
|
* Useful for external consumers (e.g., SwarmConnectionService) awaiting agent responses.
|
|
@@ -4483,10 +4518,32 @@ declare class ClientSwarm implements ISwarm {
|
|
|
4483
4518
|
*/
|
|
4484
4519
|
cancelOutput(): Promise<void>;
|
|
4485
4520
|
/**
|
|
4486
|
-
*
|
|
4487
|
-
*
|
|
4521
|
+
* Chain of pending waitForOutput calls, reset to a resolved promise whenever
|
|
4522
|
+
* the most recently started waiter settles. See waitForOutput for the rationale.
|
|
4523
|
+
*/
|
|
4524
|
+
private _lastOutputAwaiter;
|
|
4525
|
+
/**
|
|
4526
|
+
* Waiters created by waitForOutput that have not settled yet, in creation order.
|
|
4527
|
+
* joinOutput attaches nested tool executions to the head of this list.
|
|
4528
|
+
*/
|
|
4529
|
+
private _pendingOutputAwaiters;
|
|
4530
|
+
/**
|
|
4531
|
+
* Waits for output from the active agent, delegating to WAIT_FOR_OUTPUT_FN.
|
|
4532
|
+
* Pending waiters run in FIFO order so each one consumes the next emitted output,
|
|
4533
|
+
* but once a started waiter settles the chain is reset: a waiter that subscribed
|
|
4534
|
+
* too late to observe its output stays pending without blocking waiters created
|
|
4535
|
+
* afterwards. Strict sequential queueing must be avoided here — a nested tool
|
|
4536
|
+
* execute whose output was already consumed would deadlock every later completion.
|
|
4488
4537
|
*/
|
|
4489
4538
|
waitForOutput: () => Promise<string>;
|
|
4539
|
+
/**
|
|
4540
|
+
* Awaits the same output as the oldest pending waitForOutput call, or starts a
|
|
4541
|
+
* fresh wait when none is pending. Nested executions triggered from inside a tool
|
|
4542
|
+
* (execute/executeForce with "tool" mode) must use this instead of waitForOutput:
|
|
4543
|
+
* their emitted output resolves the parent waiter, so queueing behind it would
|
|
4544
|
+
* leave the nested caller pending forever and skip the tool's onAfterCall.
|
|
4545
|
+
*/
|
|
4546
|
+
joinOutput: () => Promise<string>;
|
|
4490
4547
|
/**
|
|
4491
4548
|
* Retrieves the name of the active agent, lazily fetching it via params.getActiveAgent if not loaded.
|
|
4492
4549
|
* Emits an event via BusService with the result, supporting ClientSession's agent identification.
|
|
@@ -6425,6 +6482,12 @@ type Action = "read" | "write";
|
|
|
6425
6482
|
declare class ClientState<State extends IStateData = IStateData> implements IState<State>, IStateChangeEvent {
|
|
6426
6483
|
readonly params: IStateParams<State>;
|
|
6427
6484
|
readonly stateChanged: Subject<string>;
|
|
6485
|
+
/**
|
|
6486
|
+
* True while a queued dispatch (read/write) is executing for this instance.
|
|
6487
|
+
* getState checks it to serve reentrant reads (getState inside a setState
|
|
6488
|
+
* dispatchFn) without re-entering the queue, which would deadlock.
|
|
6489
|
+
*/
|
|
6490
|
+
_inDispatch: boolean;
|
|
6428
6491
|
/**
|
|
6429
6492
|
* The current state data, initialized as null and set during waitForInit.
|
|
6430
6493
|
* Updated by setState and clearState, persisted via params.setState if provided.
|
|
@@ -7820,6 +7883,15 @@ declare class ClientPolicy implements IPolicy {
|
|
|
7820
7883
|
* Updated by banClient and unbanClient, persisted if params.setBannedClients is provided.
|
|
7821
7884
|
*/
|
|
7822
7885
|
_banSet: Set<SessionId> | typeof BAN_NEED_FETCH;
|
|
7886
|
+
/**
|
|
7887
|
+
* Serializes the read-modify-write of _banSet shared by banClient/unbanClient.
|
|
7888
|
+
* Without it two concurrent bans of different clients both read the same ban
|
|
7889
|
+
* set, each adds only its own client, and the later setBannedClients overwrites
|
|
7890
|
+
* the earlier one — one ban is silently lost in memory and in the persisted
|
|
7891
|
+
* store. queued() runs the mutations one at a time so each observes the result
|
|
7892
|
+
* of the previous one.
|
|
7893
|
+
*/
|
|
7894
|
+
private _banQueue;
|
|
7823
7895
|
/**
|
|
7824
7896
|
* Constructs a ClientPolicy instance with the provided parameters.
|
|
7825
7897
|
* Invokes the onInit callback if defined and logs construction if debugging is enabled.
|
|
@@ -10521,7 +10593,7 @@ type TEmbeddingSchema = {
|
|
|
10521
10593
|
*
|
|
10522
10594
|
* @example
|
|
10523
10595
|
* // Override an embedding’s schema with new properties
|
|
10524
|
-
*
|
|
10596
|
+
* overrideEmbedding({
|
|
10525
10597
|
* embeddingName: "TextEmbedding",
|
|
10526
10598
|
* persist: true,
|
|
10527
10599
|
* callbacks: {
|
|
@@ -10530,7 +10602,7 @@ type TEmbeddingSchema = {
|
|
|
10530
10602
|
* });
|
|
10531
10603
|
* // Logs the operation (if enabled) and updates the embedding schema in the swarm.
|
|
10532
10604
|
*/
|
|
10533
|
-
declare function
|
|
10605
|
+
declare function overrideEmbedding(embeddingSchema: TEmbeddingSchema): Promise<IEmbeddingSchema>;
|
|
10534
10606
|
|
|
10535
10607
|
/**
|
|
10536
10608
|
* Type representing a partial policy schema with required policyName.
|
|
@@ -11113,16 +11185,16 @@ declare function commitToolRequestForce(request: IToolRequest[], clientId: strin
|
|
|
11113
11185
|
* Emits a string as model output without executing an incoming message or checking the active agent.
|
|
11114
11186
|
*
|
|
11115
11187
|
* This function directly emits a provided string as output from the swarm session, bypassing message execution and agent activity checks.
|
|
11116
|
-
*
|
|
11117
|
-
* The execution is wrapped in `beginContext` for a clean environment, validates the session and swarm,
|
|
11118
|
-
*
|
|
11188
|
+
* Unlike `emit`, it does not verify that a specific agent is still active, ensuring emission even after navigation.
|
|
11189
|
+
* The execution is wrapped in `beginContext` for a clean environment, validates the session and swarm,
|
|
11190
|
+
* logs the operation if enabled, and resolves when the content is successfully emitted. Works for any session mode.
|
|
11119
11191
|
*
|
|
11120
11192
|
*
|
|
11121
11193
|
* @param {string} content - The content to be processed or stored.
|
|
11122
11194
|
* @param {string} clientId - The unique identifier of the client session.
|
|
11123
|
-
* @throws {Error} If
|
|
11195
|
+
* @throws {Error} If session or swarm validation fails.
|
|
11124
11196
|
* @example
|
|
11125
|
-
* await emitForce("Direct output", "client-123"); // Emits "Direct output"
|
|
11197
|
+
* await emitForce("Direct output", "client-123"); // Emits "Direct output" regardless of the active agent
|
|
11126
11198
|
*/
|
|
11127
11199
|
declare function emitForce(content: string, clientId: string): Promise<void>;
|
|
11128
11200
|
|
|
@@ -11263,16 +11335,16 @@ declare function execute(content: string, clientId: string, agentName: AgentName
|
|
|
11263
11335
|
/**
|
|
11264
11336
|
* Emits a string as model output without executing an incoming message, with agent activity validation.
|
|
11265
11337
|
*
|
|
11266
|
-
* This function directly emits a provided string as output from the swarm session, bypassing message execution
|
|
11267
|
-
*
|
|
11268
|
-
*
|
|
11269
|
-
* logs the operation if enabled
|
|
11338
|
+
* This function directly emits a provided string as output from the swarm session, bypassing message execution.
|
|
11339
|
+
* It validates the session, swarm, and specified agent, ensuring the agent is still active before emitting.
|
|
11340
|
+
* If the active agent has changed, the operation is skipped. The execution is wrapped in `beginContext` for a
|
|
11341
|
+
* clean environment and logs the operation if enabled. Works for any session mode.
|
|
11270
11342
|
*
|
|
11271
11343
|
*
|
|
11272
11344
|
* @param {string} content - The content to be processed or stored.
|
|
11273
11345
|
* @param {string} clientId - The unique identifier of the client session.
|
|
11274
11346
|
* @param {AgentName} agentName - The name of the agent to use or reference.
|
|
11275
|
-
* @throws {Error} If
|
|
11347
|
+
* @throws {Error} If agent, session, or swarm validation fails.
|
|
11276
11348
|
* @example
|
|
11277
11349
|
* await emit("Direct output", "client-123", "AgentX"); // Emits "Direct output" if AgentX is active
|
|
11278
11350
|
*/
|
|
@@ -11796,6 +11868,22 @@ declare function getLastAssistantMessage(clientId: string): Promise<string>;
|
|
|
11796
11868
|
*/
|
|
11797
11869
|
declare function getLastSystemMessage(clientId: string): Promise<string>;
|
|
11798
11870
|
|
|
11871
|
+
/**
|
|
11872
|
+
* Retrieves the content of the most recent tool message from a client's session history.
|
|
11873
|
+
*
|
|
11874
|
+
* This function fetches the raw history for a specified client using `getRawHistory` and finds the last entry where the role is "tool".
|
|
11875
|
+
* It is wrapped in `beginContext` for a clean execution environment and logs the operation if enabled via `GLOBAL_CONFIG`. The result is the content
|
|
11876
|
+
* of the last tool message as a string, or `null` if no tool message exists in the history.
|
|
11877
|
+
*
|
|
11878
|
+
*
|
|
11879
|
+
* @param {string} clientId - The unique identifier of the client session.
|
|
11880
|
+
* @throws {Error} If `getRawHistory` fails due to session validation or history retrieval issues.
|
|
11881
|
+
* @example
|
|
11882
|
+
* const lastMessage = await getLastToolMessage("client-123");
|
|
11883
|
+
* console.log(lastMessage); // Outputs the last tool message or null
|
|
11884
|
+
*/
|
|
11885
|
+
declare function getLastToolMessage(clientId: string): Promise<string>;
|
|
11886
|
+
|
|
11799
11887
|
/**
|
|
11800
11888
|
* Retrieves an agent schema by its name from the swarm's agent schema service.
|
|
11801
11889
|
* Logs the operation if logging is enabled in the global configuration.
|
|
@@ -11830,7 +11918,7 @@ declare function getCompute(computeName: ComputeName): IComputeSchema<any>;
|
|
|
11830
11918
|
* @function getEmbedding
|
|
11831
11919
|
* @param {EmbeddingName} embeddingName - The name of the embedding.
|
|
11832
11920
|
*/
|
|
11833
|
-
declare function
|
|
11921
|
+
declare function getEmbedding(embeddingName: EmbeddingName): IEmbeddingSchema;
|
|
11834
11922
|
|
|
11835
11923
|
/**
|
|
11836
11924
|
* Retrieves an MCP (Model Context Protocol) schema by its name from the swarm's MCP schema service.
|
|
@@ -12874,6 +12962,19 @@ interface IGlobalConfig {
|
|
|
12874
12962
|
* Flag to enable operator timeout, used in `ClientOperator` for message processing.
|
|
12875
12963
|
*/
|
|
12876
12964
|
CC_ENABLE_OPERATOR_TIMEOUT: boolean;
|
|
12965
|
+
/**
|
|
12966
|
+
* Timeout in milliseconds for operator signal waiting in `ClientOperator.waitForOutput`.
|
|
12967
|
+
* Applied only when CC_ENABLE_OPERATOR_TIMEOUT is true; expired wait resolves with an empty output.
|
|
12968
|
+
*/
|
|
12969
|
+
CC_OPERATOR_SIGNAL_TIMEOUT: number;
|
|
12970
|
+
/**
|
|
12971
|
+
* Interval in milliseconds between chat inactivity sweeps in `ChatUtils`.
|
|
12972
|
+
*/
|
|
12973
|
+
CC_CHAT_INACTIVITY_CHECK: number;
|
|
12974
|
+
/**
|
|
12975
|
+
* Inactivity duration in milliseconds after which an idle chat instance is disposed by `ChatUtils`.
|
|
12976
|
+
*/
|
|
12977
|
+
CC_CHAT_INACTIVITY_TIMEOUT: number;
|
|
12877
12978
|
/**
|
|
12878
12979
|
* Disable fetch of data from all storages. Quite usefull for unit tests
|
|
12879
12980
|
*/
|
|
@@ -13189,7 +13290,7 @@ declare class SharedComputeUtils {
|
|
|
13189
13290
|
* Retrieves shared compute data with validation and context management.
|
|
13190
13291
|
* @async
|
|
13191
13292
|
*/
|
|
13192
|
-
getComputeData: <T extends IComputeData = any>(
|
|
13293
|
+
getComputeData: <T extends IComputeData = any>(computeName: ComputeName) => Promise<T>;
|
|
13193
13294
|
}
|
|
13194
13295
|
/**
|
|
13195
13296
|
* @constant {SharedComputeUtils} SharedCompute
|
|
@@ -13627,6 +13728,12 @@ declare class SchemaUtils {
|
|
|
13627
13728
|
*/
|
|
13628
13729
|
declare const Schema: SchemaUtils;
|
|
13629
13730
|
|
|
13731
|
+
/**
|
|
13732
|
+
* Prompt template for instructing models on how to format tool calls in responses.
|
|
13733
|
+
* Uses XML-like `<tool_call>` tags containing JSON objects with function name and arguments.
|
|
13734
|
+
* @see https://github.com/ollama/ollama/blob/86a622cbdc69e9fd501764ff7565e977fc98f00a/server/model.go#L158
|
|
13735
|
+
*/
|
|
13736
|
+
declare const TOOL_PROTOCOL_PROMPT: string;
|
|
13630
13737
|
/**
|
|
13631
13738
|
* Function type for completing AI model requests.
|
|
13632
13739
|
* Takes completion arguments and returns a promise resolving to a model message response.
|
|
@@ -13912,4 +14019,4 @@ declare const Utils: {
|
|
|
13912
14019
|
PersistEmbeddingUtils: typeof PersistEmbeddingUtils;
|
|
13913
14020
|
};
|
|
13914
14021
|
|
|
13915
|
-
export { Adapter, type BaseMessageRole, Chat, ChatInstance, Compute, type EventSource, ExecutionContextService, History, HistoryMemoryInstance, HistoryPersistInstance, type IAdvisorSchema, type IAgentSchemaInternal, type IAgentTool, type IBaseCompletionArgs, type IBaseEvent, type IBaseMessage, type IBusEvent, type IBusEventContext, type IChatInstance, type IChatInstanceCallbacks, type ICommitActionParams, type ICompletionSchema, type IComputeSchema, type ICustomEvent, type IEmbeddingSchema, type IFetchInfoParams, type IGlobalConfig, type IHistoryAdapter, type IHistoryControl, type IHistoryInstance, type IHistoryInstanceCallbacks, type IIncomingMessage, type ILoggerAdapter, type ILoggerInstance, type ILoggerInstanceCallbacks, type IMCPSchema, type IMCPTool, type IMCPToolCallDto, type IMakeConnectionConfig, type IMakeDisposeParams, type INavigateToAgentParams, type INavigateToTriageParams, type IOutgoingMessage, type IOutlineCompletionArgs, type IOutlineFormat, type IOutlineHistory, type IOutlineMessage, type IOutlineObjectFormat, type IOutlineResult, type IOutlineSchema, type IOutlineSchemaFormat, type IOutlineValidationFn, type IPersistActiveAgentData, type IPersistAliveData, type IPersistBase, type IPersistEmbeddingData, type IPersistMemoryData, type IPersistNavigationStackData, type IPersistPolicyData, type IPersistStateData, type IPersistStorageData, type IPipelineSchema, type IPolicySchema, type IScopeOptions, type ISessionConfig, type ISessionContext, type IStateSchema, type IStorageData, type IStorageSchema, type ISwarmCompletionArgs, type ISwarmMessage, type ISwarmSchema, type ITool, type IToolCall, Logger, LoggerInstance, MCP, type MCPToolProperties, MethodContextService, Operator, OperatorInstance, type OutlineMessageRole, PayloadContextService, PersistAlive, PersistBase, PersistEmbedding, PersistList, PersistMemory, PersistPolicy, PersistState, PersistStorage, PersistSwarm, Policy, type ReceiveMessageFn, RoundRobin, Schema, SchemaContextService, type SendMessageFn, SharedCompute, SharedState, SharedStorage, State, Storage, type SwarmMessageRole, type THistoryInstanceCtor, type THistoryMemoryInstance, type THistoryPersistInstance, type TLoggerInstance, type TOperatorInstance, type TPersistBase, type TPersistBaseCtor, type TPersistList, type ToolValue, Utils, addAdvisor, addAgent, addAgentNavigation, addCommitAction, addCompletion, addCompute, addEmbedding, addFetchInfo, addMCP, addOutline, addPipeline, addPolicy, addState, addStorage, addSwarm, addTool, addTriageNavigation, ask, beginContext, cancelOutput, cancelOutputForce, changeToAgent, changeToDefaultAgent, changeToPrevAgent, chat, commitAssistantMessage, commitAssistantMessageForce, commitDeveloperMessage, commitDeveloperMessageForce, commitFlush, commitFlushForce, commitStopTools, commitStopToolsForce, commitSystemMessage, commitSystemMessageForce, commitToolOutput, commitToolOutputForce, commitToolRequest, commitToolRequestForce, commitUserMessage, commitUserMessageForce, complete, createCommitAction, createFetchInfo, createNavigateToAgent, createNavigateToTriageAgent, disposeConnection, dumpAdvisorResult, dumpAgent, dumpClientPerformance, dumpDocs, dumpOutlineResult, dumpPerfomance, dumpSwarm, emit, emitForce, event, execute, executeForce, fork, getAdvisor, getAgent, getAgentHistory, getAgentName, getAssistantHistory, getCheckBusy, getCompletion, getCompute,
|
|
14022
|
+
export { Adapter, type BaseMessageRole, Chat, ChatInstance, Compute, type EventSource, ExecutionContextService, History, HistoryMemoryInstance, HistoryPersistInstance, type IAdvisorSchema, type IAgentSchemaInternal, type IAgentTool, type IBaseCompletionArgs, type IBaseEvent, type IBaseMessage, type IBusEvent, type IBusEventContext, type IChatInstance, type IChatInstanceCallbacks, type ICommitActionParams, type ICompletionSchema, type IComputeSchema, type ICustomEvent, type IEmbeddingSchema, type IFetchInfoParams, type IGlobalConfig, type IHistoryAdapter, type IHistoryControl, type IHistoryInstance, type IHistoryInstanceCallbacks, type IIncomingMessage, type ILoggerAdapter, type ILoggerInstance, type ILoggerInstanceCallbacks, type IMCPSchema, type IMCPTool, type IMCPToolCallDto, type IMakeConnectionConfig, type IMakeDisposeParams, type INavigateToAgentParams, type INavigateToTriageParams, type IOutgoingMessage, type IOutlineCompletionArgs, type IOutlineFormat, type IOutlineHistory, type IOutlineMessage, type IOutlineObjectFormat, type IOutlineResult, type IOutlineSchema, type IOutlineSchemaFormat, type IOutlineValidationFn, type IPersistActiveAgentData, type IPersistAliveData, type IPersistBase, type IPersistEmbeddingData, type IPersistMemoryData, type IPersistNavigationStackData, type IPersistPolicyData, type IPersistStateData, type IPersistStorageData, type IPipelineSchema, type IPolicySchema, type IScopeOptions, type ISessionConfig, type ISessionContext, type IStateSchema, type IStorageData, type IStorageSchema, type ISwarmCompletionArgs, type ISwarmMessage, type ISwarmSchema, type ITool, type IToolCall, Logger, LoggerInstance, MCP, type MCPToolProperties, MethodContextService, Operator, OperatorInstance, type OutlineMessageRole, PayloadContextService, PersistAlive, PersistBase, PersistEmbedding, PersistList, PersistMemory, PersistPolicy, PersistState, PersistStorage, PersistSwarm, Policy, type ReceiveMessageFn, RoundRobin, Schema, SchemaContextService, type SendMessageFn, SharedCompute, SharedState, SharedStorage, State, Storage, type SwarmMessageRole, type THistoryInstanceCtor, type THistoryMemoryInstance, type THistoryPersistInstance, type TLoggerInstance, TOOL_PROTOCOL_PROMPT, type TOperatorInstance, type TPersistBase, type TPersistBaseCtor, type TPersistList, type ToolValue, Utils, addAdvisor, addAgent, addAgentNavigation, addCommitAction, addCompletion, addCompute, addEmbedding, addFetchInfo, addMCP, addOutline, addPipeline, addPolicy, addState, addStorage, addSwarm, addTool, addTriageNavigation, ask, beginContext, cancelOutput, cancelOutputForce, changeToAgent, changeToDefaultAgent, changeToPrevAgent, chat, commitAssistantMessage, commitAssistantMessageForce, commitDeveloperMessage, commitDeveloperMessageForce, commitFlush, commitFlushForce, commitStopTools, commitStopToolsForce, commitSystemMessage, commitSystemMessageForce, commitToolOutput, commitToolOutputForce, commitToolRequest, commitToolRequestForce, commitUserMessage, commitUserMessageForce, complete, createCommitAction, createFetchInfo, createNavigateToAgent, createNavigateToTriageAgent, disposeConnection, dumpAdvisorResult, dumpAgent, dumpClientPerformance, dumpDocs, dumpOutlineResult, dumpPerfomance, dumpSwarm, emit, emitForce, event, execute, executeForce, fork, getAdvisor, getAgent, getAgentHistory, getAgentName, getAssistantHistory, getCheckBusy, getCompletion, getCompute, getEmbedding, getLastAssistantMessage, getLastSystemMessage, getLastToolMessage, getLastUserMessage, getMCP, getNavigationRoute, getPayload, getPipeline, getPolicy, getRawHistory, getSessionContext, getSessionMode, getState, getStorage, getSwarm, getTool, getToolNameForModel, getUserHistory, hasNavigation, hasSession, json, listenAgentEvent, listenAgentEventOnce, listenEvent, listenEventOnce, listenExecutionEvent, listenExecutionEventOnce, listenHistoryEvent, listenHistoryEventOnce, listenPolicyEvent, listenPolicyEventOnce, listenSessionEvent, listenSessionEventOnce, listenStateEvent, listenStateEventOnce, listenStorageEvent, listenStorageEventOnce, listenSwarmEvent, listenSwarmEventOnce, makeAutoDispose, makeConnection, markOffline, markOnline, notify, notifyForce, overrideAdvisor, overrideAgent, overrideCompletion, overrideCompute, overrideEmbedding, overrideMCP, overrideOutline, overridePipeline, overridePolicy, overrideState, overrideStorage, overrideSwarm, overrideTool, runStateless, runStatelessForce, scope, session, setConfig, startPipeline, swarm, toJsonSchema, validate, validateToolArguments };
|