atlas-pipeline-mcp 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.
Files changed (64) hide show
  1. package/.env.example +21 -0
  2. package/LICENSE +21 -0
  3. package/README.md +175 -0
  4. package/dist/mcp.d.ts +21 -0
  5. package/dist/mcp.d.ts.map +1 -0
  6. package/dist/mcp.js +404 -0
  7. package/dist/mcp.js.map +1 -0
  8. package/dist/pipeline.d.ts +39 -0
  9. package/dist/pipeline.d.ts.map +1 -0
  10. package/dist/pipeline.js +355 -0
  11. package/dist/pipeline.js.map +1 -0
  12. package/dist/providers/index.d.ts +14 -0
  13. package/dist/providers/index.d.ts.map +1 -0
  14. package/dist/providers/index.js +13 -0
  15. package/dist/providers/index.js.map +1 -0
  16. package/dist/providers/llm-provider.d.ts +71 -0
  17. package/dist/providers/llm-provider.d.ts.map +1 -0
  18. package/dist/providers/llm-provider.js +357 -0
  19. package/dist/providers/llm-provider.js.map +1 -0
  20. package/dist/server.d.ts +27 -0
  21. package/dist/server.d.ts.map +1 -0
  22. package/dist/server.js +312 -0
  23. package/dist/server.js.map +1 -0
  24. package/dist/tools/context.d.ts +23 -0
  25. package/dist/tools/context.d.ts.map +1 -0
  26. package/dist/tools/context.js +363 -0
  27. package/dist/tools/context.js.map +1 -0
  28. package/dist/tools/critique.d.ts +40 -0
  29. package/dist/tools/critique.d.ts.map +1 -0
  30. package/dist/tools/critique.js +315 -0
  31. package/dist/tools/critique.js.map +1 -0
  32. package/dist/tools/decompose.d.ts +34 -0
  33. package/dist/tools/decompose.d.ts.map +1 -0
  34. package/dist/tools/decompose.js +328 -0
  35. package/dist/tools/decompose.js.map +1 -0
  36. package/dist/tools/git.d.ts +66 -0
  37. package/dist/tools/git.d.ts.map +1 -0
  38. package/dist/tools/git.js +333 -0
  39. package/dist/tools/git.js.map +1 -0
  40. package/dist/tools/intent.d.ts +24 -0
  41. package/dist/tools/intent.d.ts.map +1 -0
  42. package/dist/tools/intent.js +245 -0
  43. package/dist/tools/intent.js.map +1 -0
  44. package/dist/tools/ollama.d.ts +104 -0
  45. package/dist/tools/ollama.d.ts.map +1 -0
  46. package/dist/tools/ollama.js +299 -0
  47. package/dist/tools/ollama.js.map +1 -0
  48. package/dist/tools/optimize.d.ts +64 -0
  49. package/dist/tools/optimize.d.ts.map +1 -0
  50. package/dist/tools/optimize.js +302 -0
  51. package/dist/tools/optimize.js.map +1 -0
  52. package/dist/tools/variants.d.ts +49 -0
  53. package/dist/tools/variants.d.ts.map +1 -0
  54. package/dist/tools/variants.js +252 -0
  55. package/dist/tools/variants.js.map +1 -0
  56. package/dist/types.d.ts +447 -0
  57. package/dist/types.d.ts.map +1 -0
  58. package/dist/types.js +25 -0
  59. package/dist/types.js.map +1 -0
  60. package/dist/utils.d.ts +117 -0
  61. package/dist/utils.d.ts.map +1 -0
  62. package/dist/utils.js +279 -0
  63. package/dist/utils.js.map +1 -0
  64. package/package.json +77 -0
@@ -0,0 +1,447 @@
1
+ /**
2
+ * Atlas Server - Shared Type Definitions
3
+ *
4
+ * This module defines all shared interfaces and types used across the
5
+ * multi-stage AI pipeline. Types are organized by domain concern.
6
+ */
7
+ import { z } from 'zod';
8
+ /**
9
+ * Represents the user's original request to the pipeline
10
+ */
11
+ export interface PipelineRequest {
12
+ /** The raw user query or instruction */
13
+ query: string;
14
+ /** Optional repository path for git operations */
15
+ repoPath?: string;
16
+ /** Additional context provided by the user */
17
+ userContext?: Record<string, unknown>;
18
+ /** Session identifier for tracking */
19
+ sessionId?: string;
20
+ }
21
+ /**
22
+ * The final output of the pipeline after all stages complete
23
+ */
24
+ export interface PipelineResponse {
25
+ /** Whether the pipeline completed successfully */
26
+ success: boolean;
27
+ /** The final optimized response */
28
+ result: string;
29
+ /** Metadata about the pipeline execution */
30
+ metadata: PipelineMetadata;
31
+ /** Error details if the pipeline failed */
32
+ error?: PipelineError;
33
+ }
34
+ /**
35
+ * Metadata collected during pipeline execution
36
+ */
37
+ export interface PipelineMetadata {
38
+ /** Total execution time in milliseconds */
39
+ executionTimeMs: number;
40
+ /** Results from each pipeline stage */
41
+ stages: StageResult[];
42
+ /** The model used for generation */
43
+ model: string;
44
+ /** Timestamp when processing started */
45
+ startedAt: string;
46
+ /** Timestamp when processing completed */
47
+ completedAt: string;
48
+ }
49
+ /**
50
+ * Result from a single pipeline stage
51
+ */
52
+ export interface StageResult {
53
+ /** Name of the stage */
54
+ name: StageName;
55
+ /** Whether this stage succeeded */
56
+ success: boolean;
57
+ /** Execution time for this stage in milliseconds */
58
+ durationMs: number;
59
+ /** Optional output data from the stage */
60
+ output?: unknown;
61
+ }
62
+ /**
63
+ * Names of all pipeline stages
64
+ */
65
+ export type StageName = 'intent' | 'context' | 'git' | 'decompose' | 'variants' | 'critique' | 'optimize';
66
+ /**
67
+ * Pipeline error with structured details
68
+ */
69
+ export interface PipelineError {
70
+ /** Error code for programmatic handling */
71
+ code: string;
72
+ /** Human-readable error message */
73
+ message: string;
74
+ /** The stage where the error occurred */
75
+ stage?: StageName;
76
+ /** Additional error details */
77
+ details?: Record<string, unknown>;
78
+ }
79
+ /**
80
+ * Result of intent classification
81
+ */
82
+ export interface IntentAnalysis {
83
+ /** Primary intent category */
84
+ primaryIntent: IntentType;
85
+ /** Confidence score from 0 to 1 */
86
+ confidence: number;
87
+ /** Extracted entities from the query */
88
+ entities: ExtractedEntity[];
89
+ /** Keywords identified in the query */
90
+ keywords: string[];
91
+ /** Whether the query requires clarification */
92
+ requiresClarification: boolean;
93
+ /** Suggested clarifying questions if needed */
94
+ clarifyingQuestions?: string[];
95
+ }
96
+ /**
97
+ * Types of intents the system can classify
98
+ */
99
+ export type IntentType = 'code_generation' | 'code_review' | 'debugging' | 'refactoring' | 'explanation' | 'documentation' | 'testing' | 'architecture' | 'general_question' | 'unknown';
100
+ /**
101
+ * An entity extracted from the user query
102
+ */
103
+ export interface ExtractedEntity {
104
+ /** Type of entity */
105
+ type: 'language' | 'framework' | 'file' | 'function' | 'concept' | 'library';
106
+ /** The extracted value */
107
+ value: string;
108
+ /** Position in the original query */
109
+ position: {
110
+ start: number;
111
+ end: number;
112
+ };
113
+ }
114
+ /**
115
+ * Aggregated context for the pipeline
116
+ */
117
+ export interface PipelineContext {
118
+ /** The analyzed intent */
119
+ intent: IntentAnalysis;
120
+ /** Relevant code snippets */
121
+ codeSnippets: CodeSnippet[];
122
+ /** Git history context if available */
123
+ gitContext?: GitContext;
124
+ /** Project structure information */
125
+ projectInfo?: ProjectInfo;
126
+ }
127
+ /**
128
+ * A code snippet with metadata
129
+ */
130
+ export interface CodeSnippet {
131
+ /** File path relative to repo root */
132
+ filePath: string;
133
+ /** The code content */
134
+ content: string;
135
+ /** Programming language */
136
+ language: string;
137
+ /** Line range in the original file */
138
+ lineRange: {
139
+ start: number;
140
+ end: number;
141
+ };
142
+ /** Relevance score from 0 to 1 */
143
+ relevance: number;
144
+ }
145
+ /**
146
+ * Project structure and configuration info
147
+ */
148
+ export interface ProjectInfo {
149
+ /** Root directory path */
150
+ rootPath: string;
151
+ /** Detected languages in the project */
152
+ languages: string[];
153
+ /** Detected frameworks */
154
+ frameworks: string[];
155
+ /** Package manager in use */
156
+ packageManager?: 'npm' | 'yarn' | 'pnpm' | 'bun';
157
+ /** Key configuration files found */
158
+ configFiles: string[];
159
+ }
160
+ /**
161
+ * Git repository context
162
+ */
163
+ export interface GitContext {
164
+ /** Current branch name */
165
+ currentBranch: string;
166
+ /** Recent commits */
167
+ recentCommits: GitCommit[];
168
+ /** Uncommitted changes */
169
+ uncommittedChanges: GitChange[];
170
+ /** Repository remote URL */
171
+ remoteUrl?: string;
172
+ /** Whether repo has uncommitted changes */
173
+ isDirty: boolean;
174
+ }
175
+ /**
176
+ * A git commit with metadata
177
+ */
178
+ export interface GitCommit {
179
+ /** Commit hash (short) */
180
+ hash: string;
181
+ /** Commit message */
182
+ message: string;
183
+ /** Author name */
184
+ author: string;
185
+ /** Commit date as ISO string */
186
+ date: string;
187
+ /** Files changed in this commit */
188
+ filesChanged: number;
189
+ }
190
+ /**
191
+ * A single git change (staged or unstaged)
192
+ */
193
+ export interface GitChange {
194
+ /** File path */
195
+ path: string;
196
+ /** Type of change */
197
+ type: 'added' | 'modified' | 'deleted' | 'renamed';
198
+ /** Whether the change is staged */
199
+ staged: boolean;
200
+ }
201
+ /**
202
+ * A decomposed task from the original query
203
+ */
204
+ export interface DecomposedTask {
205
+ /** Unique identifier for the task */
206
+ id: string;
207
+ /** Task description */
208
+ description: string;
209
+ /** Task type category */
210
+ type: TaskType;
211
+ /** Priority from 1 (highest) to 5 (lowest) */
212
+ priority: 1 | 2 | 3 | 4 | 5;
213
+ /** IDs of tasks this depends on */
214
+ dependencies: string[];
215
+ /** Estimated complexity */
216
+ complexity: 'low' | 'medium' | 'high';
217
+ /** Suggested approach for this task */
218
+ approach?: string;
219
+ }
220
+ /**
221
+ * Types of decomposed tasks
222
+ */
223
+ export type TaskType = 'research' | 'design' | 'implementation' | 'testing' | 'documentation' | 'review';
224
+ /**
225
+ * Result of task decomposition
226
+ */
227
+ export interface DecompositionResult {
228
+ /** Original query summary */
229
+ summary: string;
230
+ /** List of decomposed tasks */
231
+ tasks: DecomposedTask[];
232
+ /** Suggested execution order */
233
+ executionOrder: string[];
234
+ /** Total estimated complexity */
235
+ overallComplexity: 'low' | 'medium' | 'high';
236
+ }
237
+ /**
238
+ * A solution variant generated by the system
239
+ */
240
+ export interface SolutionVariant {
241
+ /** Unique identifier */
242
+ id: string;
243
+ /** Variant label (A, B, C, etc.) */
244
+ label: string;
245
+ /** The generated solution code or text */
246
+ content: string;
247
+ /** Approach description */
248
+ approach: string;
249
+ /** Trade-offs of this approach */
250
+ tradeoffs: {
251
+ pros: string[];
252
+ cons: string[];
253
+ };
254
+ /** Target use case */
255
+ useCase: string;
256
+ }
257
+ /**
258
+ * Result of variant generation
259
+ */
260
+ export interface VariantGenerationResult {
261
+ /** Generated variants */
262
+ variants: SolutionVariant[];
263
+ /** Recommended variant ID */
264
+ recommendedVariantId: string;
265
+ /** Reasoning for the recommendation */
266
+ recommendationReason: string;
267
+ }
268
+ /**
269
+ * Critique of a solution variant
270
+ */
271
+ export interface Critique {
272
+ /** ID of the variant being critiqued */
273
+ variantId: string;
274
+ /** Overall quality score from 0 to 100 */
275
+ qualityScore: number;
276
+ /** Detailed assessment categories */
277
+ assessment: CritiqueAssessment;
278
+ /** List of identified issues */
279
+ issues: CritiqueIssue[];
280
+ /** Suggestions for improvement */
281
+ suggestions: string[];
282
+ /** Whether this variant is viable */
283
+ isViable: boolean;
284
+ }
285
+ /**
286
+ * Detailed assessment across categories
287
+ */
288
+ export interface CritiqueAssessment {
289
+ /** Code correctness score (0-100) */
290
+ correctness: number;
291
+ /** Performance characteristics (0-100) */
292
+ performance: number;
293
+ /** Code maintainability (0-100) */
294
+ maintainability: number;
295
+ /** Security considerations (0-100) */
296
+ security: number;
297
+ /** Best practices adherence (0-100) */
298
+ bestPractices: number;
299
+ }
300
+ /**
301
+ * An issue identified during critique
302
+ */
303
+ export interface CritiqueIssue {
304
+ /** Severity of the issue */
305
+ severity: 'critical' | 'major' | 'minor' | 'suggestion';
306
+ /** Category of the issue */
307
+ category: keyof CritiqueAssessment;
308
+ /** Description of the issue */
309
+ description: string;
310
+ /** Location in the code if applicable */
311
+ location?: string;
312
+ /** Suggested fix */
313
+ suggestedFix?: string;
314
+ }
315
+ /**
316
+ * Result of critiquing all variants
317
+ */
318
+ export interface CritiqueResult {
319
+ /** Critiques for each variant */
320
+ critiques: Critique[];
321
+ /** ID of the best variant after critique */
322
+ bestVariantId: string;
323
+ /** Summary of the critique process */
324
+ summary: string;
325
+ }
326
+ /**
327
+ * Final optimized output
328
+ */
329
+ export interface OptimizedOutput {
330
+ /** The final optimized content */
331
+ content: string;
332
+ /** Optimizations applied */
333
+ optimizationsApplied: Optimization[];
334
+ /** Final quality metrics */
335
+ finalMetrics: CritiqueAssessment;
336
+ /** Explanation of the final solution */
337
+ explanation: string;
338
+ }
339
+ /**
340
+ * An optimization that was applied
341
+ */
342
+ export interface Optimization {
343
+ /** Type of optimization */
344
+ type: 'performance' | 'readability' | 'security' | 'simplification' | 'best_practice';
345
+ /** Description of what was optimized */
346
+ description: string;
347
+ /** Impact assessment */
348
+ impact: 'low' | 'medium' | 'high';
349
+ }
350
+ /**
351
+ * Configuration for Ollama API calls
352
+ */
353
+ export interface OllamaConfig {
354
+ /** Base URL for Ollama API */
355
+ baseUrl: string;
356
+ /** Model to use for generation */
357
+ model: string;
358
+ /** Request timeout in milliseconds */
359
+ timeoutMs: number;
360
+ /** Maximum retries on failure */
361
+ maxRetries: number;
362
+ }
363
+ /**
364
+ * Options for a generation request
365
+ */
366
+ export interface GenerationOptions {
367
+ /** System prompt to set context */
368
+ systemPrompt?: string;
369
+ /** Temperature for generation (0-1) */
370
+ temperature?: number;
371
+ /** Maximum tokens to generate */
372
+ maxTokens?: number;
373
+ /** Stop sequences */
374
+ stop?: string[];
375
+ /** Whether to stream the response */
376
+ stream?: boolean;
377
+ }
378
+ /**
379
+ * Response from Ollama generation
380
+ */
381
+ export interface GenerationResponse {
382
+ /** Generated text */
383
+ text: string;
384
+ /** Model used */
385
+ model: string;
386
+ /** Generation statistics */
387
+ stats: {
388
+ promptTokens: number;
389
+ completionTokens: number;
390
+ totalDurationMs: number;
391
+ };
392
+ }
393
+ export declare const PipelineRequestSchema: z.ZodObject<{
394
+ query: z.ZodString;
395
+ repoPath: z.ZodOptional<z.ZodString>;
396
+ userContext: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
397
+ sessionId: z.ZodOptional<z.ZodString>;
398
+ }, "strip", z.ZodTypeAny, {
399
+ query: string;
400
+ repoPath?: string | undefined;
401
+ userContext?: Record<string, unknown> | undefined;
402
+ sessionId?: string | undefined;
403
+ }, {
404
+ query: string;
405
+ repoPath?: string | undefined;
406
+ userContext?: Record<string, unknown> | undefined;
407
+ sessionId?: string | undefined;
408
+ }>;
409
+ export declare const HealthResponseSchema: z.ZodObject<{
410
+ status: z.ZodEnum<["healthy", "degraded", "unhealthy"]>;
411
+ version: z.ZodString;
412
+ timestamp: z.ZodString;
413
+ services: z.ZodObject<{
414
+ ollama: z.ZodBoolean;
415
+ }, "strip", z.ZodTypeAny, {
416
+ ollama: boolean;
417
+ }, {
418
+ ollama: boolean;
419
+ }>;
420
+ }, "strip", z.ZodTypeAny, {
421
+ status: "healthy" | "degraded" | "unhealthy";
422
+ version: string;
423
+ timestamp: string;
424
+ services: {
425
+ ollama: boolean;
426
+ };
427
+ }, {
428
+ status: "healthy" | "degraded" | "unhealthy";
429
+ version: string;
430
+ timestamp: string;
431
+ services: {
432
+ ollama: boolean;
433
+ };
434
+ }>;
435
+ export interface ServerConfig {
436
+ /** Server port */
437
+ port: number;
438
+ /** Server host */
439
+ host: string;
440
+ /** Log level */
441
+ logLevel: 'debug' | 'info' | 'warn' | 'error';
442
+ /** Ollama configuration */
443
+ ollama: OllamaConfig;
444
+ /** Enable CORS */
445
+ corsEnabled: boolean;
446
+ }
447
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAMxB;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,wCAAwC;IACxC,KAAK,EAAE,MAAM,CAAC;IACd,kDAAkD;IAClD,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,8CAA8C;IAC9C,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACtC,sCAAsC;IACtC,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,kDAAkD;IAClD,OAAO,EAAE,OAAO,CAAC;IACjB,mCAAmC;IACnC,MAAM,EAAE,MAAM,CAAC;IACf,4CAA4C;IAC5C,QAAQ,EAAE,gBAAgB,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AAM,CAAC;IACb,kBAAkB;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,gBAAgB;IAChB,QAAQ,EAAE,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC;IAC9C,2BAA2B;IAC3B,MAAM,EAAE,YAAY,CAAC;IACrB,kBAAkB;IAClB,WAAW,EAAE,OAAO,CAAC;CACtB"}
package/dist/types.js ADDED
@@ -0,0 +1,25 @@
1
+ /**
2
+ * Atlas Server - Shared Type Definitions
3
+ *
4
+ * This module defines all shared interfaces and types used across the
5
+ * multi-stage AI pipeline. Types are organized by domain concern.
6
+ */
7
+ import { z } from 'zod';
8
+ // ============================================================================
9
+ // Zod Schemas for Validation
10
+ // ============================================================================
11
+ export const PipelineRequestSchema = z.object({
12
+ query: z.string().min(1, 'Query is required'),
13
+ repoPath: z.string().optional(),
14
+ userContext: z.record(z.unknown()).optional(),
15
+ sessionId: z.string().optional(),
16
+ });
17
+ export const HealthResponseSchema = z.object({
18
+ status: z.enum(['healthy', 'degraded', 'unhealthy']),
19
+ version: z.string(),
20
+ timestamp: z.string(),
21
+ services: z.object({
22
+ ollama: z.boolean(),
23
+ }),
24
+ });
25
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAqdxB,+EAA+E;AAC/E,6BAA6B;AAC7B,+EAA+E;AAE/E,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC5C,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,EAAE,mBAAmB,CAAC;IAC7C,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC/B,WAAW,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC,QAAQ,EAAE;IAC7C,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CACjC,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC3C,MAAM,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,SAAS,EAAE,UAAU,EAAE,WAAW,CAAC,CAAC;IACpD,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE;IACnB,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE;IACrB,QAAQ,EAAE,CAAC,CAAC,MAAM,CAAC;QACjB,MAAM,EAAE,CAAC,CAAC,OAAO,EAAE;KACpB,CAAC;CACH,CAAC,CAAC"}
@@ -0,0 +1,117 @@
1
+ /**
2
+ * Atlas Server - Utility Functions
3
+ *
4
+ * Shared utilities for logging, timing, error handling, and common operations.
5
+ */
6
+ import pino from 'pino';
7
+ import type { PipelineError, StageName, StageResult } from './types.js';
8
+ /**
9
+ * Create a configured pino logger instance
10
+ */
11
+ export declare function createLogger(level?: string): pino.Logger<never, boolean>;
12
+ /** Default logger instance */
13
+ export declare const logger: pino.Logger<never, boolean>;
14
+ /**
15
+ * Measure execution time of an async function
16
+ */
17
+ export declare function measureTime<T>(fn: () => Promise<T>): Promise<{
18
+ result: T;
19
+ durationMs: number;
20
+ }>;
21
+ /**
22
+ * Create a simple timer for measuring elapsed time
23
+ */
24
+ export declare function createTimer(): {
25
+ elapsed: () => number;
26
+ };
27
+ /**
28
+ * Safely stringify an object, handling circular references
29
+ */
30
+ export declare function safeStringify(obj: unknown, indent?: number): string;
31
+ /**
32
+ * Create a stage result with timing
33
+ */
34
+ export declare function executeStage<T>(name: StageName, fn: () => Promise<T>): Promise<{
35
+ stageResult: StageResult;
36
+ output: T;
37
+ }>;
38
+ /**
39
+ * Create a structured pipeline error
40
+ */
41
+ export declare function createPipelineError(code: string, message: string, stage?: StageName, details?: Record<string, unknown>): PipelineError;
42
+ /**
43
+ * Type guard to check if value is an Error
44
+ */
45
+ export declare function isError(value: unknown): value is Error;
46
+ /**
47
+ * Extract error message from unknown error type
48
+ */
49
+ export declare function getErrorMessage(error: unknown): string;
50
+ /**
51
+ * Generate a unique ID for tracking
52
+ */
53
+ export declare function generateId(): string;
54
+ /**
55
+ * Truncate string to max length with ellipsis
56
+ */
57
+ export declare function truncate(str: string, maxLength: number): string;
58
+ /**
59
+ * Clean and normalize whitespace in a string
60
+ */
61
+ export declare function normalizeWhitespace(str: string): string;
62
+ /**
63
+ * Extract code blocks from markdown text
64
+ */
65
+ export declare function extractCodeBlocks(text: string): Array<{
66
+ language: string;
67
+ code: string;
68
+ }>;
69
+ export interface RetryOptions {
70
+ /** Maximum number of attempts */
71
+ maxAttempts: number;
72
+ /** Initial delay in milliseconds */
73
+ initialDelayMs: number;
74
+ /** Maximum delay in milliseconds */
75
+ maxDelayMs: number;
76
+ /** Backoff multiplier */
77
+ backoffMultiplier: number;
78
+ }
79
+ /**
80
+ * Retry an async function with exponential backoff
81
+ */
82
+ export declare function retry<T>(fn: () => Promise<T>, options?: Partial<RetryOptions>): Promise<T>;
83
+ /**
84
+ * Sleep for a specified duration
85
+ */
86
+ export declare function sleep(ms: number): Promise<void>;
87
+ /**
88
+ * Safely parse JSON with error handling
89
+ */
90
+ export declare function safeJsonParse<T>(text: string): {
91
+ success: true;
92
+ data: T;
93
+ } | {
94
+ success: false;
95
+ error: string;
96
+ };
97
+ /**
98
+ * Extract JSON from a text that might contain markdown or other content
99
+ */
100
+ export declare function extractJson<T>(text: string): T | null;
101
+ /**
102
+ * Check if a value is defined (not null or undefined)
103
+ */
104
+ export declare function isDefined<T>(value: T | null | undefined): value is T;
105
+ /**
106
+ * Ensure a value is defined or throw
107
+ */
108
+ export declare function ensureDefined<T>(value: T | null | undefined, message: string): T;
109
+ /**
110
+ * Get current timestamp as ISO string
111
+ */
112
+ export declare function nowISO(): string;
113
+ /**
114
+ * Format milliseconds to human-readable duration
115
+ */
116
+ export declare function formatDuration(ms: number): string;
117
+ //# sourceMappingURL=utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,KAAK,EAAE,aAAa,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAMxE;;GAEG;AACH,wBAAgB,YAAY,CAAC,KAAK,GAAE,MAAe,+BAYlD;AAED,8BAA8B;AAC9B,eAAO,MAAM,MAAM,6BAAmD,CAAC;AAMvE;;GAEG;AACH,wBAAsB,WAAW,CAAC,CAAC,EACjC,EAAE,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,GACnB,OAAO,CAAC;IAAE,MAAM,EAAE,CAAC,CAAC;IAAC,UAAU,EAAE,MAAM,CAAA;CAAE,CAAC,CAK5C;AAED;;GAEG;AACH,wBAAgB,WAAW,IAAI;IAAE,OAAO,EAAE,MAAM,MAAM,CAAA;CAAE,CAKvD;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,GAAG,EAAE,OAAO,EAAE,MAAM,GAAE,MAAU,GAAG,MAAM,CAetE;AAED;;GAEG;AACH,wBAAsB,YAAY,CAAC,CAAC,EAClC,IAAI,EAAE,SAAS,EACf,EAAE,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,GACnB,OAAO,CAAC;IAAE,WAAW,EAAE,WAAW,CAAC;IAAC,MAAM,EAAE,CAAC,CAAA;CAAE,CAAC,CA+BlD;AAMD;;GAEG;AACH,wBAAgB,mBAAmB,CACjC,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,MAAM,EACf,KAAK,CAAC,EAAE,SAAS,EACjB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAChC,aAAa,CAOf;AAED;;GAEG;AACH,wBAAgB,OAAO,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,KA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