@wundam/orchex 1.0.0-rc.2 → 1.0.0-rc.21

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 (98) hide show
  1. package/README.md +59 -18
  2. package/dist/cloud-executor.d.ts +71 -0
  3. package/dist/cloud-executor.js +335 -0
  4. package/dist/cloud-sync.d.ts +8 -0
  5. package/dist/cloud-sync.js +52 -0
  6. package/dist/config.d.ts +30 -4
  7. package/dist/config.js +61 -2
  8. package/dist/context-builder.d.ts +2 -0
  9. package/dist/context-builder.js +11 -3
  10. package/dist/cost.js +1 -1
  11. package/dist/entitlements/jwt.d.ts +7 -0
  12. package/dist/entitlements/jwt.js +78 -0
  13. package/dist/entitlements/resolve.d.ts +17 -0
  14. package/dist/entitlements/resolve.js +49 -0
  15. package/dist/entitlements/types.d.ts +21 -0
  16. package/dist/entitlements/types.js +4 -0
  17. package/dist/executors/base.d.ts +1 -1
  18. package/dist/executors/bedrock-executor.d.ts +39 -0
  19. package/dist/executors/bedrock-executor.js +197 -0
  20. package/dist/executors/index.d.ts +1 -0
  21. package/dist/executors/index.js +24 -1
  22. package/dist/index.js +468 -23
  23. package/dist/intelligence/index.d.ts +44 -0
  24. package/dist/intelligence/index.js +160 -0
  25. package/dist/key-cache.d.ts +31 -0
  26. package/dist/key-cache.js +84 -0
  27. package/dist/login-helpers.d.ts +25 -0
  28. package/dist/login-helpers.js +54 -0
  29. package/dist/manifest.js +18 -1
  30. package/dist/mcp-instructions.d.ts +1 -0
  31. package/dist/mcp-instructions.js +84 -0
  32. package/dist/mcp-resources.d.ts +8 -0
  33. package/dist/mcp-resources.js +420 -0
  34. package/dist/model-cache.d.ts +18 -0
  35. package/dist/model-cache.js +62 -0
  36. package/dist/model-validator.d.ts +20 -0
  37. package/dist/model-validator.js +125 -0
  38. package/dist/orchestrator.d.ts +14 -0
  39. package/dist/orchestrator.js +191 -32
  40. package/dist/setup/ide-registry.d.ts +13 -0
  41. package/dist/setup/ide-registry.js +51 -0
  42. package/dist/setup/index.d.ts +1 -0
  43. package/dist/setup/index.js +111 -0
  44. package/dist/tier-gating.js +0 -16
  45. package/dist/tiers.d.ts +35 -5
  46. package/dist/tiers.js +39 -3
  47. package/dist/tools.d.ts +6 -1
  48. package/dist/tools.js +852 -95
  49. package/dist/types.d.ts +71 -60
  50. package/dist/types.js +3 -0
  51. package/dist/waves.d.ts +1 -1
  52. package/dist/waves.js +29 -2
  53. package/package.json +41 -5
  54. package/src/entitlements/public-key.pem +9 -0
  55. package/dist/intelligence/anti-pattern-detector.d.ts +0 -117
  56. package/dist/intelligence/anti-pattern-detector.js +0 -327
  57. package/dist/intelligence/budget-enforcer.d.ts +0 -119
  58. package/dist/intelligence/budget-enforcer.js +0 -226
  59. package/dist/intelligence/context-optimizer.d.ts +0 -111
  60. package/dist/intelligence/context-optimizer.js +0 -282
  61. package/dist/intelligence/cost-tracker.d.ts +0 -114
  62. package/dist/intelligence/cost-tracker.js +0 -183
  63. package/dist/intelligence/deliverable-extractor.d.ts +0 -134
  64. package/dist/intelligence/deliverable-extractor.js +0 -909
  65. package/dist/intelligence/dependency-inferrer.d.ts +0 -87
  66. package/dist/intelligence/dependency-inferrer.js +0 -403
  67. package/dist/intelligence/diagnostics.d.ts +0 -33
  68. package/dist/intelligence/diagnostics.js +0 -64
  69. package/dist/intelligence/error-analyzer.d.ts +0 -7
  70. package/dist/intelligence/error-analyzer.js +0 -76
  71. package/dist/intelligence/file-chunker.d.ts +0 -15
  72. package/dist/intelligence/file-chunker.js +0 -64
  73. package/dist/intelligence/fix-stream-manager.d.ts +0 -59
  74. package/dist/intelligence/fix-stream-manager.js +0 -212
  75. package/dist/intelligence/heuristics.d.ts +0 -23
  76. package/dist/intelligence/heuristics.js +0 -124
  77. package/dist/intelligence/learning-engine.d.ts +0 -157
  78. package/dist/intelligence/learning-engine.js +0 -433
  79. package/dist/intelligence/learning-feedback.d.ts +0 -96
  80. package/dist/intelligence/learning-feedback.js +0 -202
  81. package/dist/intelligence/pattern-analyzer.d.ts +0 -35
  82. package/dist/intelligence/pattern-analyzer.js +0 -189
  83. package/dist/intelligence/plan-parser.d.ts +0 -124
  84. package/dist/intelligence/plan-parser.js +0 -498
  85. package/dist/intelligence/planner.d.ts +0 -29
  86. package/dist/intelligence/planner.js +0 -86
  87. package/dist/intelligence/self-healer.d.ts +0 -16
  88. package/dist/intelligence/self-healer.js +0 -84
  89. package/dist/intelligence/slicing-metrics.d.ts +0 -62
  90. package/dist/intelligence/slicing-metrics.js +0 -202
  91. package/dist/intelligence/slicing-templates.d.ts +0 -81
  92. package/dist/intelligence/slicing-templates.js +0 -420
  93. package/dist/intelligence/split-suggester.d.ts +0 -69
  94. package/dist/intelligence/split-suggester.js +0 -176
  95. package/dist/intelligence/stream-generator.d.ts +0 -90
  96. package/dist/intelligence/stream-generator.js +0 -452
  97. package/dist/telemetry/telemetry-types.d.ts +0 -85
  98. package/dist/telemetry/telemetry-types.js +0 -1
@@ -1,117 +0,0 @@
1
- import type { StreamDefinitionInput } from '../types.js';
2
- /**
3
- * Anti-pattern detection severity levels
4
- */
5
- export type Severity = 'error' | 'warning' | 'info';
6
- /**
7
- * Detected anti-pattern issue
8
- */
9
- export interface AntiPatternIssue {
10
- type: string;
11
- severity: Severity;
12
- message: string;
13
- details?: string;
14
- streamName: string;
15
- }
16
- /**
17
- * Analysis result for a stream definition
18
- */
19
- export interface StreamAnalysis {
20
- streamName: string;
21
- qualityScore: number;
22
- issues: AntiPatternIssue[];
23
- metrics: {
24
- ownsCount: number;
25
- readsCount: number;
26
- directoriesAffected: number;
27
- planConjunctions: number;
28
- verifyCommands: number;
29
- actionTypes: string[];
30
- fileTypes: Set<string>;
31
- };
32
- }
33
- /**
34
- * Batch analysis result for multiple streams
35
- */
36
- export interface BatchAnalysisResult {
37
- streams: StreamAnalysis[];
38
- overallScore: number;
39
- totalIssues: {
40
- errors: number;
41
- warnings: number;
42
- info: number;
43
- };
44
- }
45
- /**
46
- * Configuration for anti-pattern detection thresholds
47
- */
48
- export interface DetectorConfig {
49
- maxOwnsCount: number;
50
- maxReadsCount: number;
51
- maxDirectories: number;
52
- maxPlanConjunctions: number;
53
- warnOnMixedActions: boolean;
54
- warnOnMixedFileTypes: boolean;
55
- requireVerifyCommands: boolean;
56
- }
57
- /**
58
- * Anti-pattern detector for stream definitions
59
- */
60
- export declare class AntiPatternDetector {
61
- private config;
62
- constructor(config?: DetectorConfig);
63
- /**
64
- * Analyze a single stream definition for anti-patterns.
65
- * Accepts StreamDefinitionInput (partial) or StreamDefinition (parsed).
66
- */
67
- analyzeStream(name: string, stream: StreamDefinitionInput): StreamAnalysis;
68
- /**
69
- * Analyze multiple stream definitions.
70
- * Accepts StreamDefinitionInput (partial) or StreamDefinition (parsed).
71
- */
72
- analyzeStreams(streams: Record<string, StreamDefinitionInput>): BatchAnalysisResult;
73
- /**
74
- * Count unique directories affected by file paths
75
- */
76
- private countDirectories;
77
- /**
78
- * Count 'and' conjunctions in plan text
79
- */
80
- private countConjunctions;
81
- /**
82
- * Detect action types from plan text
83
- */
84
- private detectActionTypes;
85
- /**
86
- * Detect file types from paths
87
- */
88
- private detectFileTypes;
89
- /**
90
- * Check if stream has mixed structural and content actions
91
- */
92
- private hasMixedActions;
93
- /**
94
- * Check if stream creates tutorials without specific file ownership
95
- */
96
- private hasUnboundedTutorial;
97
- /**
98
- * Check if plan is too vague
99
- */
100
- private hasVaguePlan;
101
- /**
102
- * Calculate quality score (0-100) based on issues and metrics
103
- */
104
- private calculateQualityScore;
105
- /**
106
- * Calculate overall quality score for multiple streams
107
- */
108
- private calculateOverallScore;
109
- /**
110
- * Count issues by severity
111
- */
112
- private countIssuesBySeverity;
113
- }
114
- /**
115
- * Create a detector with default configuration
116
- */
117
- export declare function createDetector(config?: Partial<DetectorConfig>): AntiPatternDetector;
@@ -1,327 +0,0 @@
1
- const DEFAULT_CONFIG = {
2
- maxOwnsCount: 4,
3
- maxReadsCount: 4,
4
- maxDirectories: 2,
5
- maxPlanConjunctions: 4,
6
- warnOnMixedActions: true,
7
- warnOnMixedFileTypes: true,
8
- requireVerifyCommands: true,
9
- };
10
- /**
11
- * Anti-pattern detector for stream definitions
12
- */
13
- export class AntiPatternDetector {
14
- config;
15
- constructor(config = DEFAULT_CONFIG) {
16
- this.config = config;
17
- }
18
- /**
19
- * Analyze a single stream definition for anti-patterns.
20
- * Accepts StreamDefinitionInput (partial) or StreamDefinition (parsed).
21
- */
22
- analyzeStream(name, stream) {
23
- const issues = [];
24
- const owns = stream.owns || [];
25
- const reads = stream.reads || [];
26
- const plan = stream.plan || '';
27
- const verify = stream.verify || [];
28
- // Calculate metrics
29
- const ownsCount = owns.length;
30
- const readsCount = reads.length;
31
- const directoriesAffected = this.countDirectories(owns);
32
- const planConjunctions = this.countConjunctions(plan);
33
- const verifyCommands = verify.length;
34
- const actionTypes = this.detectActionTypes(plan);
35
- const fileTypes = this.detectFileTypes([...owns, ...reads]);
36
- const metrics = {
37
- ownsCount,
38
- readsCount,
39
- directoriesAffected,
40
- planConjunctions,
41
- verifyCommands,
42
- actionTypes,
43
- fileTypes,
44
- };
45
- // Check for high owns count
46
- if (ownsCount > this.config.maxOwnsCount && directoriesAffected > this.config.maxDirectories) {
47
- issues.push({
48
- type: 'high_owns_complexity',
49
- severity: 'error',
50
- message: `Stream owns ${ownsCount} files across ${directoriesAffected} directories`,
51
- details: `Consider splitting into smaller streams. Threshold: ${this.config.maxOwnsCount} files across ${this.config.maxDirectories} directories`,
52
- streamName: name,
53
- });
54
- }
55
- else if (ownsCount > this.config.maxOwnsCount) {
56
- issues.push({
57
- type: 'high_owns_count',
58
- severity: 'warning',
59
- message: `Stream owns ${ownsCount} files (threshold: ${this.config.maxOwnsCount})`,
60
- details: 'Consider splitting into smaller, more focused streams',
61
- streamName: name,
62
- });
63
- }
64
- // Check for high reads count
65
- if (readsCount > this.config.maxReadsCount) {
66
- issues.push({
67
- type: 'high_reads_count',
68
- severity: 'warning',
69
- message: `Stream reads ${readsCount} files (threshold: ${this.config.maxReadsCount})`,
70
- details: 'Too many dependencies may indicate unclear scope or context bloat',
71
- streamName: name,
72
- });
73
- }
74
- // Check for compound plans
75
- if (planConjunctions > this.config.maxPlanConjunctions) {
76
- issues.push({
77
- type: 'compound_plan',
78
- severity: 'warning',
79
- message: `Plan contains ${planConjunctions} 'and' conjunctions (threshold: ${this.config.maxPlanConjunctions})`,
80
- details: 'Complex plans with multiple actions should be split into separate streams',
81
- streamName: name,
82
- });
83
- }
84
- // Check for mixed structure/content actions
85
- if (this.config.warnOnMixedActions && this.hasMixedActions(actionTypes)) {
86
- issues.push({
87
- type: 'mixed_actions',
88
- severity: 'warning',
89
- message: 'Stream mixes structural changes with content changes',
90
- details: `Detected actions: ${actionTypes.join(', ')}. Consider separating setup/structure from implementation`,
91
- streamName: name,
92
- });
93
- }
94
- // Check for unbounded tutorials
95
- if (this.hasUnboundedTutorial(plan, owns)) {
96
- issues.push({
97
- type: 'unbounded_tutorial',
98
- severity: 'error',
99
- message: 'Stream appears to create tutorial/documentation without specific file ownership',
100
- details: 'Tutorial or documentation streams must specify exact files in owns[]',
101
- streamName: name,
102
- });
103
- }
104
- // Check for mixed file types
105
- if (this.config.warnOnMixedFileTypes && fileTypes.size > 3) {
106
- issues.push({
107
- type: 'mixed_file_types',
108
- severity: 'info',
109
- message: `Stream touches ${fileTypes.size} different file types`,
110
- details: `File types: ${Array.from(fileTypes).join(', ')}. Consider organizing by concern`,
111
- streamName: name,
112
- });
113
- }
114
- // Check for missing verify commands
115
- if (this.config.requireVerifyCommands && verifyCommands === 0 && ownsCount > 0) {
116
- issues.push({
117
- type: 'no_verify',
118
- severity: 'warning',
119
- message: 'Stream has no verify commands',
120
- details: 'Add verify commands to ensure implementation correctness',
121
- streamName: name,
122
- });
123
- }
124
- // Check for empty plan
125
- if (!plan || plan.trim().length === 0) {
126
- issues.push({
127
- type: 'empty_plan',
128
- severity: 'error',
129
- message: 'Stream has no plan description',
130
- details: 'Every stream must have a clear plan describing what it does',
131
- streamName: name,
132
- });
133
- }
134
- // Check for vague plans
135
- if (this.hasVaguePlan(plan)) {
136
- issues.push({
137
- type: 'vague_plan',
138
- severity: 'info',
139
- message: 'Plan may be too vague or generic',
140
- details: 'Use specific, actionable language describing exact changes',
141
- streamName: name,
142
- });
143
- }
144
- const qualityScore = this.calculateQualityScore(issues, metrics);
145
- return {
146
- streamName: name,
147
- qualityScore,
148
- issues,
149
- metrics,
150
- };
151
- }
152
- /**
153
- * Analyze multiple stream definitions.
154
- * Accepts StreamDefinitionInput (partial) or StreamDefinition (parsed).
155
- */
156
- analyzeStreams(streams) {
157
- const streamAnalyses = [];
158
- for (const [name, stream] of Object.entries(streams)) {
159
- streamAnalyses.push(this.analyzeStream(name, stream));
160
- }
161
- const totalIssues = this.countIssuesBySeverity(streamAnalyses);
162
- const overallScore = this.calculateOverallScore(streamAnalyses);
163
- return {
164
- streams: streamAnalyses,
165
- overallScore,
166
- totalIssues,
167
- };
168
- }
169
- /**
170
- * Count unique directories affected by file paths
171
- */
172
- countDirectories(files) {
173
- const dirs = new Set();
174
- for (const file of files) {
175
- const dir = file.substring(0, file.lastIndexOf('/'));
176
- if (dir) {
177
- dirs.add(dir);
178
- }
179
- else {
180
- dirs.add('.');
181
- }
182
- }
183
- return dirs.size;
184
- }
185
- /**
186
- * Count 'and' conjunctions in plan text
187
- */
188
- countConjunctions(plan) {
189
- const normalized = plan.toLowerCase();
190
- const matches = normalized.match(/\band\b/g);
191
- return matches ? matches.length : 0;
192
- }
193
- /**
194
- * Detect action types from plan text
195
- */
196
- detectActionTypes(plan) {
197
- const normalized = plan.toLowerCase();
198
- const actions = [];
199
- const patterns = [
200
- { type: 'create', pattern: /\b(create|add|implement|build)\b/ },
201
- { type: 'update', pattern: /\b(update|modify|change|edit|refactor)\b/ },
202
- { type: 'delete', pattern: /\b(delete|remove)\b/ },
203
- { type: 'configure', pattern: /\b(configure|setup|install)\b/ },
204
- { type: 'test', pattern: /\b(test|verify)\b/ },
205
- { type: 'document', pattern: /\b(document|write|tutorial)\b/ },
206
- ];
207
- for (const { type, pattern } of patterns) {
208
- if (pattern.test(normalized)) {
209
- actions.push(type);
210
- }
211
- }
212
- return actions;
213
- }
214
- /**
215
- * Detect file types from paths
216
- */
217
- detectFileTypes(files) {
218
- const types = new Set();
219
- for (const file of files) {
220
- const ext = file.substring(file.lastIndexOf('.') + 1).toLowerCase();
221
- if (ext && ext !== file) {
222
- types.add(ext);
223
- }
224
- }
225
- return types;
226
- }
227
- /**
228
- * Check if stream has mixed structural and content actions
229
- */
230
- hasMixedActions(actionTypes) {
231
- const structural = ['create', 'delete', 'configure'];
232
- const content = ['update', 'document'];
233
- const hasStructural = actionTypes.some(a => structural.includes(a));
234
- const hasContent = actionTypes.some(a => content.includes(a));
235
- return hasStructural && hasContent;
236
- }
237
- /**
238
- * Check if stream creates tutorials without specific file ownership
239
- */
240
- hasUnboundedTutorial(plan, owns) {
241
- const normalized = plan.toLowerCase();
242
- const isTutorial = /\b(tutorial|guide|documentation|example)\b/.test(normalized);
243
- return isTutorial && owns.length === 0;
244
- }
245
- /**
246
- * Check if plan is too vague
247
- */
248
- hasVaguePlan(plan) {
249
- const normalized = plan.toLowerCase();
250
- const vagueWords = ['various', 'some', 'multiple', 'general', 'misc', 'other', 'stuff', 'things'];
251
- for (const word of vagueWords) {
252
- if (normalized.includes(word)) {
253
- return true;
254
- }
255
- }
256
- // Check if plan is too short
257
- return plan.trim().split(/\s+/).length < 5;
258
- }
259
- /**
260
- * Calculate quality score (0-100) based on issues and metrics
261
- */
262
- calculateQualityScore(issues, metrics) {
263
- let score = 100;
264
- // Deduct points for issues
265
- for (const issue of issues) {
266
- switch (issue.severity) {
267
- case 'error':
268
- score -= 20;
269
- break;
270
- case 'warning':
271
- score -= 10;
272
- break;
273
- case 'info':
274
- score -= 5;
275
- break;
276
- }
277
- }
278
- // Bonus for good practices
279
- if (metrics.verifyCommands > 0) {
280
- score += 5;
281
- }
282
- if (metrics.ownsCount > 0 && metrics.ownsCount <= 3) {
283
- score += 5;
284
- }
285
- if (metrics.planConjunctions === 0) {
286
- score += 5;
287
- }
288
- return Math.max(0, Math.min(100, score));
289
- }
290
- /**
291
- * Calculate overall quality score for multiple streams
292
- */
293
- calculateOverallScore(analyses) {
294
- if (analyses.length === 0)
295
- return 0;
296
- const sum = analyses.reduce((acc, a) => acc + a.qualityScore, 0);
297
- return Math.round(sum / analyses.length);
298
- }
299
- /**
300
- * Count issues by severity
301
- */
302
- countIssuesBySeverity(analyses) {
303
- const counts = { errors: 0, warnings: 0, info: 0 };
304
- for (const analysis of analyses) {
305
- for (const issue of analysis.issues) {
306
- switch (issue.severity) {
307
- case 'error':
308
- counts.errors++;
309
- break;
310
- case 'warning':
311
- counts.warnings++;
312
- break;
313
- case 'info':
314
- counts.info++;
315
- break;
316
- }
317
- }
318
- }
319
- return counts;
320
- }
321
- }
322
- /**
323
- * Create a detector with default configuration
324
- */
325
- export function createDetector(config) {
326
- return new AntiPatternDetector({ ...DEFAULT_CONFIG, ...config });
327
- }
@@ -1,119 +0,0 @@
1
- /**
2
- * Context budget enforcement for Orchex Learn.
3
- * Implements soft/hard limit checking with provider-aware context limits.
4
- */
5
- import type { ContextBudget, EnforcementLevel, BudgetViolationType } from '../types.js';
6
- /**
7
- * Provider-specific context window limits (in tokens).
8
- * These represent the maximum input context size for each provider's models.
9
- */
10
- export declare const PROVIDER_CONTEXT_LIMITS: Record<string, number>;
11
- /**
12
- * Model-specific context limits (overrides provider defaults).
13
- */
14
- export declare const MODEL_CONTEXT_LIMITS: Record<string, number>;
15
- /** Default soft limit as percentage of provider limit */
16
- export declare const DEFAULT_SOFT_LIMIT_RATIO = 0.7;
17
- /** Default hard limit as percentage of provider limit */
18
- export declare const DEFAULT_HARD_LIMIT_RATIO = 0.9;
19
- /** Default warning threshold (start warning at 80% of soft limit) */
20
- export declare const DEFAULT_WARNING_THRESHOLD = 0.8;
21
- /**
22
- * Configuration for budget checking.
23
- */
24
- export interface BudgetConfig {
25
- /** Enforcement level: warn, soft, or hard */
26
- enforcementLevel: EnforcementLevel;
27
- /** Soft limit in tokens */
28
- softLimitTokens: number;
29
- /** Hard limit in tokens */
30
- hardLimitTokens: number;
31
- /** Warning threshold (0-1) */
32
- warningThreshold: number;
33
- /** Provider name */
34
- provider: string;
35
- /** Model name (optional, for more specific limits) */
36
- model?: string;
37
- }
38
- /**
39
- * Result of checking context against budget.
40
- */
41
- export interface BudgetCheckResult {
42
- /** Whether execution is allowed (considering enforcement level) */
43
- allowed: boolean;
44
- /** Type of violation (none, soft, hard) */
45
- violationType: BudgetViolationType;
46
- /** Estimated tokens for this context */
47
- estimatedTokens: number;
48
- /** The limit that was checked against */
49
- budgetLimit: number;
50
- /** Utilization ratio (0-1) */
51
- utilizationRatio: number;
52
- /** Warning message if applicable */
53
- warning?: string;
54
- /** Suggestion for reducing context size */
55
- suggestion?: string;
56
- /** Provider context limit for reference */
57
- providerLimit: number;
58
- }
59
- /**
60
- * Get the context limit for a provider, optionally with model-specific override.
61
- */
62
- export declare function getProviderLimit(provider: string, model?: string): number;
63
- /**
64
- * Create a budget config from manifest/stream settings and provider info.
65
- */
66
- export declare function createBudgetConfig(budget: ContextBudget | undefined, provider: string, model?: string): BudgetConfig;
67
- /**
68
- * Generate a suggestion for reducing context size.
69
- */
70
- export declare function getSuggestion(violationType: BudgetViolationType, estimatedTokens: number, limit: number): string;
71
- /**
72
- * Check estimated context size against budget limits.
73
- *
74
- * @param estimatedTokens - Estimated context tokens
75
- * @param config - Budget configuration
76
- * @returns Check result with violation status and suggestions
77
- */
78
- export declare function checkBudget(estimatedTokens: number, config: BudgetConfig): BudgetCheckResult;
79
- /**
80
- * Analyze multiple streams for budget issues before execution.
81
- * Useful for validating at init time.
82
- */
83
- export interface StreamBudgetAnalysis {
84
- streamId: string;
85
- estimatedTokens: number;
86
- check: BudgetCheckResult;
87
- }
88
- export interface BudgetAnalysisResult {
89
- /** Total estimated tokens across all streams */
90
- totalEstimatedTokens: number;
91
- /** Streams that exceed soft limit */
92
- streamsAtRisk: string[];
93
- /** Streams that exceed hard limit */
94
- streamsTooLarge: string[];
95
- /** Whether any hard violations exist */
96
- hasHardViolations: boolean;
97
- /** Whether any soft violations exist */
98
- hasSoftViolations: boolean;
99
- /** Individual stream analyses */
100
- analyses: StreamBudgetAnalysis[];
101
- /** Warning messages */
102
- warnings: string[];
103
- }
104
- /**
105
- * Analyze budget for multiple streams.
106
- *
107
- * @param streams - Map of stream ID to estimated tokens
108
- * @param config - Budget configuration
109
- * @returns Analysis result with warnings and violation details
110
- */
111
- export declare function analyzeStreamBudgets(streams: Map<string, number>, config: BudgetConfig): BudgetAnalysisResult;
112
- /**
113
- * Custom error for budget exceeded scenarios.
114
- */
115
- export declare class ContextBudgetExceededError extends Error {
116
- readonly checkResult: BudgetCheckResult;
117
- readonly streamId?: string | undefined;
118
- constructor(checkResult: BudgetCheckResult, streamId?: string | undefined);
119
- }