@iqai/adk 0.0.4 → 0.0.5
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/CHANGELOG.md +2 -14
- package/LICENSE.md +9 -0
- package/dist/index.d.mts +19 -31
- package/dist/index.d.ts +19 -31
- package/dist/index.js +608 -134
- package/dist/index.mjs +567 -93
- package/package.json +5 -31
- package/LICENSE +0 -21
- package/README.md +0 -260
package/dist/index.mjs
CHANGED
|
@@ -23,20 +23,39 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
23
23
|
var BaseTool;
|
|
24
24
|
var init_base_tool = __esm({
|
|
25
25
|
"src/tools/base/base-tool.ts"() {
|
|
26
|
-
"use strict";
|
|
27
26
|
BaseTool = class {
|
|
27
|
+
/**
|
|
28
|
+
* Name of the tool
|
|
29
|
+
*/
|
|
30
|
+
name;
|
|
31
|
+
/**
|
|
32
|
+
* Description of the tool
|
|
33
|
+
*/
|
|
34
|
+
description;
|
|
35
|
+
/**
|
|
36
|
+
* Whether the tool is a long running operation
|
|
37
|
+
*/
|
|
38
|
+
isLongRunning;
|
|
39
|
+
/**
|
|
40
|
+
* Whether the tool execution should be retried on failure
|
|
41
|
+
*/
|
|
42
|
+
shouldRetryOnFailure;
|
|
43
|
+
/**
|
|
44
|
+
* Maximum retry attempts
|
|
45
|
+
*/
|
|
46
|
+
maxRetryAttempts;
|
|
47
|
+
/**
|
|
48
|
+
* Base delay for retry in ms (will be used with exponential backoff)
|
|
49
|
+
*/
|
|
50
|
+
baseRetryDelay = 1e3;
|
|
51
|
+
/**
|
|
52
|
+
* Maximum delay for retry in ms
|
|
53
|
+
*/
|
|
54
|
+
maxRetryDelay = 1e4;
|
|
28
55
|
/**
|
|
29
56
|
* Constructor for BaseTool
|
|
30
57
|
*/
|
|
31
58
|
constructor(config) {
|
|
32
|
-
/**
|
|
33
|
-
* Base delay for retry in ms (will be used with exponential backoff)
|
|
34
|
-
*/
|
|
35
|
-
this.baseRetryDelay = 1e3;
|
|
36
|
-
/**
|
|
37
|
-
* Maximum delay for retry in ms
|
|
38
|
-
*/
|
|
39
|
-
this.maxRetryDelay = 1e4;
|
|
40
59
|
this.name = config.name;
|
|
41
60
|
this.description = config.description;
|
|
42
61
|
this.isLongRunning = config.isLongRunning || false;
|
|
@@ -231,7 +250,6 @@ function extractJSDocParams(funcStr) {
|
|
|
231
250
|
}
|
|
232
251
|
var init_function_utils = __esm({
|
|
233
252
|
"src/tools/function/function-utils.ts"() {
|
|
234
|
-
"use strict";
|
|
235
253
|
}
|
|
236
254
|
});
|
|
237
255
|
|
|
@@ -243,10 +261,11 @@ __export(function_tool_exports, {
|
|
|
243
261
|
var FunctionTool;
|
|
244
262
|
var init_function_tool = __esm({
|
|
245
263
|
"src/tools/function/function-tool.ts"() {
|
|
246
|
-
"use strict";
|
|
247
264
|
init_base_tool();
|
|
248
265
|
init_function_utils();
|
|
249
266
|
FunctionTool = class extends BaseTool {
|
|
267
|
+
func;
|
|
268
|
+
mandatoryArgs = [];
|
|
250
269
|
/**
|
|
251
270
|
* Creates a new FunctionTool wrapping the provided function.
|
|
252
271
|
*
|
|
@@ -263,7 +282,6 @@ var init_function_tool = __esm({
|
|
|
263
282
|
shouldRetryOnFailure: options?.shouldRetryOnFailure || false,
|
|
264
283
|
maxRetryAttempts: options?.maxRetryAttempts || 3
|
|
265
284
|
});
|
|
266
|
-
this.mandatoryArgs = [];
|
|
267
285
|
this.func = func;
|
|
268
286
|
this.mandatoryArgs = this.getMandatoryArgs(func);
|
|
269
287
|
}
|
|
@@ -359,6 +377,25 @@ __export(agents_exports, {
|
|
|
359
377
|
|
|
360
378
|
// src/agents/base-agent.ts
|
|
361
379
|
var BaseAgent = class {
|
|
380
|
+
/**
|
|
381
|
+
* The agent's name
|
|
382
|
+
* Agent name must be a unique identifier within the agent tree
|
|
383
|
+
*/
|
|
384
|
+
name;
|
|
385
|
+
/**
|
|
386
|
+
* Description about the agent's capability
|
|
387
|
+
* The LLM uses this to determine whether to delegate control to the agent
|
|
388
|
+
*/
|
|
389
|
+
description;
|
|
390
|
+
/**
|
|
391
|
+
* The parent agent of this agent
|
|
392
|
+
* Note that an agent can ONLY be added as sub-agent once
|
|
393
|
+
*/
|
|
394
|
+
parentAgent;
|
|
395
|
+
/**
|
|
396
|
+
* The sub-agents of this agent
|
|
397
|
+
*/
|
|
398
|
+
subAgents;
|
|
362
399
|
/**
|
|
363
400
|
* Constructs a new BaseAgent
|
|
364
401
|
*/
|
|
@@ -423,7 +460,11 @@ var BaseAgent = class {
|
|
|
423
460
|
};
|
|
424
461
|
|
|
425
462
|
// src/models/llm-registry.ts
|
|
426
|
-
var
|
|
463
|
+
var LLMRegistry = class _LLMRegistry {
|
|
464
|
+
/**
|
|
465
|
+
* Map of model name regex to LLM class
|
|
466
|
+
*/
|
|
467
|
+
static llmRegistry = /* @__PURE__ */ new Map();
|
|
427
468
|
/**
|
|
428
469
|
* Creates a new LLM instance
|
|
429
470
|
*
|
|
@@ -483,14 +524,17 @@ var _LLMRegistry = class _LLMRegistry {
|
|
|
483
524
|
}
|
|
484
525
|
}
|
|
485
526
|
};
|
|
486
|
-
/**
|
|
487
|
-
* Map of model name regex to LLM class
|
|
488
|
-
*/
|
|
489
|
-
_LLMRegistry.llmRegistry = /* @__PURE__ */ new Map();
|
|
490
|
-
var LLMRegistry = _LLMRegistry;
|
|
491
527
|
|
|
492
528
|
// src/models/llm-request.ts
|
|
493
529
|
var LLMRequest = class {
|
|
530
|
+
/**
|
|
531
|
+
* The conversation history
|
|
532
|
+
*/
|
|
533
|
+
messages;
|
|
534
|
+
/**
|
|
535
|
+
* LLM configuration parameters
|
|
536
|
+
*/
|
|
537
|
+
config;
|
|
494
538
|
constructor(data) {
|
|
495
539
|
this.messages = data.messages;
|
|
496
540
|
this.config = data.config || {};
|
|
@@ -499,18 +543,34 @@ var LLMRequest = class {
|
|
|
499
543
|
|
|
500
544
|
// src/tools/tool-context.ts
|
|
501
545
|
var ToolContext = class {
|
|
546
|
+
/**
|
|
547
|
+
* The parent invocation context
|
|
548
|
+
*/
|
|
549
|
+
invocationContext;
|
|
550
|
+
/**
|
|
551
|
+
* Authentication handler for the tool
|
|
552
|
+
*/
|
|
553
|
+
auth;
|
|
554
|
+
/**
|
|
555
|
+
* Additional parameters for the tool
|
|
556
|
+
*/
|
|
557
|
+
parameters;
|
|
558
|
+
/**
|
|
559
|
+
* Tool name
|
|
560
|
+
*/
|
|
561
|
+
toolName = "";
|
|
562
|
+
/**
|
|
563
|
+
* Tool ID
|
|
564
|
+
*/
|
|
565
|
+
toolId = "";
|
|
566
|
+
/**
|
|
567
|
+
* Variables stored in the context
|
|
568
|
+
*/
|
|
569
|
+
_variables;
|
|
502
570
|
/**
|
|
503
571
|
* Constructor for ToolContext
|
|
504
572
|
*/
|
|
505
573
|
constructor(options) {
|
|
506
|
-
/**
|
|
507
|
-
* Tool name
|
|
508
|
-
*/
|
|
509
|
-
this.toolName = "";
|
|
510
|
-
/**
|
|
511
|
-
* Tool ID
|
|
512
|
-
*/
|
|
513
|
-
this.toolId = "";
|
|
514
574
|
this.invocationContext = options.invocationContext;
|
|
515
575
|
this.auth = options.auth;
|
|
516
576
|
this.parameters = options.parameters || {};
|
|
@@ -586,6 +646,36 @@ var StreamingMode = /* @__PURE__ */ ((StreamingMode2) => {
|
|
|
586
646
|
return StreamingMode2;
|
|
587
647
|
})(StreamingMode || {});
|
|
588
648
|
var RunConfig = class {
|
|
649
|
+
/**
|
|
650
|
+
* Speech configuration for the live agent
|
|
651
|
+
*/
|
|
652
|
+
speechConfig;
|
|
653
|
+
/**
|
|
654
|
+
* The output modalities
|
|
655
|
+
*/
|
|
656
|
+
responseModalities;
|
|
657
|
+
/**
|
|
658
|
+
* Whether to save input blobs as artifacts
|
|
659
|
+
*/
|
|
660
|
+
saveInputBlobsAsArtifacts;
|
|
661
|
+
/**
|
|
662
|
+
* Whether to support Compositional Function Calling
|
|
663
|
+
* Only applicable for StreamingMode.SSE
|
|
664
|
+
*/
|
|
665
|
+
supportCFC;
|
|
666
|
+
/**
|
|
667
|
+
* Streaming mode
|
|
668
|
+
*/
|
|
669
|
+
streamingMode;
|
|
670
|
+
/**
|
|
671
|
+
* Whether to stream the response
|
|
672
|
+
* This is derived from streamingMode and used by LLM implementations
|
|
673
|
+
*/
|
|
674
|
+
stream;
|
|
675
|
+
/**
|
|
676
|
+
* Output audio transcription configuration
|
|
677
|
+
*/
|
|
678
|
+
outputAudioTranscription;
|
|
589
679
|
constructor(config) {
|
|
590
680
|
this.speechConfig = config?.speechConfig;
|
|
591
681
|
this.responseModalities = config?.responseModalities;
|
|
@@ -599,14 +689,50 @@ var RunConfig = class {
|
|
|
599
689
|
|
|
600
690
|
// src/agents/invocation-context.ts
|
|
601
691
|
var InvocationContext = class _InvocationContext {
|
|
692
|
+
/**
|
|
693
|
+
* Unique session ID for the current conversation
|
|
694
|
+
*/
|
|
695
|
+
sessionId;
|
|
696
|
+
/**
|
|
697
|
+
* Current conversation history
|
|
698
|
+
*/
|
|
699
|
+
messages;
|
|
700
|
+
/**
|
|
701
|
+
* Run configuration
|
|
702
|
+
*/
|
|
703
|
+
config;
|
|
704
|
+
/**
|
|
705
|
+
* User identifier associated with the session
|
|
706
|
+
*/
|
|
707
|
+
userId;
|
|
708
|
+
/**
|
|
709
|
+
* Application name (for multi-app environments)
|
|
710
|
+
*/
|
|
711
|
+
appName;
|
|
712
|
+
/**
|
|
713
|
+
* Memory service for long-term storage
|
|
714
|
+
*/
|
|
715
|
+
memoryService;
|
|
716
|
+
/**
|
|
717
|
+
* Session service for session management
|
|
718
|
+
*/
|
|
719
|
+
sessionService;
|
|
720
|
+
/**
|
|
721
|
+
* Additional context metadata
|
|
722
|
+
*/
|
|
723
|
+
metadata;
|
|
724
|
+
/**
|
|
725
|
+
* Variables stored in the context
|
|
726
|
+
*/
|
|
727
|
+
variables;
|
|
728
|
+
/**
|
|
729
|
+
* In-memory storage for node execution results
|
|
730
|
+
*/
|
|
731
|
+
memory = /* @__PURE__ */ new Map();
|
|
602
732
|
/**
|
|
603
733
|
* Constructor for InvocationContext
|
|
604
734
|
*/
|
|
605
735
|
constructor(options = {}) {
|
|
606
|
-
/**
|
|
607
|
-
* In-memory storage for node execution results
|
|
608
|
-
*/
|
|
609
|
-
this.memory = /* @__PURE__ */ new Map();
|
|
610
736
|
this.sessionId = options.sessionId || this.generateSessionId();
|
|
611
737
|
this.messages = options.messages || [];
|
|
612
738
|
this.config = options.config || new RunConfig();
|
|
@@ -713,6 +839,54 @@ var InvocationContext = class _InvocationContext {
|
|
|
713
839
|
|
|
714
840
|
// src/agents/llm-agent.ts
|
|
715
841
|
var Agent = class extends BaseAgent {
|
|
842
|
+
/**
|
|
843
|
+
* The LLM model to use
|
|
844
|
+
*/
|
|
845
|
+
model;
|
|
846
|
+
/**
|
|
847
|
+
* The LLM instance
|
|
848
|
+
*/
|
|
849
|
+
llm;
|
|
850
|
+
/**
|
|
851
|
+
* Instructions for the agent
|
|
852
|
+
*/
|
|
853
|
+
instructions;
|
|
854
|
+
/**
|
|
855
|
+
* Tools available to the agent
|
|
856
|
+
*/
|
|
857
|
+
tools;
|
|
858
|
+
/**
|
|
859
|
+
* Maximum number of tool execution steps to prevent infinite loops
|
|
860
|
+
*/
|
|
861
|
+
maxToolExecutionSteps;
|
|
862
|
+
/**
|
|
863
|
+
* Memory service for long-term storage and retrieval
|
|
864
|
+
*/
|
|
865
|
+
memoryService;
|
|
866
|
+
/**
|
|
867
|
+
* Session service for managing conversations
|
|
868
|
+
*/
|
|
869
|
+
sessionService;
|
|
870
|
+
/**
|
|
871
|
+
* User ID for the session
|
|
872
|
+
*/
|
|
873
|
+
userId;
|
|
874
|
+
/**
|
|
875
|
+
* Application name
|
|
876
|
+
*/
|
|
877
|
+
appName;
|
|
878
|
+
/**
|
|
879
|
+
* Whether to automatically augment prompts with relevant memory
|
|
880
|
+
*/
|
|
881
|
+
useMemoryAugmentation;
|
|
882
|
+
/**
|
|
883
|
+
* The maximum number of memory items to include in augmentation
|
|
884
|
+
*/
|
|
885
|
+
maxMemoryItems;
|
|
886
|
+
/**
|
|
887
|
+
* The minimum relevance score for memory augmentation (0-1)
|
|
888
|
+
*/
|
|
889
|
+
memoryRelevanceThreshold;
|
|
716
890
|
/**
|
|
717
891
|
* Constructor for Agent
|
|
718
892
|
*/
|
|
@@ -1417,6 +1591,18 @@ ${response.content || "No content"}
|
|
|
1417
1591
|
|
|
1418
1592
|
// src/agents/loop-agent.ts
|
|
1419
1593
|
var LoopAgent = class extends BaseAgent {
|
|
1594
|
+
/**
|
|
1595
|
+
* Maximum number of iterations to prevent infinite loops
|
|
1596
|
+
*/
|
|
1597
|
+
maxIterations;
|
|
1598
|
+
/**
|
|
1599
|
+
* Agent that decides whether to continue the loop
|
|
1600
|
+
*/
|
|
1601
|
+
conditionAgent;
|
|
1602
|
+
/**
|
|
1603
|
+
* Custom condition check function
|
|
1604
|
+
*/
|
|
1605
|
+
conditionCheck;
|
|
1420
1606
|
/**
|
|
1421
1607
|
* Constructor for LoopAgent
|
|
1422
1608
|
*/
|
|
@@ -1673,6 +1859,22 @@ ${lastResponse.content || ""}`,
|
|
|
1673
1859
|
|
|
1674
1860
|
// src/agents/lang-graph-agent.ts
|
|
1675
1861
|
var LangGraphAgent = class extends BaseAgent {
|
|
1862
|
+
/**
|
|
1863
|
+
* Graph nodes (agents and their connections)
|
|
1864
|
+
*/
|
|
1865
|
+
nodes;
|
|
1866
|
+
/**
|
|
1867
|
+
* Root node to start execution from
|
|
1868
|
+
*/
|
|
1869
|
+
rootNode;
|
|
1870
|
+
/**
|
|
1871
|
+
* Maximum number of steps to prevent infinite loops
|
|
1872
|
+
*/
|
|
1873
|
+
maxSteps;
|
|
1874
|
+
/**
|
|
1875
|
+
* Results from node executions
|
|
1876
|
+
*/
|
|
1877
|
+
results = [];
|
|
1676
1878
|
/**
|
|
1677
1879
|
* Constructor for LangGraphAgent
|
|
1678
1880
|
*/
|
|
@@ -1681,10 +1883,6 @@ var LangGraphAgent = class extends BaseAgent {
|
|
|
1681
1883
|
name: config.name,
|
|
1682
1884
|
description: config.description
|
|
1683
1885
|
});
|
|
1684
|
-
/**
|
|
1685
|
-
* Results from node executions
|
|
1686
|
-
*/
|
|
1687
|
-
this.results = [];
|
|
1688
1886
|
this.nodes = /* @__PURE__ */ new Map();
|
|
1689
1887
|
for (const node of config.nodes) {
|
|
1690
1888
|
if (this.nodes.has(node.name)) {
|
|
@@ -2236,6 +2434,7 @@ init_base_tool();
|
|
|
2236
2434
|
import fs from "fs/promises";
|
|
2237
2435
|
import path from "path";
|
|
2238
2436
|
var FileOperationsTool = class extends BaseTool {
|
|
2437
|
+
basePath;
|
|
2239
2438
|
constructor(options) {
|
|
2240
2439
|
super({
|
|
2241
2440
|
name: "file_operations",
|
|
@@ -2791,6 +2990,8 @@ var McpErrorType = /* @__PURE__ */ ((McpErrorType2) => {
|
|
|
2791
2990
|
return McpErrorType2;
|
|
2792
2991
|
})(McpErrorType || {});
|
|
2793
2992
|
var McpError = class extends Error {
|
|
2993
|
+
type;
|
|
2994
|
+
originalError;
|
|
2794
2995
|
constructor(message, type, originalError) {
|
|
2795
2996
|
super(message);
|
|
2796
2997
|
this.name = "McpError";
|
|
@@ -2829,10 +3030,11 @@ function withRetry(fn, instance, reinitMethod, maxRetries = 1) {
|
|
|
2829
3030
|
|
|
2830
3031
|
// src/tools/mcp/client.ts
|
|
2831
3032
|
var McpClientService = class {
|
|
3033
|
+
config;
|
|
3034
|
+
client = null;
|
|
3035
|
+
transport = null;
|
|
3036
|
+
isClosing = false;
|
|
2832
3037
|
constructor(config) {
|
|
2833
|
-
this.client = null;
|
|
2834
|
-
this.transport = null;
|
|
2835
|
-
this.isClosing = false;
|
|
2836
3038
|
this.config = config;
|
|
2837
3039
|
}
|
|
2838
3040
|
/**
|
|
@@ -3235,6 +3437,9 @@ async function createTool(mcpTool, client) {
|
|
|
3235
3437
|
}
|
|
3236
3438
|
}
|
|
3237
3439
|
var McpToolAdapter = class extends BaseTool {
|
|
3440
|
+
mcpTool;
|
|
3441
|
+
client;
|
|
3442
|
+
clientService = null;
|
|
3238
3443
|
constructor(mcpTool, client) {
|
|
3239
3444
|
const metadata = mcpTool.metadata || {};
|
|
3240
3445
|
super({
|
|
@@ -3244,7 +3449,6 @@ var McpToolAdapter = class extends BaseTool {
|
|
|
3244
3449
|
shouldRetryOnFailure: metadata.shouldRetryOnFailure ?? false,
|
|
3245
3450
|
maxRetryAttempts: metadata.maxRetryAttempts ?? 3
|
|
3246
3451
|
});
|
|
3247
|
-
this.clientService = null;
|
|
3248
3452
|
this.mcpTool = mcpTool;
|
|
3249
3453
|
this.client = client;
|
|
3250
3454
|
if (client.reinitialize && typeof client.reinitialize === "function") {
|
|
@@ -3323,11 +3527,12 @@ var McpToolAdapter = class extends BaseTool {
|
|
|
3323
3527
|
|
|
3324
3528
|
// src/tools/mcp/index.ts
|
|
3325
3529
|
var McpToolset = class {
|
|
3530
|
+
config;
|
|
3531
|
+
clientService = null;
|
|
3532
|
+
toolFilter = null;
|
|
3533
|
+
tools = [];
|
|
3534
|
+
isClosing = false;
|
|
3326
3535
|
constructor(config, toolFilter = null) {
|
|
3327
|
-
this.clientService = null;
|
|
3328
|
-
this.toolFilter = null;
|
|
3329
|
-
this.tools = [];
|
|
3330
|
-
this.isClosing = false;
|
|
3331
3536
|
this.config = config;
|
|
3332
3537
|
this.toolFilter = toolFilter;
|
|
3333
3538
|
this.clientService = new McpClientService(config);
|
|
@@ -3505,6 +3710,30 @@ __export(models_exports, {
|
|
|
3505
3710
|
|
|
3506
3711
|
// src/models/llm-response.ts
|
|
3507
3712
|
var LLMResponse = class {
|
|
3713
|
+
/**
|
|
3714
|
+
* Content of the response
|
|
3715
|
+
*/
|
|
3716
|
+
content;
|
|
3717
|
+
/**
|
|
3718
|
+
* Function calls in the response
|
|
3719
|
+
*/
|
|
3720
|
+
function_call;
|
|
3721
|
+
/**
|
|
3722
|
+
* Tool calls in the response
|
|
3723
|
+
*/
|
|
3724
|
+
tool_calls;
|
|
3725
|
+
/**
|
|
3726
|
+
* Role of the message (usually 'assistant')
|
|
3727
|
+
*/
|
|
3728
|
+
role;
|
|
3729
|
+
/**
|
|
3730
|
+
* Whether this is a partial response in a stream
|
|
3731
|
+
*/
|
|
3732
|
+
is_partial;
|
|
3733
|
+
/**
|
|
3734
|
+
* Raw provider response
|
|
3735
|
+
*/
|
|
3736
|
+
raw_response;
|
|
3508
3737
|
constructor(data) {
|
|
3509
3738
|
this.content = data.content;
|
|
3510
3739
|
this.function_call = data.function_call;
|
|
@@ -3517,6 +3746,10 @@ var LLMResponse = class {
|
|
|
3517
3746
|
|
|
3518
3747
|
// src/models/base-llm.ts
|
|
3519
3748
|
var BaseLLM = class {
|
|
3749
|
+
/**
|
|
3750
|
+
* The name of the LLM model
|
|
3751
|
+
*/
|
|
3752
|
+
model;
|
|
3520
3753
|
/**
|
|
3521
3754
|
* Constructor for BaseLLM
|
|
3522
3755
|
*/
|
|
@@ -3542,12 +3775,10 @@ var BaseLLM = class {
|
|
|
3542
3775
|
|
|
3543
3776
|
// src/models/base-llm-connection.ts
|
|
3544
3777
|
var BaseLLMConnection = class {
|
|
3545
|
-
|
|
3546
|
-
|
|
3547
|
-
|
|
3548
|
-
|
|
3549
|
-
this._isActive = true;
|
|
3550
|
-
}
|
|
3778
|
+
/**
|
|
3779
|
+
* Whether the connection is active
|
|
3780
|
+
*/
|
|
3781
|
+
_isActive = true;
|
|
3551
3782
|
/**
|
|
3552
3783
|
* Gets whether the connection is active
|
|
3553
3784
|
*/
|
|
@@ -3567,6 +3798,32 @@ import axios from "axios";
|
|
|
3567
3798
|
|
|
3568
3799
|
// src/models/anthropic-llm-connection.ts
|
|
3569
3800
|
var AnthropicLLMConnection = class extends BaseLLMConnection {
|
|
3801
|
+
/**
|
|
3802
|
+
* Axios instance for API calls
|
|
3803
|
+
*/
|
|
3804
|
+
client;
|
|
3805
|
+
/**
|
|
3806
|
+
* Current model to use
|
|
3807
|
+
*/
|
|
3808
|
+
model;
|
|
3809
|
+
/**
|
|
3810
|
+
* Current messages in the conversation
|
|
3811
|
+
*/
|
|
3812
|
+
messages;
|
|
3813
|
+
/**
|
|
3814
|
+
* System message if present
|
|
3815
|
+
*/
|
|
3816
|
+
systemMessage;
|
|
3817
|
+
/**
|
|
3818
|
+
* Default parameters for requests
|
|
3819
|
+
*/
|
|
3820
|
+
defaultParams;
|
|
3821
|
+
/**
|
|
3822
|
+
* Callbacks for handling responses, errors, and connection end
|
|
3823
|
+
*/
|
|
3824
|
+
responseCallback;
|
|
3825
|
+
errorCallback;
|
|
3826
|
+
endCallback;
|
|
3570
3827
|
/**
|
|
3571
3828
|
* Constructor
|
|
3572
3829
|
*/
|
|
@@ -3834,6 +4091,18 @@ ${typeof message.content === "string" ? message.content : JSON.stringify(message
|
|
|
3834
4091
|
|
|
3835
4092
|
// src/models/anthropic-llm.ts
|
|
3836
4093
|
var AnthropicLLM = class extends BaseLLM {
|
|
4094
|
+
/**
|
|
4095
|
+
* Anthropic API key
|
|
4096
|
+
*/
|
|
4097
|
+
apiKey;
|
|
4098
|
+
/**
|
|
4099
|
+
* Anthropic API base URL
|
|
4100
|
+
*/
|
|
4101
|
+
baseURL;
|
|
4102
|
+
/**
|
|
4103
|
+
* Default parameters for requests
|
|
4104
|
+
*/
|
|
4105
|
+
defaultParams;
|
|
3837
4106
|
/**
|
|
3838
4107
|
* Constructor for AnthropicLLM
|
|
3839
4108
|
*/
|
|
@@ -4134,6 +4403,14 @@ import {
|
|
|
4134
4403
|
GoogleGenAI
|
|
4135
4404
|
} from "@google/genai";
|
|
4136
4405
|
var GoogleLLM = class extends BaseLLM {
|
|
4406
|
+
/**
|
|
4407
|
+
* Generative model instance
|
|
4408
|
+
*/
|
|
4409
|
+
ai;
|
|
4410
|
+
/**
|
|
4411
|
+
* Default parameters for requests
|
|
4412
|
+
*/
|
|
4413
|
+
defaultParams;
|
|
4137
4414
|
/**
|
|
4138
4415
|
* Constructor for GoogleLLM
|
|
4139
4416
|
*/
|
|
@@ -4495,15 +4772,43 @@ import OpenAI from "openai";
|
|
|
4495
4772
|
|
|
4496
4773
|
// src/models/openai-llm-connection.ts
|
|
4497
4774
|
var OpenAILLMConnection = class extends BaseLLMConnection {
|
|
4775
|
+
/**
|
|
4776
|
+
* OpenAI client
|
|
4777
|
+
*/
|
|
4778
|
+
client;
|
|
4779
|
+
/**
|
|
4780
|
+
* The model name
|
|
4781
|
+
*/
|
|
4782
|
+
model;
|
|
4783
|
+
/**
|
|
4784
|
+
* The initial request
|
|
4785
|
+
*/
|
|
4786
|
+
initialRequest;
|
|
4787
|
+
/**
|
|
4788
|
+
* Default parameters
|
|
4789
|
+
*/
|
|
4790
|
+
defaultParams;
|
|
4791
|
+
/**
|
|
4792
|
+
* Response callback
|
|
4793
|
+
*/
|
|
4794
|
+
responseCallback;
|
|
4795
|
+
/**
|
|
4796
|
+
* Error callback
|
|
4797
|
+
*/
|
|
4798
|
+
errorCallback;
|
|
4799
|
+
/**
|
|
4800
|
+
* End callback
|
|
4801
|
+
*/
|
|
4802
|
+
endCallback;
|
|
4803
|
+
/**
|
|
4804
|
+
* Ongoing chat history
|
|
4805
|
+
*/
|
|
4806
|
+
messages = [];
|
|
4498
4807
|
/**
|
|
4499
4808
|
* Constructor for OpenAILLMConnection
|
|
4500
4809
|
*/
|
|
4501
4810
|
constructor(client, model, initialRequest, defaultParams) {
|
|
4502
4811
|
super();
|
|
4503
|
-
/**
|
|
4504
|
-
* Ongoing chat history
|
|
4505
|
-
*/
|
|
4506
|
-
this.messages = [];
|
|
4507
4812
|
this.client = client;
|
|
4508
4813
|
this.model = model;
|
|
4509
4814
|
this.initialRequest = initialRequest;
|
|
@@ -4714,6 +5019,14 @@ var OpenAILLMConnection = class extends BaseLLMConnection {
|
|
|
4714
5019
|
|
|
4715
5020
|
// src/models/openai-llm.ts
|
|
4716
5021
|
var OpenAILLM = class extends BaseLLM {
|
|
5022
|
+
/**
|
|
5023
|
+
* OpenAI client instance
|
|
5024
|
+
*/
|
|
5025
|
+
client;
|
|
5026
|
+
/**
|
|
5027
|
+
* Default parameters for requests
|
|
5028
|
+
*/
|
|
5029
|
+
defaultParams;
|
|
4717
5030
|
/**
|
|
4718
5031
|
* Constructor for OpenAILLM
|
|
4719
5032
|
*/
|
|
@@ -5042,6 +5355,10 @@ var AuthCredentialType = /* @__PURE__ */ ((AuthCredentialType2) => {
|
|
|
5042
5355
|
return AuthCredentialType2;
|
|
5043
5356
|
})(AuthCredentialType || {});
|
|
5044
5357
|
var AuthCredential = class {
|
|
5358
|
+
/**
|
|
5359
|
+
* Type of credential
|
|
5360
|
+
*/
|
|
5361
|
+
type;
|
|
5045
5362
|
/**
|
|
5046
5363
|
* Constructor for AuthCredential
|
|
5047
5364
|
*/
|
|
@@ -5062,6 +5379,10 @@ var AuthCredential = class {
|
|
|
5062
5379
|
}
|
|
5063
5380
|
};
|
|
5064
5381
|
var ApiKeyCredential = class extends AuthCredential {
|
|
5382
|
+
/**
|
|
5383
|
+
* The API key
|
|
5384
|
+
*/
|
|
5385
|
+
apiKey;
|
|
5065
5386
|
/**
|
|
5066
5387
|
* Constructor for ApiKeyCredential
|
|
5067
5388
|
*/
|
|
@@ -5087,6 +5408,14 @@ var ApiKeyCredential = class extends AuthCredential {
|
|
|
5087
5408
|
}
|
|
5088
5409
|
};
|
|
5089
5410
|
var BasicAuthCredential = class extends AuthCredential {
|
|
5411
|
+
/**
|
|
5412
|
+
* The username
|
|
5413
|
+
*/
|
|
5414
|
+
username;
|
|
5415
|
+
/**
|
|
5416
|
+
* The password
|
|
5417
|
+
*/
|
|
5418
|
+
password;
|
|
5090
5419
|
/**
|
|
5091
5420
|
* Constructor for BasicAuthCredential
|
|
5092
5421
|
*/
|
|
@@ -5111,6 +5440,10 @@ var BasicAuthCredential = class extends AuthCredential {
|
|
|
5111
5440
|
}
|
|
5112
5441
|
};
|
|
5113
5442
|
var BearerTokenCredential = class extends AuthCredential {
|
|
5443
|
+
/**
|
|
5444
|
+
* The bearer token
|
|
5445
|
+
*/
|
|
5446
|
+
token;
|
|
5114
5447
|
/**
|
|
5115
5448
|
* Constructor for BearerTokenCredential
|
|
5116
5449
|
*/
|
|
@@ -5134,6 +5467,22 @@ var BearerTokenCredential = class extends AuthCredential {
|
|
|
5134
5467
|
}
|
|
5135
5468
|
};
|
|
5136
5469
|
var OAuth2Credential = class extends AuthCredential {
|
|
5470
|
+
/**
|
|
5471
|
+
* The access token
|
|
5472
|
+
*/
|
|
5473
|
+
accessToken;
|
|
5474
|
+
/**
|
|
5475
|
+
* The refresh token
|
|
5476
|
+
*/
|
|
5477
|
+
refreshToken;
|
|
5478
|
+
/**
|
|
5479
|
+
* When the token expires
|
|
5480
|
+
*/
|
|
5481
|
+
expiresAt;
|
|
5482
|
+
/**
|
|
5483
|
+
* Function to refresh the token
|
|
5484
|
+
*/
|
|
5485
|
+
refreshFunction;
|
|
5137
5486
|
/**
|
|
5138
5487
|
* Constructor for OAuth2Credential
|
|
5139
5488
|
*/
|
|
@@ -5200,6 +5549,14 @@ var OAuth2Credential = class extends AuthCredential {
|
|
|
5200
5549
|
|
|
5201
5550
|
// src/auth/auth-config.ts
|
|
5202
5551
|
var AuthConfig = class {
|
|
5552
|
+
/**
|
|
5553
|
+
* The authentication scheme
|
|
5554
|
+
*/
|
|
5555
|
+
authScheme;
|
|
5556
|
+
/**
|
|
5557
|
+
* Additional context properties
|
|
5558
|
+
*/
|
|
5559
|
+
context;
|
|
5203
5560
|
/**
|
|
5204
5561
|
* Constructor for AuthConfig
|
|
5205
5562
|
*/
|
|
@@ -5211,6 +5568,14 @@ var AuthConfig = class {
|
|
|
5211
5568
|
|
|
5212
5569
|
// src/auth/auth-handler.ts
|
|
5213
5570
|
var AuthHandler = class {
|
|
5571
|
+
/**
|
|
5572
|
+
* The authentication configuration
|
|
5573
|
+
*/
|
|
5574
|
+
authConfig;
|
|
5575
|
+
/**
|
|
5576
|
+
* The authentication credential
|
|
5577
|
+
*/
|
|
5578
|
+
credential;
|
|
5214
5579
|
/**
|
|
5215
5580
|
* Constructor for AuthHandler
|
|
5216
5581
|
*/
|
|
@@ -5252,11 +5617,27 @@ var AuthSchemeType = /* @__PURE__ */ ((AuthSchemeType2) => {
|
|
|
5252
5617
|
return AuthSchemeType2;
|
|
5253
5618
|
})(AuthSchemeType || {});
|
|
5254
5619
|
var AuthScheme = class {
|
|
5620
|
+
/**
|
|
5621
|
+
* The type of authentication scheme
|
|
5622
|
+
*/
|
|
5623
|
+
type;
|
|
5255
5624
|
constructor(type) {
|
|
5256
5625
|
this.type = type;
|
|
5257
5626
|
}
|
|
5258
5627
|
};
|
|
5259
5628
|
var ApiKeyScheme = class extends AuthScheme {
|
|
5629
|
+
/**
|
|
5630
|
+
* Where the API key is sent
|
|
5631
|
+
*/
|
|
5632
|
+
in;
|
|
5633
|
+
/**
|
|
5634
|
+
* Name of the parameter
|
|
5635
|
+
*/
|
|
5636
|
+
name;
|
|
5637
|
+
/**
|
|
5638
|
+
* Description of the API key
|
|
5639
|
+
*/
|
|
5640
|
+
description;
|
|
5260
5641
|
/**
|
|
5261
5642
|
* Constructor for ApiKeyScheme
|
|
5262
5643
|
*/
|
|
@@ -5268,6 +5649,18 @@ var ApiKeyScheme = class extends AuthScheme {
|
|
|
5268
5649
|
}
|
|
5269
5650
|
};
|
|
5270
5651
|
var HttpScheme = class extends AuthScheme {
|
|
5652
|
+
/**
|
|
5653
|
+
* The HTTP authentication scheme
|
|
5654
|
+
*/
|
|
5655
|
+
scheme;
|
|
5656
|
+
/**
|
|
5657
|
+
* Bearer format when scheme is 'bearer'
|
|
5658
|
+
*/
|
|
5659
|
+
bearerFormat;
|
|
5660
|
+
/**
|
|
5661
|
+
* Description of the scheme
|
|
5662
|
+
*/
|
|
5663
|
+
description;
|
|
5271
5664
|
/**
|
|
5272
5665
|
* Constructor for HttpScheme
|
|
5273
5666
|
*/
|
|
@@ -5279,6 +5672,14 @@ var HttpScheme = class extends AuthScheme {
|
|
|
5279
5672
|
}
|
|
5280
5673
|
};
|
|
5281
5674
|
var OAuth2Scheme = class extends AuthScheme {
|
|
5675
|
+
/**
|
|
5676
|
+
* OAuth flows
|
|
5677
|
+
*/
|
|
5678
|
+
flows;
|
|
5679
|
+
/**
|
|
5680
|
+
* Description of the scheme
|
|
5681
|
+
*/
|
|
5682
|
+
description;
|
|
5282
5683
|
/**
|
|
5283
5684
|
* Constructor for OAuth2Scheme
|
|
5284
5685
|
*/
|
|
@@ -5289,6 +5690,14 @@ var OAuth2Scheme = class extends AuthScheme {
|
|
|
5289
5690
|
}
|
|
5290
5691
|
};
|
|
5291
5692
|
var OpenIdConnectScheme = class extends AuthScheme {
|
|
5693
|
+
/**
|
|
5694
|
+
* OpenID Connect URL
|
|
5695
|
+
*/
|
|
5696
|
+
openIdConnectUrl;
|
|
5697
|
+
/**
|
|
5698
|
+
* Description of the scheme
|
|
5699
|
+
*/
|
|
5700
|
+
description;
|
|
5292
5701
|
/**
|
|
5293
5702
|
* Constructor for OpenIdConnectScheme
|
|
5294
5703
|
*/
|
|
@@ -5301,6 +5710,8 @@ var OpenIdConnectScheme = class extends AuthScheme {
|
|
|
5301
5710
|
|
|
5302
5711
|
// src/sessions/state.ts
|
|
5303
5712
|
var SessionState = class _SessionState {
|
|
5713
|
+
state;
|
|
5714
|
+
dirty;
|
|
5304
5715
|
constructor() {
|
|
5305
5716
|
this.state = /* @__PURE__ */ new Map();
|
|
5306
5717
|
this.dirty = /* @__PURE__ */ new Set();
|
|
@@ -5388,6 +5799,10 @@ __export(memory_exports, {
|
|
|
5388
5799
|
|
|
5389
5800
|
// src/memory/in-memory-memory-service.ts
|
|
5390
5801
|
var InMemoryMemoryService = class {
|
|
5802
|
+
/**
|
|
5803
|
+
* Map of sessions by ID
|
|
5804
|
+
*/
|
|
5805
|
+
sessions;
|
|
5391
5806
|
/**
|
|
5392
5807
|
* Constructor for InMemoryMemoryService
|
|
5393
5808
|
*/
|
|
@@ -5491,6 +5906,18 @@ var InMemoryMemoryService = class {
|
|
|
5491
5906
|
import fs2 from "fs";
|
|
5492
5907
|
import path2 from "path";
|
|
5493
5908
|
var PersistentMemoryService = class {
|
|
5909
|
+
/**
|
|
5910
|
+
* In-memory service used for search operations
|
|
5911
|
+
*/
|
|
5912
|
+
inMemoryService;
|
|
5913
|
+
/**
|
|
5914
|
+
* Directory where memory files will be stored
|
|
5915
|
+
*/
|
|
5916
|
+
storageDir;
|
|
5917
|
+
/**
|
|
5918
|
+
* File prefix for memory files
|
|
5919
|
+
*/
|
|
5920
|
+
filePrefix;
|
|
5494
5921
|
/**
|
|
5495
5922
|
* Constructor for PersistentMemoryService
|
|
5496
5923
|
*/
|
|
@@ -5649,11 +6076,16 @@ __export(sessions_exports, {
|
|
|
5649
6076
|
SessionState: () => SessionState,
|
|
5650
6077
|
cloneSession: () => cloneSession,
|
|
5651
6078
|
generateSessionId: () => generateSessionId,
|
|
6079
|
+
sessionsSchema: () => sessionsSchema2,
|
|
5652
6080
|
validateSession: () => validateSession
|
|
5653
6081
|
});
|
|
5654
6082
|
|
|
5655
6083
|
// src/sessions/in-memory-session-service.ts
|
|
5656
6084
|
var InMemorySessionService = class {
|
|
6085
|
+
/**
|
|
6086
|
+
* Map of sessions by ID
|
|
6087
|
+
*/
|
|
6088
|
+
sessions;
|
|
5657
6089
|
/**
|
|
5658
6090
|
* Constructor for InMemorySessionService
|
|
5659
6091
|
*/
|
|
@@ -5799,6 +6231,8 @@ var sessionsSchema = pgTable("sessions", {
|
|
|
5799
6231
|
// Store serialized SessionState as JSONB
|
|
5800
6232
|
});
|
|
5801
6233
|
var PostgresSessionService = class {
|
|
6234
|
+
db;
|
|
6235
|
+
sessionsTable;
|
|
5802
6236
|
constructor(config) {
|
|
5803
6237
|
this.db = config.db;
|
|
5804
6238
|
this.sessionsTable = config.sessionsTable || sessionsSchema;
|
|
@@ -5921,22 +6355,25 @@ var PostgresSessionService = class {
|
|
|
5921
6355
|
// src/sessions/pglite-session-service.ts
|
|
5922
6356
|
import { eq as eq2 } from "drizzle-orm";
|
|
5923
6357
|
import { jsonb as jsonb2, pgTable as pgTable2, timestamp as timestamp2, varchar as varchar2 } from "drizzle-orm/pg-core";
|
|
6358
|
+
import { drizzle } from "drizzle-orm/pglite";
|
|
5924
6359
|
var sessionsSchema2 = pgTable2("sessions", {
|
|
5925
6360
|
id: varchar2("id", { length: 255 }).primaryKey(),
|
|
5926
6361
|
userId: varchar2("user_id", { length: 255 }).notNull(),
|
|
5927
6362
|
messages: jsonb2("messages").default("[]").$type(),
|
|
5928
|
-
// Store Message array as JSONB
|
|
5929
6363
|
metadata: jsonb2("metadata").default("{}").$type(),
|
|
5930
6364
|
createdAt: timestamp2("created_at", { withTimezone: true }).defaultNow().notNull(),
|
|
5931
6365
|
updatedAt: timestamp2("updated_at", { withTimezone: true }).defaultNow().notNull(),
|
|
5932
6366
|
state: jsonb2("state").default("{}").$type()
|
|
5933
|
-
// Store serialized SessionState as JSONB
|
|
5934
6367
|
});
|
|
5935
6368
|
var PgLiteSessionService = class {
|
|
6369
|
+
db;
|
|
6370
|
+
sessionsTable;
|
|
6371
|
+
initialized = false;
|
|
5936
6372
|
constructor(config) {
|
|
5937
|
-
this.
|
|
5938
|
-
|
|
5939
|
-
|
|
6373
|
+
this.db = drizzle(config.pglite, {
|
|
6374
|
+
schema: { sessions: sessionsSchema2 }
|
|
6375
|
+
});
|
|
6376
|
+
this.sessionsTable = sessionsSchema2;
|
|
5940
6377
|
if (!config.skipTableCreation) {
|
|
5941
6378
|
this.initializeDatabase().catch((error) => {
|
|
5942
6379
|
console.error("Failed to initialize PgLite database:", error);
|
|
@@ -5991,9 +6428,7 @@ var PgLiteSessionService = class {
|
|
|
5991
6428
|
metadata,
|
|
5992
6429
|
createdAt: now,
|
|
5993
6430
|
updatedAt: now,
|
|
5994
|
-
// Drizzle's defaultNow() on schema handles this, but explicit is fine
|
|
5995
6431
|
state: sessionState.toObject()
|
|
5996
|
-
// Serialize SessionState
|
|
5997
6432
|
};
|
|
5998
6433
|
const results = await this.db.insert(this.sessionsTable).values(newSessionData).returning();
|
|
5999
6434
|
const result = results[0];
|
|
@@ -6008,7 +6443,6 @@ var PgLiteSessionService = class {
|
|
|
6008
6443
|
messages: Array.isArray(result.messages) ? result.messages : [],
|
|
6009
6444
|
metadata: result.metadata || {},
|
|
6010
6445
|
state: SessionState.fromObject(result.state || {}),
|
|
6011
|
-
// Ensure dates are Date objects if Drizzle returns strings for some drivers/configs
|
|
6012
6446
|
createdAt: new Date(result.createdAt),
|
|
6013
6447
|
updatedAt: new Date(result.updatedAt)
|
|
6014
6448
|
};
|
|
@@ -6036,7 +6470,6 @@ var PgLiteSessionService = class {
|
|
|
6036
6470
|
userId: session.userId,
|
|
6037
6471
|
messages: session.messages,
|
|
6038
6472
|
metadata: session.metadata,
|
|
6039
|
-
// createdAt should typically not be updated after creation
|
|
6040
6473
|
updatedAt: /* @__PURE__ */ new Date(),
|
|
6041
6474
|
state: session.state.toObject()
|
|
6042
6475
|
};
|
|
@@ -6063,12 +6496,6 @@ var PgLiteSessionService = class {
|
|
|
6063
6496
|
await this.ensureInitialized();
|
|
6064
6497
|
await this.db.delete(this.sessionsTable).where(eq2(this.sessionsTable.id, sessionId));
|
|
6065
6498
|
}
|
|
6066
|
-
/**
|
|
6067
|
-
* Appends an event to a session object
|
|
6068
|
-
* @param session The session to append the event to
|
|
6069
|
-
* @param event The event to append
|
|
6070
|
-
* @returns The appended event
|
|
6071
|
-
*/
|
|
6072
6499
|
async appendEvent(session, event) {
|
|
6073
6500
|
await this.ensureInitialized();
|
|
6074
6501
|
if (event.is_partial) {
|
|
@@ -6090,11 +6517,6 @@ var PgLiteSessionService = class {
|
|
|
6090
6517
|
await this.updateSession(session);
|
|
6091
6518
|
return event;
|
|
6092
6519
|
}
|
|
6093
|
-
// TODO: Consider if table creation/migration logic is needed here or handled externally (e.g., drizzle-kit migrations)
|
|
6094
|
-
// TODO: Implement methods corresponding to Python's append_event, list_events,
|
|
6095
|
-
// get_app_state, update_app_state, get_user_state, update_user_state
|
|
6096
|
-
// if full parity with Python's DatabaseSessionService is desired.
|
|
6097
|
-
// This would require defining corresponding Drizzle schemas for Events, AppState, UserState.
|
|
6098
6520
|
};
|
|
6099
6521
|
|
|
6100
6522
|
// src/sessions/session-util.ts
|
|
@@ -6132,19 +6554,32 @@ import { v4 as uuidv4 } from "uuid";
|
|
|
6132
6554
|
|
|
6133
6555
|
// src/events/event-actions.ts
|
|
6134
6556
|
var EventActions = class {
|
|
6557
|
+
/**
|
|
6558
|
+
* If true, it won't call model to summarize function response.
|
|
6559
|
+
* Only used for function_response event.
|
|
6560
|
+
*/
|
|
6561
|
+
skipSummarization;
|
|
6562
|
+
/**
|
|
6563
|
+
* Indicates that the event is updating the state with the given delta.
|
|
6564
|
+
*/
|
|
6565
|
+
stateDelta = {};
|
|
6566
|
+
/**
|
|
6567
|
+
* Indicates that the event is updating an artifact. key is the filename,
|
|
6568
|
+
* value is the version.
|
|
6569
|
+
*/
|
|
6570
|
+
artifactDelta = {};
|
|
6571
|
+
/**
|
|
6572
|
+
* If set, the event transfers to the specified agent.
|
|
6573
|
+
*/
|
|
6574
|
+
transferToAgent;
|
|
6575
|
+
/**
|
|
6576
|
+
* The agent is escalating to a higher level agent.
|
|
6577
|
+
*/
|
|
6578
|
+
escalate;
|
|
6135
6579
|
/**
|
|
6136
6580
|
* Constructor for EventActions
|
|
6137
6581
|
*/
|
|
6138
6582
|
constructor(options = {}) {
|
|
6139
|
-
/**
|
|
6140
|
-
* Indicates that the event is updating the state with the given delta.
|
|
6141
|
-
*/
|
|
6142
|
-
this.stateDelta = {};
|
|
6143
|
-
/**
|
|
6144
|
-
* Indicates that the event is updating an artifact. key is the filename,
|
|
6145
|
-
* value is the version.
|
|
6146
|
-
*/
|
|
6147
|
-
this.artifactDelta = {};
|
|
6148
6583
|
this.skipSummarization = options.skipSummarization;
|
|
6149
6584
|
this.stateDelta = options.stateDelta || {};
|
|
6150
6585
|
this.artifactDelta = options.artifactDelta || {};
|
|
@@ -6155,6 +6590,40 @@ var EventActions = class {
|
|
|
6155
6590
|
|
|
6156
6591
|
// src/events/event.ts
|
|
6157
6592
|
var Event = class _Event extends LLMResponse {
|
|
6593
|
+
/**
|
|
6594
|
+
* The invocation ID of the event.
|
|
6595
|
+
*/
|
|
6596
|
+
invocationId = "";
|
|
6597
|
+
/**
|
|
6598
|
+
* 'user' or the name of the agent, indicating who appended the event to the session.
|
|
6599
|
+
*/
|
|
6600
|
+
author;
|
|
6601
|
+
/**
|
|
6602
|
+
* The actions taken by the agent.
|
|
6603
|
+
*/
|
|
6604
|
+
actions = new EventActions();
|
|
6605
|
+
/**
|
|
6606
|
+
* Set of ids of the long running function calls.
|
|
6607
|
+
* Agent client will know from this field about which function call is long running.
|
|
6608
|
+
* Only valid for function call event.
|
|
6609
|
+
*/
|
|
6610
|
+
longRunningToolIds;
|
|
6611
|
+
/**
|
|
6612
|
+
* The branch of the event.
|
|
6613
|
+
* The format is like agent_1.agent_2.agent_3, where agent_1 is the parent of
|
|
6614
|
+
* agent_2, and agent_2 is the parent of agent_3.
|
|
6615
|
+
* Branch is used when multiple sub-agent shouldn't see their peer agents'
|
|
6616
|
+
* conversation history.
|
|
6617
|
+
*/
|
|
6618
|
+
branch;
|
|
6619
|
+
/**
|
|
6620
|
+
* The unique identifier of the event.
|
|
6621
|
+
*/
|
|
6622
|
+
id = "";
|
|
6623
|
+
/**
|
|
6624
|
+
* The timestamp of the event.
|
|
6625
|
+
*/
|
|
6626
|
+
timestamp;
|
|
6158
6627
|
/**
|
|
6159
6628
|
* Constructor for Event
|
|
6160
6629
|
*/
|
|
@@ -6181,18 +6650,6 @@ var Event = class _Event extends LLMResponse {
|
|
|
6181
6650
|
is_partial: partial,
|
|
6182
6651
|
raw_response
|
|
6183
6652
|
});
|
|
6184
|
-
/**
|
|
6185
|
-
* The invocation ID of the event.
|
|
6186
|
-
*/
|
|
6187
|
-
this.invocationId = "";
|
|
6188
|
-
/**
|
|
6189
|
-
* The actions taken by the agent.
|
|
6190
|
-
*/
|
|
6191
|
-
this.actions = new EventActions();
|
|
6192
|
-
/**
|
|
6193
|
-
* The unique identifier of the event.
|
|
6194
|
-
*/
|
|
6195
|
-
this.id = "";
|
|
6196
6653
|
this.invocationId = invocationId;
|
|
6197
6654
|
this.author = author;
|
|
6198
6655
|
this.actions = actions;
|
|
@@ -6230,6 +6687,22 @@ var Event = class _Event extends LLMResponse {
|
|
|
6230
6687
|
|
|
6231
6688
|
// src/runners.ts
|
|
6232
6689
|
var Runner = class {
|
|
6690
|
+
/**
|
|
6691
|
+
* The app name of the runner.
|
|
6692
|
+
*/
|
|
6693
|
+
appName;
|
|
6694
|
+
/**
|
|
6695
|
+
* The root agent to run.
|
|
6696
|
+
*/
|
|
6697
|
+
agent;
|
|
6698
|
+
/**
|
|
6699
|
+
* The session service for the runner.
|
|
6700
|
+
*/
|
|
6701
|
+
sessionService;
|
|
6702
|
+
/**
|
|
6703
|
+
* The memory service for the runner.
|
|
6704
|
+
*/
|
|
6705
|
+
memoryService;
|
|
6233
6706
|
/**
|
|
6234
6707
|
* Initializes the Runner.
|
|
6235
6708
|
*/
|
|
@@ -6429,5 +6902,6 @@ export {
|
|
|
6429
6902
|
mcpSchemaToParameters,
|
|
6430
6903
|
normalizeJsonSchema,
|
|
6431
6904
|
registerProviders,
|
|
6905
|
+
sessionsSchema2 as sessionsSchema,
|
|
6432
6906
|
validateSession
|
|
6433
6907
|
};
|