@sudocode-ai/local-server 0.1.5 → 0.1.7

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 (125) hide show
  1. package/dist/execution/process/builders/claude.d.ts +1 -1
  2. package/dist/execution/process/builders/claude.d.ts.map +1 -1
  3. package/dist/index.d.ts.map +1 -1
  4. package/dist/index.js +70 -11
  5. package/dist/index.js.map +1 -1
  6. package/dist/public/assets/index-B3SEMufD.js +580 -0
  7. package/dist/public/assets/index-B3SEMufD.js.map +1 -0
  8. package/dist/public/assets/index-D2YGL3gX.css +1 -0
  9. package/dist/public/assets/react-vendor-ByUx1V_q.js +60 -0
  10. package/dist/public/assets/react-vendor-ByUx1V_q.js.map +1 -0
  11. package/dist/public/assets/ui-vendor-CotR6bx9.js +54 -0
  12. package/dist/public/assets/ui-vendor-CotR6bx9.js.map +1 -0
  13. package/dist/public/index.html +4 -4
  14. package/dist/routes/feedback.d.ts.map +1 -1
  15. package/dist/routes/feedback.js +20 -12
  16. package/dist/routes/feedback.js.map +1 -1
  17. package/dist/services/db.d.ts.map +1 -1
  18. package/dist/services/db.js +19 -14
  19. package/dist/services/db.js.map +1 -1
  20. package/dist/services/execution-service.d.ts.map +1 -1
  21. package/dist/services/execution-service.js +43 -22
  22. package/dist/services/execution-service.js.map +1 -1
  23. package/dist/services/executions.d.ts.map +1 -1
  24. package/dist/services/executions.js +15 -0
  25. package/dist/services/executions.js.map +1 -1
  26. package/dist/services/feedback.d.ts +16 -0
  27. package/dist/services/feedback.d.ts.map +1 -1
  28. package/dist/services/feedback.js +25 -1
  29. package/dist/services/feedback.js.map +1 -1
  30. package/dist/services/repo-info.d.ts +17 -0
  31. package/dist/services/repo-info.d.ts.map +1 -0
  32. package/dist/services/repo-info.js +53 -0
  33. package/dist/services/repo-info.js.map +1 -0
  34. package/dist/services/websocket.d.ts +25 -3
  35. package/dist/services/websocket.d.ts.map +1 -1
  36. package/dist/services/websocket.js +71 -7
  37. package/dist/services/websocket.js.map +1 -1
  38. package/package.json +8 -7
  39. package/dist/execution/engine/engine.d.ts +0 -103
  40. package/dist/execution/engine/engine.d.ts.map +0 -1
  41. package/dist/execution/engine/engine.js +0 -10
  42. package/dist/execution/engine/engine.js.map +0 -1
  43. package/dist/execution/engine/simple-engine.d.ts +0 -190
  44. package/dist/execution/engine/simple-engine.d.ts.map +0 -1
  45. package/dist/execution/engine/simple-engine.js +0 -611
  46. package/dist/execution/engine/simple-engine.js.map +0 -1
  47. package/dist/execution/engine/types.d.ts +0 -116
  48. package/dist/execution/engine/types.d.ts.map +0 -1
  49. package/dist/execution/engine/types.js +0 -10
  50. package/dist/execution/engine/types.js.map +0 -1
  51. package/dist/execution/process/index.d.ts +0 -15
  52. package/dist/execution/process/index.d.ts.map +0 -1
  53. package/dist/execution/process/index.js +0 -15
  54. package/dist/execution/process/index.js.map +0 -1
  55. package/dist/execution/process/manager.d.ts +0 -133
  56. package/dist/execution/process/manager.d.ts.map +0 -1
  57. package/dist/execution/process/manager.js +0 -10
  58. package/dist/execution/process/manager.js.map +0 -1
  59. package/dist/execution/process/simple-manager.d.ts +0 -102
  60. package/dist/execution/process/simple-manager.d.ts.map +0 -1
  61. package/dist/execution/process/simple-manager.js +0 -336
  62. package/dist/execution/process/simple-manager.js.map +0 -1
  63. package/dist/execution/process/types.d.ts +0 -105
  64. package/dist/execution/process/types.d.ts.map +0 -1
  65. package/dist/execution/process/types.js +0 -10
  66. package/dist/execution/process/types.js.map +0 -1
  67. package/dist/execution/process/utils.d.ts +0 -53
  68. package/dist/execution/process/utils.d.ts.map +0 -1
  69. package/dist/execution/process/utils.js +0 -97
  70. package/dist/execution/process/utils.js.map +0 -1
  71. package/dist/execution/resilience/circuit-breaker.d.ts +0 -170
  72. package/dist/execution/resilience/circuit-breaker.d.ts.map +0 -1
  73. package/dist/execution/resilience/circuit-breaker.js +0 -291
  74. package/dist/execution/resilience/circuit-breaker.js.map +0 -1
  75. package/dist/execution/resilience/executor.d.ts +0 -109
  76. package/dist/execution/resilience/executor.d.ts.map +0 -1
  77. package/dist/execution/resilience/executor.js +0 -10
  78. package/dist/execution/resilience/executor.js.map +0 -1
  79. package/dist/execution/resilience/index.d.ts +0 -14
  80. package/dist/execution/resilience/index.d.ts.map +0 -1
  81. package/dist/execution/resilience/index.js +0 -15
  82. package/dist/execution/resilience/index.js.map +0 -1
  83. package/dist/execution/resilience/resilient-executor.d.ts +0 -86
  84. package/dist/execution/resilience/resilient-executor.d.ts.map +0 -1
  85. package/dist/execution/resilience/resilient-executor.js +0 -261
  86. package/dist/execution/resilience/resilient-executor.js.map +0 -1
  87. package/dist/execution/resilience/retry.d.ts +0 -161
  88. package/dist/execution/resilience/retry.d.ts.map +0 -1
  89. package/dist/execution/resilience/retry.js +0 -234
  90. package/dist/execution/resilience/retry.js.map +0 -1
  91. package/dist/execution/resilience/types.d.ts +0 -226
  92. package/dist/execution/resilience/types.d.ts.map +0 -1
  93. package/dist/execution/resilience/types.js +0 -30
  94. package/dist/execution/resilience/types.js.map +0 -1
  95. package/dist/execution/workflow/index.d.ts +0 -13
  96. package/dist/execution/workflow/index.d.ts.map +0 -1
  97. package/dist/execution/workflow/index.js +0 -13
  98. package/dist/execution/workflow/index.js.map +0 -1
  99. package/dist/execution/workflow/linear-orchestrator.d.ts +0 -216
  100. package/dist/execution/workflow/linear-orchestrator.d.ts.map +0 -1
  101. package/dist/execution/workflow/linear-orchestrator.js +0 -683
  102. package/dist/execution/workflow/linear-orchestrator.js.map +0 -1
  103. package/dist/execution/workflow/memory-storage.d.ts +0 -54
  104. package/dist/execution/workflow/memory-storage.d.ts.map +0 -1
  105. package/dist/execution/workflow/memory-storage.js +0 -68
  106. package/dist/execution/workflow/memory-storage.js.map +0 -1
  107. package/dist/execution/workflow/orchestrator.d.ts +0 -158
  108. package/dist/execution/workflow/orchestrator.d.ts.map +0 -1
  109. package/dist/execution/workflow/orchestrator.js +0 -9
  110. package/dist/execution/workflow/orchestrator.js.map +0 -1
  111. package/dist/execution/workflow/types.d.ts +0 -172
  112. package/dist/execution/workflow/types.d.ts.map +0 -1
  113. package/dist/execution/workflow/types.js +0 -9
  114. package/dist/execution/workflow/types.js.map +0 -1
  115. package/dist/execution/workflow/utils.d.ts +0 -89
  116. package/dist/execution/workflow/utils.d.ts.map +0 -1
  117. package/dist/execution/workflow/utils.js +0 -152
  118. package/dist/execution/workflow/utils.js.map +0 -1
  119. package/dist/public/assets/index-CeD4U_lo.css +0 -1
  120. package/dist/public/assets/index-fLX6-3RP.js +0 -569
  121. package/dist/public/assets/index-fLX6-3RP.js.map +0 -1
  122. package/dist/public/assets/react-vendor-LX0UoTxg.js +0 -60
  123. package/dist/public/assets/react-vendor-LX0UoTxg.js.map +0 -1
  124. package/dist/public/assets/ui-vendor-_cxVHaqZ.js +0 -54
  125. package/dist/public/assets/ui-vendor-_cxVHaqZ.js.map +0 -1
@@ -1,234 +0,0 @@
1
- /**
2
- * Retry Logic and Backoff Strategies
3
- *
4
- * Implements retry logic with various backoff strategies including
5
- * exponential, linear, and fixed delays with optional jitter.
6
- *
7
- * @module execution/resilience/retry
8
- */
9
- /**
10
- * Calculate backoff delay for a given attempt
11
- *
12
- * Supports multiple backoff strategies:
13
- * - Exponential: baseDelay * 2^(attempt-1) - e.g., 1s, 2s, 4s, 8s, 16s
14
- * - Linear: baseDelay * attempt - e.g., 1s, 2s, 3s, 4s, 5s
15
- * - Fixed: constant baseDelay - e.g., 1s, 1s, 1s, 1s, 1s
16
- *
17
- * Applies maxDelay cap and optional jitter to prevent thundering herd.
18
- *
19
- * @param attempt - Attempt number (1-indexed)
20
- * @param config - Backoff configuration from retry policy
21
- * @returns Delay in milliseconds
22
- *
23
- * @example
24
- * ```typescript
25
- * // Exponential backoff with jitter
26
- * const delay = calculateBackoff(3, {
27
- * type: 'exponential',
28
- * baseDelayMs: 1000,
29
- * maxDelayMs: 30000,
30
- * jitter: true,
31
- * });
32
- * // Returns ~4000ms ± 10% jitter
33
- * ```
34
- */
35
- export function calculateBackoff(attempt, config) {
36
- let delay;
37
- // Calculate base delay based on strategy
38
- switch (config.type) {
39
- case 'exponential':
40
- // 2^(attempt-1) * baseDelay
41
- // attempt 1: 2^0 = 1x, attempt 2: 2^1 = 2x, attempt 3: 2^2 = 4x
42
- delay = config.baseDelayMs * Math.pow(2, attempt - 1);
43
- break;
44
- case 'linear':
45
- // attempt * baseDelay
46
- // attempt 1: 1x, attempt 2: 2x, attempt 3: 3x
47
- delay = config.baseDelayMs * attempt;
48
- break;
49
- case 'fixed':
50
- // constant baseDelay
51
- delay = config.baseDelayMs;
52
- break;
53
- default:
54
- // TypeScript should prevent this, but handle gracefully
55
- delay = config.baseDelayMs;
56
- }
57
- // Enforce maximum delay cap
58
- delay = Math.min(delay, config.maxDelayMs);
59
- // Add jitter if configured (±10% randomness)
60
- if (config.jitter) {
61
- const jitterAmount = delay * 0.1; // 10% of delay
62
- const jitterOffset = Math.random() * jitterAmount * 2 - jitterAmount;
63
- delay += jitterOffset;
64
- // Ensure delay stays positive and doesn't exceed max after jitter
65
- delay = Math.max(0, Math.min(delay, config.maxDelayMs));
66
- }
67
- return Math.floor(delay);
68
- }
69
- /**
70
- * Check if an error should trigger a retry
71
- *
72
- * Matches error message against the list of retryable error patterns
73
- * defined in the retry policy.
74
- *
75
- * @param error - Error that occurred
76
- * @param policy - Retry policy with retryable error patterns
77
- * @returns True if error should be retried
78
- *
79
- * @example
80
- * ```typescript
81
- * const error = new Error('Connection timeout');
82
- * const shouldRetry = isRetryableError(error, {
83
- * retryableErrors: ['timeout', 'ECONNREFUSED'],
84
- * // ... other policy fields
85
- * });
86
- * // Returns true
87
- * ```
88
- */
89
- export function isRetryableError(error, policy) {
90
- const errorMessage = error.message || '';
91
- // Check if error message contains any retryable pattern
92
- for (const retryablePattern of policy.retryableErrors) {
93
- if (errorMessage.includes(retryablePattern)) {
94
- return true;
95
- }
96
- }
97
- return false;
98
- }
99
- /**
100
- * Check if an exit code should trigger a retry
101
- *
102
- * Matches exit code against the list of retryable exit codes
103
- * defined in the retry policy.
104
- *
105
- * @param exitCode - Process exit code
106
- * @param policy - Retry policy with retryable exit codes
107
- * @returns True if exit code should be retried
108
- *
109
- * @example
110
- * ```typescript
111
- * const shouldRetry = isRetryableExitCode(1, {
112
- * retryableExitCodes: [1, 137],
113
- * // ... other policy fields
114
- * });
115
- * // Returns true
116
- * ```
117
- */
118
- export function isRetryableExitCode(exitCode, policy) {
119
- return policy.retryableExitCodes.includes(exitCode);
120
- }
121
- /**
122
- * Check if an execution result should trigger a retry
123
- *
124
- * Checks both the exit code and error message (if present) to determine
125
- * if the execution should be retried.
126
- *
127
- * @param result - Execution result from task execution
128
- * @param policy - Retry policy
129
- * @returns True if execution should be retried
130
- *
131
- * @example
132
- * ```typescript
133
- * const result: ExecutionResult = {
134
- * taskId: 'task-1',
135
- * executionId: 'proc-123',
136
- * success: false,
137
- * exitCode: 1,
138
- * error: 'Connection timeout',
139
- * // ... other fields
140
- * };
141
- *
142
- * const shouldRetry = isRetryableResult(result, policy);
143
- * // Returns true if exitCode is retryable OR error contains retryable pattern
144
- * ```
145
- */
146
- export function isRetryableResult(result, policy) {
147
- // Check exit code
148
- if (result.exitCode !== undefined && result.exitCode !== null) {
149
- if (isRetryableExitCode(result.exitCode, policy)) {
150
- return true;
151
- }
152
- }
153
- // Check error message
154
- if (result.error) {
155
- const error = new Error(result.error);
156
- if (isRetryableError(error, policy)) {
157
- return true;
158
- }
159
- }
160
- return false;
161
- }
162
- /**
163
- * Promise-based sleep utility
164
- *
165
- * Returns a promise that resolves after the specified delay.
166
- * Useful for implementing retry backoff.
167
- *
168
- * @param ms - Delay in milliseconds
169
- * @returns Promise that resolves after delay
170
- *
171
- * @example
172
- * ```typescript
173
- * console.log('Starting...');
174
- * await sleep(1000);
175
- * console.log('1 second later');
176
- * ```
177
- */
178
- export function sleep(ms) {
179
- return new Promise((resolve) => setTimeout(resolve, ms));
180
- }
181
- /**
182
- * Create an execution attempt record
183
- *
184
- * Helper function to create a properly structured ExecutionAttempt object.
185
- *
186
- * @param attemptNumber - Attempt number (1-indexed)
187
- * @param success - Whether the attempt succeeded
188
- * @param options - Optional fields for the attempt
189
- * @returns ExecutionAttempt object
190
- */
191
- export function createAttempt(attemptNumber, success, options = {}) {
192
- const now = new Date();
193
- return {
194
- attemptNumber,
195
- startedAt: now,
196
- completedAt: options.duration !== undefined ? now : undefined,
197
- duration: options.duration,
198
- success,
199
- error: options.error,
200
- exitCode: options.exitCode,
201
- willRetry: options.willRetry || false,
202
- nextRetryAt: options.nextRetryAt,
203
- };
204
- }
205
- /**
206
- * Calculate total delay from all retry attempts
207
- *
208
- * Sums up all the backoff delays that would be applied for a given
209
- * number of retry attempts. Useful for timeout calculations.
210
- *
211
- * @param maxAttempts - Maximum number of attempts
212
- * @param backoffConfig - Backoff configuration
213
- * @returns Total delay in milliseconds
214
- *
215
- * @example
216
- * ```typescript
217
- * const totalDelay = calculateTotalRetryDelay(3, {
218
- * type: 'exponential',
219
- * baseDelayMs: 1000,
220
- * maxDelayMs: 30000,
221
- * jitter: false,
222
- * });
223
- * // Returns 7000ms (1s + 2s + 4s)
224
- * ```
225
- */
226
- export function calculateTotalRetryDelay(maxAttempts, backoffConfig) {
227
- let totalDelay = 0;
228
- // Calculate delay for each attempt (excluding the first one)
229
- for (let attempt = 2; attempt <= maxAttempts; attempt++) {
230
- totalDelay += calculateBackoff(attempt, backoffConfig);
231
- }
232
- return totalDelay;
233
- }
234
- //# sourceMappingURL=retry.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"retry.js","sourceRoot":"","sources":["../../../src/execution/resilience/retry.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAKH;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,MAAM,UAAU,gBAAgB,CAC9B,OAAe,EACf,MAA8B;IAE9B,IAAI,KAAa,CAAC;IAElB,yCAAyC;IACzC,QAAQ,MAAM,CAAC,IAAI,EAAE,CAAC;QACpB,KAAK,aAAa;YAChB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AE,GAAG;QACd,WAAW,EAAE,OAAO,CAAC,QAAQ,KAAK,SAAS,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,SAAS;QAC7D,QAAQ,EAAE,OAAO,CAAC,QAAQ;QAC1B,OAAO;QACP,KAAK,EAAE,OAAO,CAAC,KAAK;QACpB,QAAQ,EAAE,OAAO,CAAC,QAAQ;QAC1B,SAAS,EAAE,OAAO,CAAC,SAAS,IAAI,KAAK;QACrC,WAAW,EAAE,OAAO,CAAC,WAAW;KACjC,CAAC;AACJ,CAAC;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,UAAU,wBAAwB,CACtC,WAAmB,EACnB,aAAqC;IAErC,IAAI,UAAU,GAAG,CAAC,CAAC;IAEnB,6DAA6D;IAC7D,KAAK,IAAI,OAAO,GAAG,CAAC,EAAE,OAAO,IAAI,WAAW,EAAE,OAAO,EAAE,EAAE,CAAC;QACxD,UAAU,IAAI,gBAAgB,CAAC,OAAO,EAAE,aAAa,CAAC,CAAC;IACzD,CAAC;IAED,OAAO,UAAU,CAAC;AACpB,CAAC"}
@@ -1,226 +0,0 @@
1
- /**
2
- * Resilience Layer Types
3
- *
4
- * Core types for the Resilience Layer (Layer 3) that adds retry logic,
5
- * circuit breakers, and fault tolerance to task execution.
6
- *
7
- * @module execution/resilience/types
8
- */
9
- import type { ExecutionResult } from '../engine/types.js';
10
- /**
11
- * RetryPolicy - Configuration for retry behavior
12
- */
13
- export interface RetryPolicy {
14
- /**
15
- * Maximum number of retry attempts (0 = no retry)
16
- */
17
- maxAttempts: number;
18
- /**
19
- * Backoff strategy configuration
20
- */
21
- backoff: {
22
- /**
23
- * Type of backoff strategy
24
- * - exponential: delay = baseDelay * 2^(attempt-1)
25
- * - linear: delay = baseDelay * attempt
26
- * - fixed: delay = baseDelay (constant)
27
- */
28
- type: 'exponential' | 'linear' | 'fixed';
29
- /**
30
- * Initial delay in milliseconds
31
- */
32
- baseDelayMs: number;
33
- /**
34
- * Maximum delay cap in milliseconds
35
- */
36
- maxDelayMs: number;
37
- /**
38
- * Add randomness to prevent thundering herd
39
- * Adds ±10% jitter to delay
40
- */
41
- jitter: boolean;
42
- };
43
- /**
44
- * Error types/messages that should trigger a retry
45
- * Examples: 'ECONNREFUSED', 'timeout', 'network'
46
- */
47
- retryableErrors: string[];
48
- /**
49
- * Exit codes that should trigger a retry
50
- * Examples: [1, 137] for generic error and SIGKILL
51
- */
52
- retryableExitCodes: number[];
53
- /**
54
- * Optional callback to determine if circuit breaker should open
55
- */
56
- shouldOpenCircuit?: (error: Error, attempts: number) => boolean;
57
- }
58
- /**
59
- * CircuitState - State of a circuit breaker
60
- */
61
- export type CircuitState = 'closed' | 'open' | 'half-open';
62
- /**
63
- * CircuitBreaker - Circuit breaker for preventing cascading failures
64
- */
65
- export interface CircuitBreaker {
66
- /**
67
- * Unique name for this circuit breaker
68
- * Typically matches the task type (e.g., 'issue', 'spec', 'custom')
69
- */
70
- name: string;
71
- /**
72
- * Current state of the circuit
73
- * - closed: Normal operation, requests pass through
74
- * - open: Too many failures, requests rejected
75
- * - half-open: Testing if service recovered, limited requests allowed
76
- */
77
- state: CircuitState;
78
- /**
79
- * Circuit breaker configuration
80
- */
81
- config: {
82
- /**
83
- * Number of consecutive failures before opening circuit
84
- */
85
- failureThreshold: number;
86
- /**
87
- * Number of consecutive successes in half-open to close circuit
88
- */
89
- successThreshold: number;
90
- /**
91
- * Time to wait before transitioning from open to half-open (ms)
92
- */
93
- timeout: number;
94
- };
95
- /**
96
- * Circuit breaker metrics
97
- */
98
- metrics: {
99
- /**
100
- * Total requests processed
101
- */
102
- totalRequests: number;
103
- /**
104
- * Total failed requests
105
- */
106
- failedRequests: number;
107
- /**
108
- * Total successful requests
109
- */
110
- successfulRequests: number;
111
- /**
112
- * Timestamp of last failure
113
- */
114
- lastFailureTime?: Date;
115
- /**
116
- * Timestamp of last success
117
- */
118
- lastSuccessTime?: Date;
119
- };
120
- }
121
- /**
122
- * ExecutionAttempt - Record of a single execution attempt
123
- */
124
- export interface ExecutionAttempt {
125
- /**
126
- * Attempt number (1-indexed)
127
- */
128
- attemptNumber: number;
129
- /**
130
- * When this attempt started
131
- */
132
- startedAt: Date;
133
- /**
134
- * When this attempt completed (if finished)
135
- */
136
- completedAt?: Date;
137
- /**
138
- * Duration of this attempt in milliseconds
139
- */
140
- duration?: number;
141
- /**
142
- * Whether this attempt succeeded
143
- */
144
- success: boolean;
145
- /**
146
- * Error that occurred during this attempt
147
- */
148
- error?: Error;
149
- /**
150
- * Exit code from this attempt
151
- */
152
- exitCode?: number;
153
- /**
154
- * Whether another retry will be attempted after this
155
- */
156
- willRetry: boolean;
157
- /**
158
- * When the next retry will occur (if willRetry is true)
159
- */
160
- nextRetryAt?: Date;
161
- }
162
- /**
163
- * ResilientExecutionResult - Enhanced execution result with retry information
164
- *
165
- * Extends the base ExecutionResult with detailed retry tracking
166
- */
167
- export interface ResilientExecutionResult extends ExecutionResult {
168
- /**
169
- * All execution attempts made for this task
170
- */
171
- attempts: ExecutionAttempt[];
172
- /**
173
- * Total number of attempts made
174
- */
175
- totalAttempts: number;
176
- /**
177
- * The final attempt (may be success or failure)
178
- */
179
- finalAttempt: ExecutionAttempt;
180
- /**
181
- * Human-readable reason for failure (if failed)
182
- */
183
- failureReason?: string;
184
- /**
185
- * Whether the circuit breaker prevented execution
186
- */
187
- circuitBreakerTriggered?: boolean;
188
- }
189
- /**
190
- * RetryMetrics - Aggregate metrics for retry behavior
191
- */
192
- export interface RetryMetrics {
193
- /**
194
- * Total number of retries attempted across all tasks
195
- */
196
- totalRetries: number;
197
- /**
198
- * Number of retries that eventually succeeded
199
- */
200
- successfulRetries: number;
201
- /**
202
- * Number of retries that ultimately failed
203
- */
204
- failedRetries: number;
205
- /**
206
- * Average number of attempts needed for successful tasks
207
- */
208
- averageAttemptsToSuccess: number;
209
- /**
210
- * Circuit breakers by name
211
- */
212
- circuitBreakers: Map<string, CircuitBreaker>;
213
- }
214
- /**
215
- * RetryAttemptHandler - Callback for retry attempt events
216
- */
217
- export type RetryAttemptHandler = (taskId: string, attempt: ExecutionAttempt) => void;
218
- /**
219
- * CircuitOpenHandler - Callback for circuit breaker open events
220
- */
221
- export type CircuitOpenHandler = (circuitName: string, breaker: CircuitBreaker) => void;
222
- /**
223
- * Default retry policy for resilient execution
224
- */
225
- export declare const DEFAULT_RETRY_POLICY: RetryPolicy;
226
- //# sourceMappingURL=types.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/execution/resilience/types.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAE1D;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B;;OAEG;IACH,WAAW,EAAE,MAAM,CAAC;IAEpB;;OAEG;IACH,OAAO,EAAE;QACP;;;;;WAKG;QACH,IAAI,EAAE,aAAa,GAAG,QAAQ,GAAG,OAAO,CAAC;QAEzC;;WAEG;QACH,WAAW,EAAE,MAAM,CAAC;QAEpB;;WAEG;QACH,UAAU,EAAE,MAAM,CAAC;QAEnB;;;WAGG;QACH,MAAM,EAAE,OAAO,CAAC;KACjB,CAAC;IAEF;;;OAGG;IACH,eAAe,EAAE,MAAM,EAAE,CAAC;IAE1B;;;OAGG;IACH,kBAAkB,EAAE,MAAM,EAAE,CAAC;IAE7B;;OAEG;IACH,iBAAiB,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,KAAK,OAAO,CAAC;CACjE;AAED;;GAEG;AACH,MAAM,MAAM,YAAY,GAAG,QAAQ,GAAG,MAAM,GAAG,WAAW,CAAC;AAE3D;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B;;;OAGG;IACH,IAAI,EAAE,MAAM,CAAC;IAEb;;;;;OAKG;IACH,KAAK,EAAE,YAAY,CAAC;IAEpB;;OAEG;IACH,MAAM,EAAE;QACN;;WAEG;QACH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E,MAAM,CAAC;IAErB;;OAEG;IACH,iBAAiB,EAAE,MAAM,CAAC;IAE1B;;OAEG;IACH,aAAa,EAAE,MAAM,CAAC;IAEtB;;OAEG;IACH,wBAAwB,EAAE,MAAM,CAAC;IAEjC;;OAEG;IACH,eAAe,EAAE,GAAG,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC;CAC9C;AAED;;GAEG;AACH,MAAM,MAAM,mBAAmB,GAAG,CAChC,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,gBAAgB,KACtB,IAAI,CAAC;AAEV;;GAEG;AACH,MAAM,MAAM,kBAAkB,GAAG,CAC/B,WAAW,EAAE,MAAM,EACnB,OAAO,EAAE,cAAc,KACpB,IAAI,CAAC;AAEV;;GAEG;AACH,eAAO,MAAM,oBAAoB,EAAE,WAiBlC,CAAC"}
@@ -1,30 +0,0 @@
1
- /**
2
- * Resilience Layer Types
3
- *
4
- * Core types for the Resilience Layer (Layer 3) that adds retry logic,
5
- * circuit breakers, and fault tolerance to task execution.
6
- *
7
- * @module execution/resilience/types
8
- */
9
- /**
10
- * Default retry policy for resilient execution
11
- */
12
- export const DEFAULT_RETRY_POLICY = {
13
- maxAttempts: 3,
14
- backoff: {
15
- type: 'exponential',
16
- baseDelayMs: 1000,
17
- maxDelayMs: 30000,
18
- jitter: true,
19
- },
20
- retryableErrors: [
21
- 'ECONNREFUSED',
22
- 'ETIMEDOUT',
23
- 'ENOTFOUND',
24
- 'timeout',
25
- 'network',
26
- 'Process execution timeout',
27
- ],
28
- retryableExitCodes: [1, 137], // Generic error, SIGKILL
29
- };
30
- //# sourceMappingURL=types.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/execution/resilience/types.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAsQH;;GAEG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAgB;IAC/C,WAAW,EAAE,CAAC;IACd,OAAO,EAAE;QACP,IAAI,EAAE,aAAa;QACnB,WAAW,EAAE,IAAI;QACjB,UAAU,EAAE,KAAK;QACjB,MAAM,EAAE,IAAI;KACb;IACD,eAAe,EAAE;QACf,cAAc;QACd,WAAW;QACX,WAAW;QACX,SAAS;QACT,SAAS;QACT,2BAA2B;KAC5B;IACD,kBAAkB,EAAE,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE,yBAAyB;CACxD,CAAC"}
@@ -1,13 +0,0 @@
1
- /**
2
- * Workflow Layer Exports
3
- *
4
- * Layer 4: Task Execution Layer - Workflow Orchestration & State Management
5
- *
6
- * @module execution/workflow
7
- */
8
- export type { WorkflowDefinition, WorkflowStep, WorkflowExecution, WorkflowStatus, WorkflowCheckpoint, WorkflowResult, StepStatus, WorkflowStartHandler, WorkflowCompleteHandler, WorkflowFailedHandler, StepStartHandler, StepCompleteHandler, StepFailedHandler, WorkflowCheckpointHandler, WorkflowResumeHandler, WorkflowPauseHandler, WorkflowCancelHandler, } from './types.js';
9
- export type { IWorkflowOrchestrator, IWorkflowStorage } from './orchestrator.js';
10
- export { generateId, renderTemplate, extractValue, mergeContext, evaluateCondition, createContext, } from './utils.js';
11
- export { LinearOrchestrator } from './linear-orchestrator.js';
12
- export { InMemoryWorkflowStorage } from './memory-storage.js';
13
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/execution/workflow/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,YAAY,EACV,kBAAkB,EAClB,YAAY,EACZ,iBAAiB,EACjB,cAAc,EACd,kBAAkB,EAClB,cAAc,EACd,UAAU,EACV,oBAAoB,EACpB,uBAAuB,EACvB,qBAAqB,EACrB,gBAAgB,EAChB,mBAAmB,EACnB,iBAAiB,EACjB,yBAAyB,EACzB,qBAAqB,EACrB,oBAAoB,EACpB,qBAAqB,GACtB,MAAM,YAAY,CAAC;AAGpB,YAAY,EAAE,qBAAqB,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAGjF,OAAO,EACL,UAAU,EACV,cAAc,EACd,YAAY,EACZ,YAAY,EACZ,iBAAiB,EACjB,aAAa,GACd,MAAM,YAAY,CAAC;AAGpB,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAC9D,OAAO,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAC"}
@@ -1,13 +0,0 @@
1
- /**
2
- * Workflow Layer Exports
3
- *
4
- * Layer 4: Task Execution Layer - Workflow Orchestration & State Management
5
- *
6
- * @module execution/workflow
7
- */
8
- // Utilities
9
- export { generateId, renderTemplate, extractValue, mergeContext, evaluateCondition, createContext, } from './utils.js';
10
- // Implementation
11
- export { LinearOrchestrator } from './linear-orchestrator.js';
12
- export { InMemoryWorkflowStorage } from './memory-storage.js';
13
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/execution/workflow/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AA0BH,YAAY;AACZ,OAAO,EACL,UAAU,EACV,cAAc,EACd,YAAY,EACZ,YAAY,EACZ,iBAAiB,EACjB,aAAa,GACd,MAAM,YAAY,CAAC;AAEpB,iBAAiB;AACjB,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAC9D,OAAO,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAC"}