@elqnt/agents 1.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.
@@ -0,0 +1,1297 @@
1
+ import { JSONSchema, ProductNameTS, ResponseMetadata } from '@elqnt/types';
2
+
3
+ /**
4
+ * AgentContext accumulates meaningful state from agentic tool executions.
5
+ * It provides a structured, schema-driven view of what happened during a chat
6
+ * and what meaningful data was extracted.
7
+ * Stored in: agent_contexts_org_{orgId} with key: {agentId}:{chatKey}
8
+ */
9
+ interface AgentContext {
10
+ /**
11
+ * Identity - used for storage key and cross-references
12
+ */
13
+ orgId: string;
14
+ agentId: string;
15
+ chatKey: string;
16
+ /**
17
+ * Schema defines the shape of accumulated variables
18
+ * Tools contribute to this schema as they execute
19
+ */
20
+ schema: any;
21
+ /**
22
+ * Variables is the merged view of all important outputs
23
+ * This is what gets displayed in the "Agent Context" panel
24
+ */
25
+ variables: {
26
+ [key: string]: any;
27
+ };
28
+ /**
29
+ * Executions tracks each tool call with full input/output
30
+ * Similar to NodeStates in workflow engine
31
+ */
32
+ executions: AgentExecution[];
33
+ /**
34
+ * PendingPlan holds an execution plan awaiting user approval
35
+ * Part of the Plan → Approve → Execute flow
36
+ */
37
+ pendingPlan?: ExecutionPlan;
38
+ /**
39
+ * CompletedPlans holds historical plans (for reference/audit)
40
+ */
41
+ completedPlans?: ExecutionPlan[];
42
+ /**
43
+ * Tracking
44
+ */
45
+ createdAt: number;
46
+ lastUpdated: number;
47
+ /**
48
+ * Size management
49
+ */
50
+ archivedExecutionCount?: number;
51
+ }
52
+ /**
53
+ * AgentExecution represents one tool call during the agentic loop.
54
+ * Similar to NodeState in the workflow engine.
55
+ */
56
+ interface AgentExecution {
57
+ /**
58
+ * Identity
59
+ */
60
+ id: string;
61
+ toolName: string;
62
+ toolId?: string;
63
+ /**
64
+ * Display
65
+ */
66
+ title: string;
67
+ type: string;
68
+ icon?: string;
69
+ /**
70
+ * Status
71
+ */
72
+ status: ExecutionStatusTS;
73
+ error?: string;
74
+ /**
75
+ * Schema-driven Input/Output (like NodeInput/NodeOutput)
76
+ */
77
+ inputSchema?: any;
78
+ input: {
79
+ [key: string]: any;
80
+ };
81
+ outputSchema?: any;
82
+ output?: {
83
+ [key: string]: any;
84
+ };
85
+ /**
86
+ * Merge Configuration - how this execution's output merges into Variables
87
+ */
88
+ mergeConfig?: MergeConfig;
89
+ /**
90
+ * Timing
91
+ */
92
+ startedAt: number;
93
+ completedAt?: number;
94
+ duration?: number;
95
+ }
96
+ /**
97
+ * ExecutionStatus represents the status of a tool execution
98
+ */
99
+ type ExecutionStatus = string;
100
+ declare const ExecutionStatusPending: ExecutionStatus;
101
+ declare const ExecutionStatusRunning: ExecutionStatus;
102
+ declare const ExecutionStatusCompleted: ExecutionStatus;
103
+ declare const ExecutionStatusFailed: ExecutionStatus;
104
+ declare const ExecutionStatusSkipped: ExecutionStatus;
105
+ type ExecutionStatusTS = 'pending' | 'running' | 'completed' | 'failed' | 'skipped';
106
+ /**
107
+ * MergeConfig defines how tool output gets merged into AgentContext.Variables
108
+ */
109
+ interface MergeConfig {
110
+ /**
111
+ * Keys to extract from output and merge into variables
112
+ */
113
+ mergeKeys?: string[];
114
+ /**
115
+ * Target path in variables
116
+ * Examples: "shipperName" (direct), "documents[]" (append to array)
117
+ */
118
+ targetPath?: string;
119
+ /**
120
+ * Strategy: "replace" | "merge" | "append"
121
+ * - replace: overwrite the target path
122
+ * - merge: deep merge objects
123
+ * - append: append to array (use with "path[]" syntax)
124
+ */
125
+ strategy?: MergeStrategy;
126
+ }
127
+ /**
128
+ * MergeStrategy defines how values are merged into variables
129
+ */
130
+ type MergeStrategy = string;
131
+ declare const MergeStrategyReplace: MergeStrategy;
132
+ declare const MergeStrategyMerge: MergeStrategy;
133
+ declare const MergeStrategyAppend: MergeStrategy;
134
+ type MergeStrategyTS = 'replace' | 'merge' | 'append';
135
+ /**
136
+ * AgentContextConfig is defined on the Agent to configure how context is managed
137
+ */
138
+ interface AgentContextConfig {
139
+ /**
140
+ * Base schema - defines the expected shape of accumulated context
141
+ */
142
+ schema: any;
143
+ /**
144
+ * Default/initial values when context is created
145
+ */
146
+ defaultVariables?: {
147
+ [key: string]: any;
148
+ };
149
+ /**
150
+ * Whether to extend schema at runtime when new keys appear
151
+ */
152
+ allowSchemaExtension: boolean;
153
+ }
154
+ /**
155
+ * Constants for size management
156
+ */
157
+ declare const MaxExecutions = 100;
158
+ /**
159
+ * Constants for size management
160
+ */
161
+ declare const ExecutionTTLHours = 72;
162
+ /**
163
+ * ExecutionPlan represents a planned sequence of tool executions
164
+ * that requires user approval before execution.
165
+ */
166
+ interface ExecutionPlan {
167
+ /**
168
+ * Identity
169
+ */
170
+ id: string;
171
+ chatKey: string;
172
+ agentId: string;
173
+ orgId: string;
174
+ /**
175
+ * Plan metadata
176
+ */
177
+ title: string;
178
+ description: string;
179
+ createdAt: number;
180
+ /**
181
+ * Planned steps
182
+ */
183
+ steps: PlannedStep[];
184
+ /**
185
+ * Status tracking
186
+ */
187
+ status: PlanStatusTS;
188
+ approvedAt?: number;
189
+ approvedBy?: string;
190
+ rejectedAt?: number;
191
+ rejectionReason?: string;
192
+ /**
193
+ * Execution tracking (populated after approval)
194
+ */
195
+ executionStartedAt?: number;
196
+ executionCompletedAt?: number;
197
+ currentStepIndex: number;
198
+ }
199
+ /**
200
+ * PlanStatus represents the status of an execution plan
201
+ */
202
+ type PlanStatus = string;
203
+ declare const PlanStatusPendingApproval: PlanStatus;
204
+ declare const PlanStatusApproved: PlanStatus;
205
+ declare const PlanStatusExecuting: PlanStatus;
206
+ declare const PlanStatusCompleted: PlanStatus;
207
+ declare const PlanStatusRejected: PlanStatus;
208
+ declare const PlanStatusCancelled: PlanStatus;
209
+ type PlanStatusTS = 'pending_approval' | 'approved' | 'executing' | 'completed' | 'rejected' | 'cancelled';
210
+ /**
211
+ * PlannedStep represents a single step in an execution plan
212
+ */
213
+ interface PlannedStep {
214
+ /**
215
+ * Identity
216
+ */
217
+ id: string;
218
+ order: number;
219
+ /**
220
+ * Tool information
221
+ */
222
+ toolName: string;
223
+ toolId?: string;
224
+ title: string;
225
+ description: string;
226
+ icon?: string;
227
+ /**
228
+ * Planned input (may reference outputs from previous steps)
229
+ */
230
+ plannedInput: {
231
+ [key: string]: any;
232
+ };
233
+ /**
234
+ * Dependencies (step IDs that must complete before this one)
235
+ */
236
+ dependsOn?: string[];
237
+ /**
238
+ * Optional: user can toggle individual steps
239
+ */
240
+ enabled: boolean;
241
+ /**
242
+ * After execution (populated during/after execution)
243
+ */
244
+ status: ExecutionStatusTS;
245
+ output?: {
246
+ [key: string]: any;
247
+ };
248
+ error?: string;
249
+ startedAt?: number;
250
+ completedAt?: number;
251
+ }
252
+ /**
253
+ * PlanApprovalConfig configures when an agent requires plan approval
254
+ */
255
+ interface PlanApprovalConfig {
256
+ /**
257
+ * Always require approval for any multi-tool operation
258
+ */
259
+ alwaysRequire: boolean;
260
+ /**
261
+ * Require approval only for these tool names
262
+ */
263
+ requireForTools?: string[];
264
+ /**
265
+ * Require approval when estimated execution time exceeds threshold (seconds)
266
+ */
267
+ timeThresholdSeconds?: number;
268
+ /**
269
+ * Require approval when number of steps exceeds threshold
270
+ */
271
+ stepCountThreshold?: number;
272
+ /**
273
+ * Auto-approve if user has previously approved similar plans
274
+ */
275
+ allowAutoApprove: boolean;
276
+ }
277
+ /**
278
+ * CreateToolRequest represents a request to create a tool
279
+ */
280
+ interface CreateToolRequest {
281
+ orgId: string;
282
+ tool?: Tool;
283
+ }
284
+ /**
285
+ * UpdateToolRequest represents a request to update a tool
286
+ */
287
+ interface UpdateToolRequest {
288
+ orgId: string;
289
+ tool?: Tool;
290
+ }
291
+ /**
292
+ * GetToolRequest represents a request to get a tool
293
+ */
294
+ interface GetToolRequest {
295
+ orgId: string;
296
+ toolId: string;
297
+ }
298
+ /**
299
+ * DeleteToolRequest represents a request to delete a tool
300
+ */
301
+ interface DeleteToolRequest {
302
+ orgId: string;
303
+ toolId: string;
304
+ }
305
+ /**
306
+ * ListToolsRequest represents a request to list tools
307
+ */
308
+ interface ListToolsRequest {
309
+ orgId: string;
310
+ onlySystem?: boolean;
311
+ enabled?: boolean;
312
+ limit?: number;
313
+ offset?: number;
314
+ }
315
+ /**
316
+ * ToolResponse represents a response containing a tool
317
+ */
318
+ interface ToolResponse {
319
+ tool?: Tool;
320
+ metadata: any;
321
+ }
322
+ /**
323
+ * ToolsListResponse represents a response containing multiple tools
324
+ */
325
+ interface ToolsListResponse {
326
+ tools: Tool[];
327
+ total: number;
328
+ metadata: any;
329
+ }
330
+ /**
331
+ * CreateSubAgentRequest represents a request to create a sub-agent
332
+ */
333
+ interface CreateSubAgentRequest {
334
+ orgId: string;
335
+ subAgent?: SubAgent;
336
+ }
337
+ /**
338
+ * UpdateSubAgentRequest represents a request to update a sub-agent
339
+ */
340
+ interface UpdateSubAgentRequest {
341
+ orgId: string;
342
+ subAgent?: SubAgent;
343
+ }
344
+ /**
345
+ * GetSubAgentRequest represents a request to get a sub-agent
346
+ */
347
+ interface GetSubAgentRequest {
348
+ orgId: string;
349
+ subAgentId: string;
350
+ }
351
+ /**
352
+ * DeleteSubAgentRequest represents a request to delete a sub-agent
353
+ */
354
+ interface DeleteSubAgentRequest {
355
+ orgId: string;
356
+ subAgentId: string;
357
+ }
358
+ /**
359
+ * ListSubAgentsRequest represents a request to list sub-agents
360
+ */
361
+ interface ListSubAgentsRequest {
362
+ orgId: string;
363
+ onlySystem?: boolean;
364
+ enabled?: boolean;
365
+ limit?: number;
366
+ offset?: number;
367
+ }
368
+ /**
369
+ * SubAgentResponse represents a response containing a sub-agent
370
+ */
371
+ interface SubAgentResponse {
372
+ subAgent?: SubAgent;
373
+ metadata: any;
374
+ }
375
+ /**
376
+ * SubAgentsListResponse represents a response containing multiple sub-agents
377
+ */
378
+ interface SubAgentsListResponse {
379
+ subAgents: SubAgent[];
380
+ total: number;
381
+ metadata: any;
382
+ }
383
+ /**
384
+ * GetToolsByIDsRequest represents a request to get multiple tools by IDs
385
+ */
386
+ interface GetToolsByIDsRequest {
387
+ orgId: string;
388
+ toolIds: string[];
389
+ }
390
+ /**
391
+ * GetToolsByIDsResponse represents a response containing multiple tools
392
+ */
393
+ interface GetToolsByIDsResponse {
394
+ tools: Tool[];
395
+ metadata: any;
396
+ }
397
+ /**
398
+ * GetSubAgentsByIDsRequest represents a request to get multiple sub-agents by IDs
399
+ */
400
+ interface GetSubAgentsByIDsRequest {
401
+ orgId: string;
402
+ subAgentIds: string[];
403
+ }
404
+ /**
405
+ * GetSubAgentsByIDsResponse represents a response containing multiple sub-agents
406
+ */
407
+ interface GetSubAgentsByIDsResponse {
408
+ subAgents: SubAgent[];
409
+ metadata: any;
410
+ }
411
+ interface ExecuteToolRequest {
412
+ orgId: string;
413
+ tool?: AgentTool;
414
+ input: {
415
+ [key: string]: any;
416
+ };
417
+ metadata?: {
418
+ [key: string]: any;
419
+ };
420
+ context?: {
421
+ [key: string]: any;
422
+ };
423
+ chatKey?: string;
424
+ }
425
+ interface ExecuteToolResponse {
426
+ result: {
427
+ [key: string]: any;
428
+ };
429
+ metadata: any;
430
+ }
431
+ type AgentTypeTS = 'chat' | 'react';
432
+ type AgentSubTypeTS = 'chat' | 'react' | 'workflow' | 'document';
433
+ type AgentStatusTS = 'draft' | 'active' | 'inactive' | 'archived';
434
+ type AgentType = string;
435
+ declare const AgentTypeChat: AgentType;
436
+ declare const AgentTypeReact: AgentType;
437
+ type AgentSubType = string;
438
+ /**
439
+ * Agent SubTypes
440
+ */
441
+ declare const AgentSubTypeChat: AgentSubType;
442
+ /**
443
+ * Agent SubTypes
444
+ */
445
+ declare const AgentSubTypeReact: AgentSubType;
446
+ /**
447
+ * Agent SubTypes
448
+ */
449
+ declare const AgentSubTypeWorkflow: AgentSubType;
450
+ /**
451
+ * Agent SubTypes
452
+ */
453
+ declare const AgentSubTypeDocument: AgentSubType;
454
+ type AgentStatus = string;
455
+ declare const AgentStatusDraft: AgentStatus;
456
+ declare const AgentStatusActive: AgentStatus;
457
+ declare const AgentStatusInactive: AgentStatus;
458
+ declare const AgentStatusArchived: AgentStatus;
459
+ interface DefaultDefinitions {
460
+ agents: Agent[];
461
+ tools: Tool[];
462
+ subAgents: SubAgent[];
463
+ }
464
+ /**
465
+ * AgentTool represents an agent's configuration for a specific tool
466
+ * Includes denormalized tool information to avoid joins at runtime
467
+ */
468
+ interface AgentTool {
469
+ toolId: string;
470
+ toolName: string;
471
+ title?: string;
472
+ description?: string;
473
+ type?: string;
474
+ inputSchema?: JSONSchema;
475
+ outputSchema?: JSONSchema;
476
+ configSchema?: JSONSchema;
477
+ config?: {
478
+ [key: string]: any;
479
+ };
480
+ mergeConfig?: MergeConfig;
481
+ enabled: boolean;
482
+ isSystem?: boolean;
483
+ createdAt?: string;
484
+ updatedAt?: string;
485
+ order?: number;
486
+ }
487
+ /**
488
+ * Core agent entity - shared by both types
489
+ */
490
+ interface Agent {
491
+ id?: string;
492
+ orgId: string;
493
+ product: ProductNameTS;
494
+ type: AgentTypeTS;
495
+ subType: AgentSubTypeTS;
496
+ name: string;
497
+ title: string;
498
+ description?: string;
499
+ status: AgentStatusTS;
500
+ version: string;
501
+ /**
502
+ * === LLM CONFIG ===
503
+ */
504
+ provider: string;
505
+ model: string;
506
+ temperature: number;
507
+ maxTokens: number;
508
+ systemPrompt: string;
509
+ /**
510
+ * Shared metadata
511
+ */
512
+ tags?: string[];
513
+ isDefault: boolean;
514
+ isPublic: boolean;
515
+ /**
516
+ * === Tool and SubAgent References ===
517
+ */
518
+ tools?: AgentTool[];
519
+ subAgentIds?: string[];
520
+ /**
521
+ * === Essential Configs ===
522
+ */
523
+ csatConfig: CSATConfig;
524
+ handoffConfig: HandoffConfig;
525
+ /**
526
+ * === TYPE-SPECIFIC CORE CONFIG ===
527
+ */
528
+ reactConfig?: ReactAgentConfig;
529
+ /**
530
+ * === CROSS-CUTTING FEATURES (can be used by any agent type) ===
531
+ */
532
+ userSuggestedActionsConfig?: UserSuggestedActionsConfig;
533
+ /**
534
+ * === AGENT CONTEXT CONFIG ===
535
+ * Defines how AgentContext is initialized and managed for this agent
536
+ */
537
+ contextConfig?: AgentContextConfig;
538
+ /**
539
+ * === SCHEMA-DRIVEN AGENT CONFIG ===
540
+ * Use ConfigSchema to auto-generate UI and validate values in Config
541
+ */
542
+ configSchema: JSONSchema;
543
+ config?: {
544
+ [key: string]: any;
545
+ };
546
+ /**
547
+ * === UI DISPLAY CONFIG ===
548
+ */
549
+ iconName?: string;
550
+ capabilities?: string[];
551
+ samplePrompts?: string[];
552
+ /**
553
+ * === SHARED BEHAVIOR CONFIG ===
554
+ */
555
+ responseStyle?: string;
556
+ personalityTraits?: string[];
557
+ fallbackMessage?: string;
558
+ /**
559
+ * === SHARED PERFORMANCE CONFIG ===
560
+ */
561
+ responseDelay?: number;
562
+ maxConcurrency?: number;
563
+ sessionTimeout?: number;
564
+ /**
565
+ * Audit fields
566
+ */
567
+ createdAt: string;
568
+ updatedAt: string;
569
+ createdBy: string;
570
+ updatedBy: string;
571
+ metadata?: {
572
+ [key: string]: any;
573
+ };
574
+ }
575
+ /**
576
+ * Handoff Configuration
577
+ */
578
+ interface HandoffConfig {
579
+ enabled: boolean;
580
+ triggerKeywords: string[];
581
+ queueId?: string;
582
+ handoffMessage: string;
583
+ }
584
+ /**
585
+ * AgentFilters for filtering agents in list operations
586
+ */
587
+ interface AgentFilters {
588
+ product?: ProductNameTS;
589
+ type?: AgentType;
590
+ subType?: AgentSubType;
591
+ status?: AgentStatus;
592
+ isDefault?: boolean;
593
+ isPublic?: boolean;
594
+ tags?: string[];
595
+ limit?: number;
596
+ offset?: number;
597
+ }
598
+ /**
599
+ * AgentSummary is a lightweight representation of an agent for list views
600
+ * Contains essential display fields plus metadata needed for chat initialization
601
+ */
602
+ interface AgentSummary {
603
+ id: string;
604
+ name: string;
605
+ title: string;
606
+ description?: string;
607
+ iconName?: string;
608
+ type: AgentTypeTS;
609
+ status: AgentStatusTS;
610
+ isDefault: boolean;
611
+ isPublic: boolean;
612
+ capabilities?: string[];
613
+ samplePrompts?: string[];
614
+ metadata?: {
615
+ [key: string]: any;
616
+ };
617
+ }
618
+ /**
619
+ * Tool represents a tool that can be called by an agent
620
+ */
621
+ interface Tool {
622
+ id: string;
623
+ name: string;
624
+ title: string;
625
+ description: string;
626
+ type?: string;
627
+ inputSchema: JSONSchema;
628
+ outputSchema?: JSONSchema;
629
+ configSchema: JSONSchema;
630
+ config?: {
631
+ [key: string]: any;
632
+ };
633
+ mergeConfig?: MergeConfig;
634
+ enabled: boolean;
635
+ isSystem: boolean;
636
+ createdAt: string;
637
+ updatedAt: string;
638
+ }
639
+ /**
640
+ * ToolExecution represents the execution context for a tool
641
+ */
642
+ interface ToolExecution {
643
+ id: string;
644
+ title: string;
645
+ toolId: string;
646
+ toolName: string;
647
+ status: ToolExecutionStatusTS;
648
+ input: {
649
+ [key: string]: any;
650
+ };
651
+ result?: {
652
+ [key: string]: any;
653
+ };
654
+ error?: string;
655
+ context?: {
656
+ [key: string]: any;
657
+ };
658
+ startedAt: number;
659
+ completedAt?: number;
660
+ retryCount: number;
661
+ progress?: ToolExecutionProgress[];
662
+ }
663
+ interface ToolExecutionProgress {
664
+ status: ToolExecutionStatusTS;
665
+ timestamp: number;
666
+ message?: string;
667
+ error?: string;
668
+ metadata?: {
669
+ [key: string]: any;
670
+ };
671
+ }
672
+ /**
673
+ * ToolExecutionStatus represents the status of a tool execution
674
+ */
675
+ type ToolExecutionStatus = string;
676
+ declare const ToolExecutionStatusStarted: ToolExecutionStatus;
677
+ declare const ToolExecutionStatusExecuting: ToolExecutionStatus;
678
+ declare const ToolExecutionStatusCompleted: ToolExecutionStatus;
679
+ declare const ToolExecutionStatusFailed: ToolExecutionStatus;
680
+ declare const ToolExecutionStatusTimeout: ToolExecutionStatus;
681
+ declare const ToolExecutionStatusSkipped: ToolExecutionStatus;
682
+ /**
683
+ * SubAgent represents a sub-agent composed of tools
684
+ */
685
+ interface SubAgent {
686
+ id: string;
687
+ orgId: string;
688
+ name: string;
689
+ title: string;
690
+ description: string;
691
+ prompt: string;
692
+ toolIds: string[];
693
+ inputSchema: JSONSchema;
694
+ outputSchema: JSONSchema;
695
+ configSchema: JSONSchema;
696
+ config?: {
697
+ [key: string]: any;
698
+ };
699
+ version: string;
700
+ enabled: boolean;
701
+ isSystem: boolean;
702
+ createdAt: string;
703
+ updatedAt: string;
704
+ createdBy: string;
705
+ updatedBy: string;
706
+ }
707
+ /**
708
+ * AgentToolConfiguration represents how an agent uses tools
709
+ */
710
+ interface AgentToolConfiguration {
711
+ enabledTools: string[];
712
+ enabledSubAgents: string[];
713
+ toolConfigs: {
714
+ [key: string]: ToolConfig;
715
+ };
716
+ executionPolicy: ToolExecutionPolicy;
717
+ maxParallelCalls: number;
718
+ requireApproval: boolean;
719
+ }
720
+ /**
721
+ * ToolExecutionPolicy defines how tools are executed
722
+ */
723
+ interface ToolExecutionPolicy {
724
+ mode: ExecutionModeTS;
725
+ maxIterations: number;
726
+ stopOnError: boolean;
727
+ retryOnFailure: boolean;
728
+ timeoutSeconds: number;
729
+ }
730
+ /**
731
+ * ExecutionMode defines how tools are executed
732
+ */
733
+ type ExecutionMode = string;
734
+ declare const ExecutionModeSync: ExecutionMode;
735
+ declare const ExecutionModeAsync: ExecutionMode;
736
+ declare const ExecutionModeAsyncClient: ExecutionMode;
737
+ /**
738
+ * CreateExecutionPlanRequest represents a request to create an execution plan
739
+ */
740
+ interface CreateExecutionPlanRequest {
741
+ agentInstanceId: string;
742
+ orgId: string;
743
+ input: string;
744
+ context?: {
745
+ [key: string]: any;
746
+ };
747
+ availableTools: Tool[];
748
+ }
749
+ /**
750
+ * CreateExecutionPlanResponse represents the response with an execution plan
751
+ */
752
+ interface CreateExecutionPlanResponse {
753
+ agentInstanceId: string;
754
+ executionPlan: ToolExecution[];
755
+ estimatedTime?: any;
756
+ }
757
+ /**
758
+ * ExecutePlanRequest represents a request to execute the plan
759
+ */
760
+ interface ExecutePlanRequest {
761
+ agentInstanceId: string;
762
+ orgId: string;
763
+ approveAll?: boolean;
764
+ }
765
+ /**
766
+ * ExecutePlanResponse represents the response after executing the plan
767
+ */
768
+ interface ExecutePlanResponse {
769
+ stateId: string;
770
+ status: ToolExecutionStatusTS;
771
+ executedTools: ToolExecution[];
772
+ finalResult?: any;
773
+ errors?: string[];
774
+ }
775
+ type ToolExecutionStatusTS = 'pending' | 'executing' | 'completed' | 'failed' | 'timeout' | 'skipped';
776
+ type ExecutionModeTS = 'sync' | 'async' | 'asyncClient';
777
+ /**
778
+ * CSAT Configuration
779
+ */
780
+ interface CSATConfig {
781
+ enabled: boolean;
782
+ survey?: CSATSurvey;
783
+ }
784
+ interface CSATQuestion {
785
+ question: {
786
+ [key: string]: string;
787
+ };
788
+ showRating: boolean;
789
+ showComment: boolean;
790
+ }
791
+ interface CSATSurvey {
792
+ questions: CSATQuestion[];
793
+ timeThreshold: number;
794
+ closeOnResponse: boolean;
795
+ }
796
+ interface CSATAnswer {
797
+ question: string;
798
+ lang?: string;
799
+ rating?: number;
800
+ comment?: string;
801
+ }
802
+ interface CSATResponse {
803
+ answers: CSATAnswer[];
804
+ submittedAt: number;
805
+ overallRating: number;
806
+ }
807
+ /**
808
+ * ReAct Agent Configuration
809
+ */
810
+ interface ReactAgentConfig {
811
+ /**
812
+ * Core ReAct Configuration
813
+ */
814
+ maxIterations: number;
815
+ reasoningPrompt: string;
816
+ stopConditions: string[];
817
+ availableTools: string[];
818
+ requireConfirmation: boolean;
819
+ /**
820
+ * LLM Configuration
821
+ */
822
+ model: string;
823
+ temperature: number;
824
+ maxTokens: number;
825
+ provider: string;
826
+ /**
827
+ * Context Management
828
+ */
829
+ maxContextLength: number;
830
+ memoryRetention: number;
831
+ compressionStrategy: string;
832
+ /**
833
+ * Tool Configuration
834
+ */
835
+ toolConfigs?: {
836
+ [key: string]: ToolConfig;
837
+ };
838
+ mcpServers?: MCPServerConfig[];
839
+ /**
840
+ * Execution Configuration
841
+ */
842
+ timeoutMinutes: number;
843
+ retryAttempts: number;
844
+ parallelExecution: boolean;
845
+ /**
846
+ * Safety Configuration
847
+ */
848
+ dangerousOperations?: string[];
849
+ allowedFileTypes?: string[];
850
+ restrictedPaths?: string[];
851
+ }
852
+ interface ToolConfig {
853
+ enabled: boolean;
854
+ timeoutSeconds: number;
855
+ retryPolicy: RetryPolicy;
856
+ configuration?: {
857
+ [key: string]: any;
858
+ };
859
+ }
860
+ interface RetryPolicy {
861
+ maxAttempts: number;
862
+ backoffStrategy: string;
863
+ backoffDelay: any;
864
+ }
865
+ interface MCPServerConfig {
866
+ name: string;
867
+ endpoint: string;
868
+ trusted: boolean;
869
+ timeout: number;
870
+ credentials?: {
871
+ [key: string]: string;
872
+ };
873
+ }
874
+ interface CreateAgentRequest {
875
+ agent?: Agent;
876
+ orgId: string;
877
+ }
878
+ interface AgentResponse {
879
+ agent?: Agent;
880
+ metadata: any;
881
+ }
882
+ interface GetAgentRequest {
883
+ id?: string;
884
+ name?: string;
885
+ orgId: string;
886
+ }
887
+ interface UpdateAgentRequest {
888
+ agent: Agent;
889
+ orgId: string;
890
+ }
891
+ interface DeleteAgentRequest {
892
+ id: string;
893
+ orgId: string;
894
+ }
895
+ interface ListAgentsRequest {
896
+ orgId: string;
897
+ filters?: AgentFilters;
898
+ }
899
+ interface ListAgentsResponse {
900
+ agents: Agent[];
901
+ metadata: any;
902
+ }
903
+ /**
904
+ * ListAgentsSummaryRequest requests a lightweight list of agents
905
+ */
906
+ interface ListAgentsSummaryRequest {
907
+ orgId: string;
908
+ filters?: AgentFilters;
909
+ }
910
+ /**
911
+ * ListAgentsSummaryResponse returns lightweight agent summaries for list views
912
+ */
913
+ interface ListAgentsSummaryResponse {
914
+ agents: AgentSummary[];
915
+ metadata: any;
916
+ }
917
+ interface GetDefaultAgentRequest {
918
+ orgId: string;
919
+ agentType: AgentType;
920
+ }
921
+ interface UpdateOrgAgentsRequest {
922
+ orgId: string;
923
+ defaultDefinitions?: DefaultDefinitions;
924
+ }
925
+ interface UpdateOrgAgentsResponse {
926
+ toolsCreated: number;
927
+ subAgentsCreated: number;
928
+ agentsCreated: number;
929
+ metadata: ResponseMetadata;
930
+ }
931
+ /**
932
+ * Core Agent Operations
933
+ */
934
+ declare const AgentCreateSubject = "agent.create";
935
+ /**
936
+ * Core Agent Operations
937
+ */
938
+ declare const AgentCreatedSubject = "agent.created";
939
+ /**
940
+ * Core Agent Operations
941
+ */
942
+ declare const AgentGetSubject = "agent.get";
943
+ /**
944
+ * Core Agent Operations
945
+ */
946
+ declare const AgentUpdateSubject = "agent.update";
947
+ /**
948
+ * Core Agent Operations
949
+ */
950
+ declare const AgentUpdatedSubject = "agent.updated";
951
+ /**
952
+ * Core Agent Operations
953
+ */
954
+ declare const AgentDeleteSubject = "agent.delete";
955
+ /**
956
+ * Core Agent Operations
957
+ */
958
+ declare const AgentDeletedSubject = "agent.deleted";
959
+ /**
960
+ * Core Agent Operations
961
+ */
962
+ declare const AgentListSubject = "agent.list";
963
+ /**
964
+ * Core Agent Operations
965
+ */
966
+ declare const AgentListSummarySubject = "agent.list.summary";
967
+ /**
968
+ * Core Agent Operations
969
+ */
970
+ declare const AgentSearchSubject = "agent.search";
971
+ /**
972
+ * Agent Type Specific Operations
973
+ */
974
+ declare const AgentChatCreateSubject = "agent.chat.create";
975
+ /**
976
+ * Agent Type Specific Operations
977
+ */
978
+ declare const AgentChatUpdateSubject = "agent.chat.update";
979
+ /**
980
+ * Agent Type Specific Operations
981
+ */
982
+ declare const AgentChatGetSubject = "agent.chat.get";
983
+ /**
984
+ * Agent Type Specific Operations
985
+ */
986
+ declare const AgentChatValidateSubject = "agent.chat.validate";
987
+ /**
988
+ * Agent Type Specific Operations
989
+ */
990
+ declare const AgentReactCreateSubject = "agent.react.create";
991
+ /**
992
+ * Agent Type Specific Operations
993
+ */
994
+ declare const AgentReactUpdateSubject = "agent.react.update";
995
+ /**
996
+ * Agent Type Specific Operations
997
+ */
998
+ declare const AgentReactGetSubject = "agent.react.get";
999
+ /**
1000
+ * Agent Type Specific Operations
1001
+ */
1002
+ declare const AgentReactValidateSubject = "agent.react.validate";
1003
+ /**
1004
+ * Execution Coordination
1005
+ */
1006
+ declare const AgentExecuteSubject = "agent.execute";
1007
+ /**
1008
+ * Execution Coordination
1009
+ */
1010
+ declare const AgentExecuteStatusSubject = "agent.execute.status";
1011
+ /**
1012
+ * Execution Coordination
1013
+ */
1014
+ declare const AgentExecuteStopSubject = "agent.execute.stop";
1015
+ /**
1016
+ * Version Management
1017
+ */
1018
+ declare const AgentVersionCreateSubject = "agent.version.create";
1019
+ /**
1020
+ * Version Management
1021
+ */
1022
+ declare const AgentVersionCreatedSubject = "agent.version.created";
1023
+ /**
1024
+ * Version Management
1025
+ */
1026
+ declare const AgentVersionGetSubject = "agent.version.get";
1027
+ /**
1028
+ * Version Management
1029
+ */
1030
+ declare const AgentVersionListSubject = "agent.version.list";
1031
+ /**
1032
+ * Version Management
1033
+ */
1034
+ declare const AgentVersionActivateSubject = "agent.version.activate";
1035
+ /**
1036
+ * Version Management
1037
+ */
1038
+ declare const AgentVersionActivatedSubject = "agent.version.activated";
1039
+ /**
1040
+ * Default Agent Management
1041
+ */
1042
+ declare const AgentEnsureDefaultSubject = "agent.ensure-default";
1043
+ /**
1044
+ * Default Agent Management
1045
+ */
1046
+ declare const AgentGetDefaultSubject = "agent.get-default";
1047
+ /**
1048
+ * Organization Management
1049
+ */
1050
+ declare const AgentGetByOrgSubject = "agent.get-by-org";
1051
+ /**
1052
+ * Organization Management
1053
+ */
1054
+ declare const AgentCloneSubject = "agent.clone";
1055
+ /**
1056
+ * Organization Management
1057
+ */
1058
+ declare const AgentExportSubject = "agent.export";
1059
+ /**
1060
+ * Organization Management
1061
+ */
1062
+ declare const AgentImportSubject = "agent.import";
1063
+ /**
1064
+ * Organization Management
1065
+ */
1066
+ declare const AgentUpdateOrgSubject = "agent.update-org-agents";
1067
+ /**
1068
+ * Configuration Templates
1069
+ */
1070
+ declare const AgentTemplateListSubject = "agent.template.list";
1071
+ /**
1072
+ * Configuration Templates
1073
+ */
1074
+ declare const AgentTemplateGetSubject = "agent.template.get";
1075
+ /**
1076
+ * Configuration Templates
1077
+ */
1078
+ declare const AgentFromTemplateSubject = "agent.from-template";
1079
+ /**
1080
+ * Chat Service Integration
1081
+ */
1082
+ declare const ChatAgentExecuteSubject = "chat.agent.execute";
1083
+ /**
1084
+ * Execution Service Integration
1085
+ */
1086
+ declare const ChatAgentStatusSubject = "chat.agent.status";
1087
+ /**
1088
+ * ReAct Service Integration
1089
+ */
1090
+ declare const ReactAgentExecuteSubject = "react.agent.execute";
1091
+ /**
1092
+ * Execution Service Integration
1093
+ */
1094
+ declare const ReactAgentStatusSubject = "react.agent.status";
1095
+ /**
1096
+ * Execution Service Integration
1097
+ */
1098
+ declare const ReactAgentStopSubject = "react.agent.stop";
1099
+ /**
1100
+ * Workflow Service Integration
1101
+ */
1102
+ declare const WorkflowAgentGetSubject = "workflow.agent.get";
1103
+ /**
1104
+ * Execution Service Integration
1105
+ */
1106
+ declare const WorkflowAgentUpdateSubject = "workflow.agent.update";
1107
+ /**
1108
+ * Tools Management
1109
+ */
1110
+ declare const ToolsCreateSubject = "agents.tools.create";
1111
+ /**
1112
+ * Tools Management
1113
+ */
1114
+ declare const ToolsCreatedSubject = "agents.tools.created";
1115
+ /**
1116
+ * Tools Management
1117
+ */
1118
+ declare const ToolsGetSubject = "agents.tools.get";
1119
+ /**
1120
+ * Tools Management
1121
+ */
1122
+ declare const ToolsUpdateSubject = "agents.tools.update";
1123
+ /**
1124
+ * Tools Management
1125
+ */
1126
+ declare const ToolsUpdatedSubject = "agents.tools.updated";
1127
+ /**
1128
+ * Tools Management
1129
+ */
1130
+ declare const ToolsDeleteSubject = "agents.tools.delete";
1131
+ /**
1132
+ * Tools Management
1133
+ */
1134
+ declare const ToolsDeletedSubject = "agents.tools.deleted";
1135
+ /**
1136
+ * Tools Management
1137
+ */
1138
+ declare const ToolsListSubject = "agents.tools.list";
1139
+ /**
1140
+ * Tools Management
1141
+ */
1142
+ declare const ToolsGetByIDsSubject = "agents.tools.get-by-ids";
1143
+ /**
1144
+ * Tools Management
1145
+ */
1146
+ declare const ToolsExecuteSubject = "agents.tools.execute";
1147
+ /**
1148
+ * Tools Management
1149
+ */
1150
+ declare const ToolsValidateSubject = "agents.tools.validate";
1151
+ /**
1152
+ * SubAgents Management
1153
+ */
1154
+ declare const SubAgentsCreateSubject = "agents.subagents.create";
1155
+ /**
1156
+ * SubAgents Management
1157
+ */
1158
+ declare const SubAgentsCreatedSubject = "agents.subagents.created";
1159
+ /**
1160
+ * SubAgents Management
1161
+ */
1162
+ declare const SubAgentsGetSubject = "agents.subagents.get";
1163
+ /**
1164
+ * SubAgents Management
1165
+ */
1166
+ declare const SubAgentsUpdateSubject = "agents.subagents.update";
1167
+ /**
1168
+ * SubAgents Management
1169
+ */
1170
+ declare const SubAgentsUpdatedSubject = "agents.subagents.updated";
1171
+ /**
1172
+ * SubAgents Management
1173
+ */
1174
+ declare const SubAgentsDeleteSubject = "agents.subagents.delete";
1175
+ /**
1176
+ * SubAgents Management
1177
+ */
1178
+ declare const SubAgentsDeletedSubject = "agents.subagents.deleted";
1179
+ /**
1180
+ * SubAgents Management
1181
+ */
1182
+ declare const SubAgentsListSubject = "agents.subagents.list";
1183
+ /**
1184
+ * SubAgents Management
1185
+ */
1186
+ declare const SubAgentsGetByIDsSubject = "agents.subagents.get-by-ids";
1187
+ /**
1188
+ * SubAgents Management
1189
+ */
1190
+ declare const SubAgentsExecuteSubject = "agents.subagents.execute";
1191
+ /**
1192
+ * SubAgents Management
1193
+ */
1194
+ declare const SubAgentsValidateSubject = "agents.subagents.validate";
1195
+ /**
1196
+ * Agent Instance Management
1197
+ */
1198
+ declare const AgentInstanceCreateSubject = "agents.instance.create";
1199
+ /**
1200
+ * Agent Instance Management
1201
+ */
1202
+ declare const AgentInstanceCreatedSubject = "agents.instance.created";
1203
+ /**
1204
+ * Agent Instance Management
1205
+ */
1206
+ declare const AgentInstanceGetSubject = "agents.instance.get";
1207
+ /**
1208
+ * Agent Instance Management
1209
+ */
1210
+ declare const AgentInstanceUpdateSubject = "agents.instance.update";
1211
+ /**
1212
+ * Agent Instance Management
1213
+ */
1214
+ declare const AgentInstanceUpdatedSubject = "agents.instance.updated";
1215
+ /**
1216
+ * Agent Instance Management
1217
+ */
1218
+ declare const AgentInstanceListSubject = "agents.instance.list";
1219
+ /**
1220
+ * Agent Instance Management
1221
+ */
1222
+ declare const AgentInstanceDeleteSubject = "agents.instance.delete";
1223
+ /**
1224
+ * Agent Instance Management
1225
+ */
1226
+ declare const AgentInstanceDeletedSubject = "agents.instance.deleted";
1227
+ /**
1228
+ * Execution Plan Operations
1229
+ */
1230
+ declare const AgentInstanceCreatePlanSubject = "agents.instance.create-plan";
1231
+ /**
1232
+ * Agent Instance Management
1233
+ */
1234
+ declare const AgentInstanceExecutePlanSubject = "agents.instance.execute-plan";
1235
+ /**
1236
+ * Agent Instance Management
1237
+ */
1238
+ declare const AgentInstancePausePlanSubject = "agents.instance.pause-plan";
1239
+ /**
1240
+ * Agent Instance Management
1241
+ */
1242
+ declare const AgentInstanceResumePlanSubject = "agents.instance.resume-plan";
1243
+ /**
1244
+ * Agent Instance Management
1245
+ */
1246
+ declare const AgentInstanceCancelPlanSubject = "agents.instance.cancel-plan";
1247
+ /**
1248
+ * Execution History
1249
+ */
1250
+ declare const AgentInstanceGetHistorySubject = "agents.instance.get-history";
1251
+ /**
1252
+ * Agent Instance Management
1253
+ */
1254
+ declare const AgentInstanceClearHistorySubject = "agents.instance.clear-history";
1255
+ /**
1256
+ * Config and request models for product service integration
1257
+ */
1258
+ interface UserSuggestedActionsConfig {
1259
+ enabled: boolean;
1260
+ actionTypes: string[];
1261
+ maxActions: number;
1262
+ cooldownSeconds: number;
1263
+ }
1264
+ interface UserSuggestedAction {
1265
+ title: string;
1266
+ actionType: string;
1267
+ input?: string;
1268
+ priority?: number;
1269
+ metadata?: {
1270
+ [key: string]: any;
1271
+ };
1272
+ }
1273
+ interface UserSuggestedActionsRequest {
1274
+ orgId: string;
1275
+ chatKey: string;
1276
+ config: UserSuggestedActionsConfig;
1277
+ metadata?: {
1278
+ [key: string]: any;
1279
+ };
1280
+ }
1281
+ interface UserSuggestedActionsResponse {
1282
+ actions: UserSuggestedAction[];
1283
+ metadata: any;
1284
+ }
1285
+ /**
1286
+ * ValidationError represents a validation error with field and message
1287
+ */
1288
+ interface ValidationError {
1289
+ field: string;
1290
+ message: string;
1291
+ }
1292
+ /**
1293
+ * ValidationErrors represents a collection of validation errors
1294
+ */
1295
+ type ValidationErrors = ValidationError[];
1296
+
1297
+ export { type Agent, AgentChatCreateSubject, AgentChatGetSubject, AgentChatUpdateSubject, AgentChatValidateSubject, AgentCloneSubject, type AgentContext, type AgentContextConfig, AgentCreateSubject, AgentCreatedSubject, AgentDeleteSubject, AgentDeletedSubject, AgentEnsureDefaultSubject, AgentExecuteStatusSubject, AgentExecuteStopSubject, AgentExecuteSubject, type AgentExecution, AgentExportSubject, type AgentFilters, AgentFromTemplateSubject, AgentGetByOrgSubject, AgentGetDefaultSubject, AgentGetSubject, AgentImportSubject, AgentInstanceCancelPlanSubject, AgentInstanceClearHistorySubject, AgentInstanceCreatePlanSubject, AgentInstanceCreateSubject, AgentInstanceCreatedSubject, AgentInstanceDeleteSubject, AgentInstanceDeletedSubject, AgentInstanceExecutePlanSubject, AgentInstanceGetHistorySubject, AgentInstanceGetSubject, AgentInstanceListSubject, AgentInstancePausePlanSubject, AgentInstanceResumePlanSubject, AgentInstanceUpdateSubject, AgentInstanceUpdatedSubject, AgentListSubject, AgentListSummarySubject, AgentReactCreateSubject, AgentReactGetSubject, AgentReactUpdateSubject, AgentReactValidateSubject, type AgentResponse, AgentSearchSubject, type AgentStatus, AgentStatusActive, AgentStatusArchived, AgentStatusDraft, AgentStatusInactive, type AgentStatusTS, type AgentSubType, AgentSubTypeChat, AgentSubTypeDocument, AgentSubTypeReact, type AgentSubTypeTS, AgentSubTypeWorkflow, type AgentSummary, AgentTemplateGetSubject, AgentTemplateListSubject, type AgentTool, type AgentToolConfiguration, type AgentType, AgentTypeChat, AgentTypeReact, type AgentTypeTS, AgentUpdateOrgSubject, AgentUpdateSubject, AgentUpdatedSubject, AgentVersionActivateSubject, AgentVersionActivatedSubject, AgentVersionCreateSubject, AgentVersionCreatedSubject, AgentVersionGetSubject, AgentVersionListSubject, type CSATAnswer, type CSATConfig, type CSATQuestion, type CSATResponse, type CSATSurvey, ChatAgentExecuteSubject, ChatAgentStatusSubject, type CreateAgentRequest, type CreateExecutionPlanRequest, type CreateExecutionPlanResponse, type CreateSubAgentRequest, type CreateToolRequest, type DefaultDefinitions, type DeleteAgentRequest, type DeleteSubAgentRequest, type DeleteToolRequest, type ExecutePlanRequest, type ExecutePlanResponse, type ExecuteToolRequest, type ExecuteToolResponse, type ExecutionMode, ExecutionModeAsync, ExecutionModeAsyncClient, ExecutionModeSync, type ExecutionModeTS, type ExecutionPlan, type ExecutionStatus, ExecutionStatusCompleted, ExecutionStatusFailed, ExecutionStatusPending, ExecutionStatusRunning, ExecutionStatusSkipped, type ExecutionStatusTS, ExecutionTTLHours, type GetAgentRequest, type GetDefaultAgentRequest, type GetSubAgentRequest, type GetSubAgentsByIDsRequest, type GetSubAgentsByIDsResponse, type GetToolRequest, type GetToolsByIDsRequest, type GetToolsByIDsResponse, type HandoffConfig, type ListAgentsRequest, type ListAgentsResponse, type ListAgentsSummaryRequest, type ListAgentsSummaryResponse, type ListSubAgentsRequest, type ListToolsRequest, type MCPServerConfig, MaxExecutions, type MergeConfig, type MergeStrategy, MergeStrategyAppend, MergeStrategyMerge, MergeStrategyReplace, type MergeStrategyTS, type PlanApprovalConfig, type PlanStatus, PlanStatusApproved, PlanStatusCancelled, PlanStatusCompleted, PlanStatusExecuting, PlanStatusPendingApproval, PlanStatusRejected, type PlanStatusTS, type PlannedStep, type ReactAgentConfig, ReactAgentExecuteSubject, ReactAgentStatusSubject, ReactAgentStopSubject, type RetryPolicy, type SubAgent, type SubAgentResponse, SubAgentsCreateSubject, SubAgentsCreatedSubject, SubAgentsDeleteSubject, SubAgentsDeletedSubject, SubAgentsExecuteSubject, SubAgentsGetByIDsSubject, SubAgentsGetSubject, type SubAgentsListResponse, SubAgentsListSubject, SubAgentsUpdateSubject, SubAgentsUpdatedSubject, SubAgentsValidateSubject, type Tool, type ToolConfig, type ToolExecution, type ToolExecutionPolicy, type ToolExecutionProgress, type ToolExecutionStatus, ToolExecutionStatusCompleted, ToolExecutionStatusExecuting, ToolExecutionStatusFailed, ToolExecutionStatusSkipped, ToolExecutionStatusStarted, type ToolExecutionStatusTS, ToolExecutionStatusTimeout, type ToolResponse, ToolsCreateSubject, ToolsCreatedSubject, ToolsDeleteSubject, ToolsDeletedSubject, ToolsExecuteSubject, ToolsGetByIDsSubject, ToolsGetSubject, type ToolsListResponse, ToolsListSubject, ToolsUpdateSubject, ToolsUpdatedSubject, ToolsValidateSubject, type UpdateAgentRequest, type UpdateOrgAgentsRequest, type UpdateOrgAgentsResponse, type UpdateSubAgentRequest, type UpdateToolRequest, type UserSuggestedAction, type UserSuggestedActionsConfig, type UserSuggestedActionsRequest, type UserSuggestedActionsResponse, type ValidationError, type ValidationErrors, WorkflowAgentGetSubject, WorkflowAgentUpdateSubject };