@codebolt/agent 5.0.8 → 5.0.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (114) hide show
  1. package/dist/unified/base/responseExecutor.js +10 -6
  2. package/package.json +5 -5
  3. package/dist/agent.d.ts +0 -86
  4. package/dist/agent.js +0 -324
  5. package/dist/builderpattern/agent.d.ts +0 -86
  6. package/dist/builderpattern/agent.js +0 -324
  7. package/dist/builderpattern/followupquestionbuilder.d.ts +0 -75
  8. package/dist/builderpattern/followupquestionbuilder.js +0 -197
  9. package/dist/builderpattern/index.d.ts +0 -14
  10. package/dist/builderpattern/index.js +0 -23
  11. package/dist/builderpattern/llmoutputhandler.d.ts +0 -102
  12. package/dist/builderpattern/llmoutputhandler.js +0 -452
  13. package/dist/builderpattern/promptbuilder.d.ts +0 -382
  14. package/dist/builderpattern/promptbuilder.js +0 -805
  15. package/dist/builderpattern/systemprompt.d.ts +0 -20
  16. package/dist/builderpattern/systemprompt.js +0 -48
  17. package/dist/builderpattern/taskInstruction.d.ts +0 -37
  18. package/dist/builderpattern/taskInstruction.js +0 -57
  19. package/dist/builderpattern/usermessage.d.ts +0 -70
  20. package/dist/builderpattern/usermessage.js +0 -123
  21. package/dist/composablepattern/agent.d.ts +0 -169
  22. package/dist/composablepattern/agent.js +0 -598
  23. package/dist/composablepattern/codebolt-storage.d.ts +0 -67
  24. package/dist/composablepattern/codebolt-storage.js +0 -320
  25. package/dist/composablepattern/document.d.ts +0 -149
  26. package/dist/composablepattern/document.js +0 -405
  27. package/dist/composablepattern/examples/codebolt-integration-example.d.ts +0 -12
  28. package/dist/composablepattern/examples/codebolt-integration-example.js +0 -218
  29. package/dist/composablepattern/examples/codebolt-storage-example.d.ts +0 -40
  30. package/dist/composablepattern/examples/codebolt-storage-example.js +0 -223
  31. package/dist/composablepattern/examples/custom-steps-example.d.ts +0 -20
  32. package/dist/composablepattern/examples/custom-steps-example.js +0 -455
  33. package/dist/composablepattern/examples/document-agent.d.ts +0 -17
  34. package/dist/composablepattern/examples/document-agent.js +0 -107
  35. package/dist/composablepattern/examples/simple-codebolt-integration.d.ts +0 -8
  36. package/dist/composablepattern/examples/simple-codebolt-integration.js +0 -164
  37. package/dist/composablepattern/examples/weather-agent.d.ts +0 -18
  38. package/dist/composablepattern/examples/weather-agent.js +0 -86
  39. package/dist/composablepattern/examples/workflow-example.d.ts +0 -12
  40. package/dist/composablepattern/examples/workflow-example.js +0 -463
  41. package/dist/composablepattern/index.d.ts +0 -63
  42. package/dist/composablepattern/index.js +0 -115
  43. package/dist/composablepattern/memory.d.ts +0 -89
  44. package/dist/composablepattern/memory.js +0 -141
  45. package/dist/composablepattern/tool.d.ts +0 -84
  46. package/dist/composablepattern/tool.js +0 -260
  47. package/dist/composablepattern/types.d.ts +0 -194
  48. package/dist/composablepattern/types.js +0 -6
  49. package/dist/composablepattern/user-context.d.ts +0 -214
  50. package/dist/composablepattern/user-context.js +0 -275
  51. package/dist/composablepattern/workflow.d.ts +0 -388
  52. package/dist/composablepattern/workflow.js +0 -562
  53. package/dist/followupquestionbuilder.d.ts +0 -75
  54. package/dist/followupquestionbuilder.js +0 -197
  55. package/dist/index.d.ts +0 -14
  56. package/dist/index.js +0 -23
  57. package/dist/llmoutputhandler.d.ts +0 -102
  58. package/dist/llmoutputhandler.js +0 -452
  59. package/dist/processor/agent/agentStep.d.ts +0 -49
  60. package/dist/processor/agent/agentStep.js +0 -241
  61. package/dist/processor/agent/toolExecutor.d.ts +0 -19
  62. package/dist/processor/agent/toolExecutor.js +0 -90
  63. package/dist/processor/index.d.ts +0 -7
  64. package/dist/processor/index.js +0 -36
  65. package/dist/processor/messageModifiers/baseMessageModifier.d.ts +0 -20
  66. package/dist/processor/messageModifiers/baseMessageModifier.js +0 -55
  67. package/dist/processor/processors/baseProcessor.d.ts +0 -14
  68. package/dist/processor/processors/baseProcessor.js +0 -29
  69. package/dist/processor/tools/baseTool.d.ts +0 -10
  70. package/dist/processor/tools/baseTool.js +0 -20
  71. package/dist/processor/tools/toolList.d.ts +0 -9
  72. package/dist/processor/tools/toolList.js +0 -22
  73. package/dist/processor/types/interfaces.d.ts +0 -94
  74. package/dist/processor/types/interfaces.js +0 -2
  75. package/dist/processor-pieces/messageModifiers/addToolsListMessageModifier.d.ts +0 -22
  76. package/dist/processor-pieces/messageModifiers/addToolsListMessageModifier.js +0 -144
  77. package/dist/processor-pieces/messageModifiers/baseContextMessageModifier.d.ts +0 -15
  78. package/dist/processor-pieces/messageModifiers/baseContextMessageModifier.js +0 -75
  79. package/dist/processor-pieces/messageModifiers/baseSystemInstructionMessageModifier.d.ts +0 -11
  80. package/dist/processor-pieces/messageModifiers/baseSystemInstructionMessageModifier.js +0 -46
  81. package/dist/processor-pieces/messageModifiers/handleUrlMessageModifier.d.ts +0 -12
  82. package/dist/processor-pieces/messageModifiers/handleUrlMessageModifier.js +0 -60
  83. package/dist/processor-pieces/messageModifiers/imageAttachmentMessageModifier.d.ts +0 -18
  84. package/dist/processor-pieces/messageModifiers/imageAttachmentMessageModifier.js +0 -222
  85. package/dist/processor-pieces/messageModifiers/workingDirectoryMessageModifier.d.ts +0 -22
  86. package/dist/processor-pieces/messageModifiers/workingDirectoryMessageModifier.js +0 -194
  87. package/dist/processor-pieces/processors/advancedLoopDetectionProcessor.d.ts +0 -41
  88. package/dist/processor-pieces/processors/advancedLoopDetectionProcessor.js +0 -197
  89. package/dist/processor-pieces/processors/chatCompressionProcessor.d.ts +0 -26
  90. package/dist/processor-pieces/processors/chatCompressionProcessor.js +0 -90
  91. package/dist/processor-pieces/processors/chatRecordingProcessor.d.ts +0 -81
  92. package/dist/processor-pieces/processors/chatRecordingProcessor.js +0 -329
  93. package/dist/processor-pieces/processors/contextManagementProcessor.d.ts +0 -40
  94. package/dist/processor-pieces/processors/contextManagementProcessor.js +0 -305
  95. package/dist/processor-pieces/processors/loopDetectionProcessor.d.ts +0 -30
  96. package/dist/processor-pieces/processors/loopDetectionProcessor.js +0 -137
  97. package/dist/processor-pieces/processors/responseValidationProcessor.d.ts +0 -30
  98. package/dist/processor-pieces/processors/responseValidationProcessor.js +0 -228
  99. package/dist/processor-pieces/processors/telemetryProcessor.d.ts +0 -99
  100. package/dist/processor-pieces/processors/telemetryProcessor.js +0 -311
  101. package/dist/processor-pieces/processors/tokenManagementProcessor.d.ts +0 -37
  102. package/dist/processor-pieces/processors/tokenManagementProcessor.js +0 -178
  103. package/dist/processor-pieces/processors/toolExecutionProcessor.d.ts +0 -43
  104. package/dist/processor-pieces/processors/toolExecutionProcessor.js +0 -207
  105. package/dist/processor-pieces/tools/fileTools.d.ts +0 -26
  106. package/dist/processor-pieces/tools/fileTools.js +0 -162
  107. package/dist/promptbuilder.d.ts +0 -382
  108. package/dist/promptbuilder.js +0 -805
  109. package/dist/systemprompt.d.ts +0 -20
  110. package/dist/systemprompt.js +0 -48
  111. package/dist/taskInstruction.d.ts +0 -37
  112. package/dist/taskInstruction.js +0 -57
  113. package/dist/usermessage.d.ts +0 -70
  114. package/dist/usermessage.js +0 -123
@@ -1,388 +0,0 @@
1
- /**
2
- * @fileoverview Workflow system for Composable Agent Pattern
3
- * @description Provides workflow orchestration for multi-step agent processes
4
- */
5
- import type { ComposableAgent } from './types';
6
- import { z } from 'zod';
7
- export interface WorkflowContext {
8
- /** Shared data between workflow steps */
9
- data: Record<string, any>;
10
- /** Execution history */
11
- history: WorkflowStepResult[];
12
- /** Current step index */
13
- currentStep: number;
14
- /** Workflow metadata */
15
- metadata: Record<string, any>;
16
- }
17
- export interface WorkflowStepResult {
18
- /** Step ID */
19
- stepId: string;
20
- /** Whether step succeeded */
21
- success: boolean;
22
- /** Step output data */
23
- output?: any;
24
- /** Error message if failed */
25
- error?: string;
26
- /** Step execution time */
27
- executionTime: number;
28
- /** Step metadata */
29
- metadata?: Record<string, any>;
30
- }
31
- export interface WorkflowStep {
32
- /** Unique step identifier */
33
- id: string;
34
- /** Human-readable step name */
35
- name: string;
36
- /** Step description */
37
- description?: string;
38
- /** Input schema validation */
39
- inputSchema?: z.ZodType;
40
- /** Output schema validation */
41
- outputSchema?: z.ZodType;
42
- /** Step execution function */
43
- execute: (context: WorkflowContext) => Promise<WorkflowStepResult>;
44
- /** Condition to determine if step should run */
45
- condition?: (context: WorkflowContext) => boolean | Promise<boolean>;
46
- /** Steps that must complete before this step */
47
- dependencies?: string[];
48
- /** Whether step can run in parallel */
49
- parallel?: boolean;
50
- /** Retry configuration */
51
- retry?: {
52
- maxAttempts: number;
53
- delay: number;
54
- backoff?: 'linear' | 'exponential';
55
- };
56
- }
57
- export interface WorkflowConfig {
58
- /** Workflow name */
59
- name: string;
60
- /** Workflow description */
61
- description?: string;
62
- /** Workflow steps */
63
- steps: WorkflowStep[];
64
- /** Initial context data */
65
- initialData?: Record<string, any>;
66
- /** Workflow timeout in milliseconds */
67
- timeout?: number;
68
- /** Whether to continue on step failure */
69
- continueOnError?: boolean;
70
- /** Maximum parallel steps */
71
- maxParallelSteps?: number;
72
- }
73
- export interface WorkflowResult {
74
- /** Whether workflow completed successfully */
75
- success: boolean;
76
- /** Final context data */
77
- data: Record<string, any>;
78
- /** All step results */
79
- stepResults: WorkflowStepResult[];
80
- /** Total execution time */
81
- executionTime: number;
82
- /** Error message if failed */
83
- error?: string;
84
- /** Workflow metadata */
85
- metadata: Record<string, any>;
86
- }
87
- /**
88
- * Agent step - executes a composable agent
89
- */
90
- export interface AgentStepConfig {
91
- /** Agent instance to execute */
92
- agent: ComposableAgent;
93
- /** Message template (can use context variables) */
94
- messageTemplate: string;
95
- /** Input mapping from context */
96
- inputMapping?: Record<string, string>;
97
- /** Output mapping to context */
98
- outputMapping?: Record<string, string>;
99
- }
100
- /**
101
- * Conditional step - executes different branches based on condition
102
- */
103
- export interface ConditionalStepConfig {
104
- /** Condition function */
105
- condition: (context: WorkflowContext) => boolean | Promise<boolean>;
106
- /** Steps to execute if condition is true */
107
- trueBranch: WorkflowStep[];
108
- /** Steps to execute if condition is false */
109
- falseBranch?: WorkflowStep[];
110
- }
111
- /**
112
- * Parallel step - executes multiple steps in parallel
113
- */
114
- export interface ParallelStepConfig {
115
- /** Steps to execute in parallel */
116
- steps: WorkflowStep[];
117
- /** Whether to wait for all steps to complete */
118
- waitForAll?: boolean;
119
- /** Maximum number of parallel executions */
120
- maxConcurrency?: number;
121
- }
122
- /**
123
- * Loop step - repeats steps while condition is true
124
- */
125
- export interface LoopStepConfig {
126
- /** Loop condition */
127
- condition: (context: WorkflowContext, iteration: number) => boolean | Promise<boolean>;
128
- /** Steps to repeat */
129
- steps: WorkflowStep[];
130
- /** Maximum iterations */
131
- maxIterations?: number;
132
- /** Current iteration variable name in context */
133
- iterationVariable?: string;
134
- }
135
- export declare class Workflow {
136
- private config;
137
- private context;
138
- constructor(config: WorkflowConfig);
139
- /**
140
- * Execute the workflow
141
- */
142
- execute(): Promise<WorkflowResult>;
143
- /**
144
- * Execute a list of steps
145
- */
146
- private executeSteps;
147
- /**
148
- * Execute parallel steps
149
- */
150
- private executeParallelSteps;
151
- /**
152
- * Execute a single step with retry logic
153
- */
154
- private executeStep;
155
- /**
156
- * Calculate retry delay with backoff
157
- */
158
- private calculateRetryDelay;
159
- /**
160
- * Split array into chunks
161
- */
162
- private chunkArray;
163
- /**
164
- * Get current workflow context
165
- */
166
- getContext(): WorkflowContext;
167
- /**
168
- * Update workflow context data
169
- */
170
- updateContext(data: Record<string, any>): void;
171
- }
172
- /**
173
- * Create an agent execution step
174
- */
175
- export declare function createAgentStep(config: AgentStepConfig & {
176
- id: string;
177
- name: string;
178
- }): WorkflowStep;
179
- /**
180
- * Create a data transformation step
181
- */
182
- export declare function createTransformStep(config: {
183
- id: string;
184
- name: string;
185
- transform: (data: any) => any | Promise<any>;
186
- inputSchema?: z.ZodType;
187
- outputSchema?: z.ZodType;
188
- }): WorkflowStep;
189
- /**
190
- * Create a conditional branch step
191
- */
192
- export declare function createConditionalStep(config: ConditionalStepConfig & {
193
- id: string;
194
- name: string;
195
- }): WorkflowStep;
196
- /**
197
- * Create a delay step
198
- */
199
- export declare function createDelayStep(config: {
200
- id: string;
201
- name: string;
202
- delay: number;
203
- }): WorkflowStep;
204
- /**
205
- * Create a simple custom step with your own logic
206
- *
207
- * @param config - Step configuration with custom execute function
208
- * @returns WorkflowStep
209
- *
210
- * @example
211
- * ```typescript
212
- * const customStep = createStep({
213
- * id: 'my-step',
214
- * name: 'My Custom Step',
215
- * description: 'Does something custom',
216
- * execute: async (context) => {
217
- * // Your custom logic here
218
- * const result = await doSomething(context.data);
219
- * return {
220
- * stepId: 'my-step',
221
- * success: true,
222
- * output: { customResult: result },
223
- * executionTime: 0
224
- * };
225
- * }
226
- * });
227
- * ```
228
- */
229
- export declare function createStep(config: {
230
- /** Unique step identifier */
231
- id: string;
232
- /** Human-readable step name */
233
- name: string;
234
- /** Step description */
235
- description?: string;
236
- /** Input schema validation */
237
- inputSchema?: z.ZodType;
238
- /** Output schema validation */
239
- outputSchema?: z.ZodType;
240
- /** Step execution function */
241
- execute: (context: WorkflowContext) => Promise<WorkflowStepResult>;
242
- /** Condition to determine if step should run */
243
- condition?: (context: WorkflowContext) => boolean | Promise<boolean>;
244
- /** Steps that must complete before this step */
245
- dependencies?: string[];
246
- /** Whether step can run in parallel */
247
- parallel?: boolean;
248
- /** Retry configuration */
249
- retry?: {
250
- maxAttempts: number;
251
- delay: number;
252
- backoff?: 'linear' | 'exponential';
253
- };
254
- }): WorkflowStep;
255
- /**
256
- * Create a simple step that executes a function with the context data
257
- *
258
- * @param config - Step configuration with transform function
259
- * @returns WorkflowStep
260
- *
261
- * @example
262
- * ```typescript
263
- * const mathStep = createSimpleStep({
264
- * id: 'calculate',
265
- * name: 'Calculate Total',
266
- * execute: (data) => {
267
- * const total = data.items.reduce((sum, item) => sum + item.price, 0);
268
- * return { total, itemCount: data.items.length };
269
- * }
270
- * });
271
- * ```
272
- */
273
- export declare function createSimpleStep(config: {
274
- /** Unique step identifier */
275
- id: string;
276
- /** Human-readable step name */
277
- name: string;
278
- /** Step description */
279
- description?: string;
280
- /** Input schema validation */
281
- inputSchema?: z.ZodType;
282
- /** Output schema validation */
283
- outputSchema?: z.ZodType;
284
- /** Simple execution function that takes data and returns output */
285
- execute: (data: any) => any | Promise<any>;
286
- /** Condition to determine if step should run */
287
- condition?: (context: WorkflowContext) => boolean | Promise<boolean>;
288
- /** Steps that must complete before this step */
289
- dependencies?: string[];
290
- /** Whether step can run in parallel */
291
- parallel?: boolean;
292
- /** Retry configuration */
293
- retry?: {
294
- maxAttempts: number;
295
- delay: number;
296
- backoff?: 'linear' | 'exponential';
297
- };
298
- }): WorkflowStep;
299
- /**
300
- * Create an async step that can perform asynchronous operations
301
- *
302
- * @param config - Step configuration with async function
303
- * @returns WorkflowStep
304
- *
305
- * @example
306
- * ```typescript
307
- * const apiStep = createAsyncStep({
308
- * id: 'fetch-data',
309
- * name: 'Fetch External Data',
310
- * execute: async (data) => {
311
- * const response = await fetch(`/api/data/${data.id}`);
312
- * const result = await response.json();
313
- * return { fetchedData: result };
314
- * },
315
- * retry: {
316
- * maxAttempts: 3,
317
- * delay: 1000,
318
- * backoff: 'exponential'
319
- * }
320
- * });
321
- * ```
322
- */
323
- export declare function createAsyncStep(config: {
324
- /** Unique step identifier */
325
- id: string;
326
- /** Human-readable step name */
327
- name: string;
328
- /** Step description */
329
- description?: string;
330
- /** Input schema validation */
331
- inputSchema?: z.ZodType;
332
- /** Output schema validation */
333
- outputSchema?: z.ZodType;
334
- /** Async execution function */
335
- execute: (data: any, context: WorkflowContext) => Promise<any>;
336
- /** Condition to determine if step should run */
337
- condition?: (context: WorkflowContext) => boolean | Promise<boolean>;
338
- /** Steps that must complete before this step */
339
- dependencies?: string[];
340
- /** Whether step can run in parallel */
341
- parallel?: boolean;
342
- /** Retry configuration */
343
- retry?: {
344
- maxAttempts: number;
345
- delay: number;
346
- backoff?: 'linear' | 'exponential';
347
- };
348
- }): WorkflowStep;
349
- /**
350
- * Create a validation step that validates data against a schema
351
- *
352
- * @param config - Validation configuration
353
- * @returns WorkflowStep
354
- */
355
- export declare function createValidationStep(config: {
356
- /** Unique step identifier */
357
- id: string;
358
- /** Human-readable step name */
359
- name: string;
360
- /** Schema to validate against */
361
- schema: z.ZodType;
362
- /** Field to validate (defaults to entire context data) */
363
- field?: string;
364
- /** Whether to stop workflow on validation failure */
365
- stopOnFailure?: boolean;
366
- }): WorkflowStep;
367
- /**
368
- * Create a logging step for debugging workflows
369
- *
370
- * @param config - Logging configuration
371
- * @returns WorkflowStep
372
- */
373
- export declare function createLoggingStep(config: {
374
- /** Unique step identifier */
375
- id: string;
376
- /** Human-readable step name */
377
- name: string;
378
- /** Log level */
379
- level?: 'debug' | 'info' | 'warn' | 'error';
380
- /** Custom message template */
381
- message?: string;
382
- /** Fields to log */
383
- fields?: string[];
384
- }): WorkflowStep;
385
- /**
386
- * Create a workflow from configuration
387
- */
388
- export declare function createWorkflow(config: WorkflowConfig): Workflow;