@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.
- package/README.md +59 -18
- package/dist/cloud-executor.d.ts +71 -0
- package/dist/cloud-executor.js +335 -0
- package/dist/cloud-sync.d.ts +8 -0
- package/dist/cloud-sync.js +52 -0
- package/dist/config.d.ts +30 -4
- package/dist/config.js +61 -2
- package/dist/context-builder.d.ts +2 -0
- package/dist/context-builder.js +11 -3
- package/dist/cost.js +1 -1
- package/dist/entitlements/jwt.d.ts +7 -0
- package/dist/entitlements/jwt.js +78 -0
- package/dist/entitlements/resolve.d.ts +17 -0
- package/dist/entitlements/resolve.js +49 -0
- package/dist/entitlements/types.d.ts +21 -0
- package/dist/entitlements/types.js +4 -0
- package/dist/executors/base.d.ts +1 -1
- package/dist/executors/bedrock-executor.d.ts +39 -0
- package/dist/executors/bedrock-executor.js +197 -0
- package/dist/executors/index.d.ts +1 -0
- package/dist/executors/index.js +24 -1
- package/dist/index.js +468 -23
- package/dist/intelligence/index.d.ts +44 -0
- package/dist/intelligence/index.js +160 -0
- package/dist/key-cache.d.ts +31 -0
- package/dist/key-cache.js +84 -0
- package/dist/login-helpers.d.ts +25 -0
- package/dist/login-helpers.js +54 -0
- package/dist/manifest.js +18 -1
- package/dist/mcp-instructions.d.ts +1 -0
- package/dist/mcp-instructions.js +84 -0
- package/dist/mcp-resources.d.ts +8 -0
- package/dist/mcp-resources.js +420 -0
- package/dist/model-cache.d.ts +18 -0
- package/dist/model-cache.js +62 -0
- package/dist/model-validator.d.ts +20 -0
- package/dist/model-validator.js +125 -0
- package/dist/orchestrator.d.ts +14 -0
- package/dist/orchestrator.js +191 -32
- package/dist/setup/ide-registry.d.ts +13 -0
- package/dist/setup/ide-registry.js +51 -0
- package/dist/setup/index.d.ts +1 -0
- package/dist/setup/index.js +111 -0
- package/dist/tier-gating.js +0 -16
- package/dist/tiers.d.ts +35 -5
- package/dist/tiers.js +39 -3
- package/dist/tools.d.ts +6 -1
- package/dist/tools.js +852 -95
- package/dist/types.d.ts +71 -60
- package/dist/types.js +3 -0
- package/dist/waves.d.ts +1 -1
- package/dist/waves.js +29 -2
- package/package.json +41 -5
- package/src/entitlements/public-key.pem +9 -0
- package/dist/intelligence/anti-pattern-detector.d.ts +0 -117
- package/dist/intelligence/anti-pattern-detector.js +0 -327
- package/dist/intelligence/budget-enforcer.d.ts +0 -119
- package/dist/intelligence/budget-enforcer.js +0 -226
- package/dist/intelligence/context-optimizer.d.ts +0 -111
- package/dist/intelligence/context-optimizer.js +0 -282
- package/dist/intelligence/cost-tracker.d.ts +0 -114
- package/dist/intelligence/cost-tracker.js +0 -183
- package/dist/intelligence/deliverable-extractor.d.ts +0 -134
- package/dist/intelligence/deliverable-extractor.js +0 -909
- package/dist/intelligence/dependency-inferrer.d.ts +0 -87
- package/dist/intelligence/dependency-inferrer.js +0 -403
- package/dist/intelligence/diagnostics.d.ts +0 -33
- package/dist/intelligence/diagnostics.js +0 -64
- package/dist/intelligence/error-analyzer.d.ts +0 -7
- package/dist/intelligence/error-analyzer.js +0 -76
- package/dist/intelligence/file-chunker.d.ts +0 -15
- package/dist/intelligence/file-chunker.js +0 -64
- package/dist/intelligence/fix-stream-manager.d.ts +0 -59
- package/dist/intelligence/fix-stream-manager.js +0 -212
- package/dist/intelligence/heuristics.d.ts +0 -23
- package/dist/intelligence/heuristics.js +0 -124
- package/dist/intelligence/learning-engine.d.ts +0 -157
- package/dist/intelligence/learning-engine.js +0 -433
- package/dist/intelligence/learning-feedback.d.ts +0 -96
- package/dist/intelligence/learning-feedback.js +0 -202
- package/dist/intelligence/pattern-analyzer.d.ts +0 -35
- package/dist/intelligence/pattern-analyzer.js +0 -189
- package/dist/intelligence/plan-parser.d.ts +0 -124
- package/dist/intelligence/plan-parser.js +0 -498
- package/dist/intelligence/planner.d.ts +0 -29
- package/dist/intelligence/planner.js +0 -86
- package/dist/intelligence/self-healer.d.ts +0 -16
- package/dist/intelligence/self-healer.js +0 -84
- package/dist/intelligence/slicing-metrics.d.ts +0 -62
- package/dist/intelligence/slicing-metrics.js +0 -202
- package/dist/intelligence/slicing-templates.d.ts +0 -81
- package/dist/intelligence/slicing-templates.js +0 -420
- package/dist/intelligence/split-suggester.d.ts +0 -69
- package/dist/intelligence/split-suggester.js +0 -176
- package/dist/intelligence/stream-generator.d.ts +0 -90
- package/dist/intelligence/stream-generator.js +0 -452
- package/dist/telemetry/telemetry-types.d.ts +0 -85
- package/dist/telemetry/telemetry-types.js +0 -1
|
@@ -1,114 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Token cost tracking and estimation for Orchex Learn.
|
|
3
|
-
* Provides cost estimation and aggregation for multi-provider token usage.
|
|
4
|
-
*/
|
|
5
|
-
import type { TelemetryEvent } from '../telemetry/telemetry-types.js';
|
|
6
|
-
/**
|
|
7
|
-
* Token costs per 1000 tokens (in USD).
|
|
8
|
-
* Prices as of February 2026 - should be updated periodically.
|
|
9
|
-
*
|
|
10
|
-
* Reference (per 1M tokens):
|
|
11
|
-
* - DeepSeek V3.2: $0.28 / $0.42 (~95% cheaper than Claude)
|
|
12
|
-
* - Gemini 2.5 Pro: $1.25 / $10.00 (~60% cheaper than Claude)
|
|
13
|
-
* - Claude Sonnet: $3.00 / $15.00 (baseline)
|
|
14
|
-
* - OpenAI GPT-4o: $5.00 / $15.00 (~40% more than Claude)
|
|
15
|
-
* - Claude Opus: $15.00 / $75.00 (5x Claude Sonnet)
|
|
16
|
-
*/
|
|
17
|
-
export declare const TOKEN_COSTS: Record<string, {
|
|
18
|
-
input: number;
|
|
19
|
-
output: number;
|
|
20
|
-
}>;
|
|
21
|
-
/**
|
|
22
|
-
* Cache discount rate for Anthropic prompt caching.
|
|
23
|
-
* Cached tokens cost 90% less than regular input tokens.
|
|
24
|
-
*/
|
|
25
|
-
export declare const CACHE_DISCOUNT_RATE = 0.9;
|
|
26
|
-
/**
|
|
27
|
-
* Cost estimate for a single execution.
|
|
28
|
-
*/
|
|
29
|
-
export interface CostEstimate {
|
|
30
|
-
/** Number of input tokens */
|
|
31
|
-
inputTokens: number;
|
|
32
|
-
/** Number of output tokens */
|
|
33
|
-
outputTokens: number;
|
|
34
|
-
/** Cost for input tokens (USD) */
|
|
35
|
-
inputCost: number;
|
|
36
|
-
/** Cost for output tokens (USD) */
|
|
37
|
-
outputCost: number;
|
|
38
|
-
/** Total cost before cache savings (USD) */
|
|
39
|
-
totalCost: number;
|
|
40
|
-
/** Tokens read from cache (if applicable) */
|
|
41
|
-
cacheHitTokens?: number;
|
|
42
|
-
/** Estimated savings from cache (USD) */
|
|
43
|
-
cacheDiscount?: number;
|
|
44
|
-
/** Final cost after cache discount (USD) */
|
|
45
|
-
finalCost: number;
|
|
46
|
-
/** Model used for this estimate */
|
|
47
|
-
model: string;
|
|
48
|
-
}
|
|
49
|
-
/**
|
|
50
|
-
* Aggregated cost summary across multiple executions.
|
|
51
|
-
*/
|
|
52
|
-
export interface CostSummary {
|
|
53
|
-
/** Total cost across all executions (USD) */
|
|
54
|
-
totalCost: number;
|
|
55
|
-
/** Total input tokens */
|
|
56
|
-
totalInputTokens: number;
|
|
57
|
-
/** Total output tokens */
|
|
58
|
-
totalOutputTokens: number;
|
|
59
|
-
/** Total cache hit tokens */
|
|
60
|
-
totalCacheHitTokens: number;
|
|
61
|
-
/** Total savings from cache (USD) */
|
|
62
|
-
totalCacheSavings: number;
|
|
63
|
-
/** Final cost after cache discounts (USD) */
|
|
64
|
-
finalCost: number;
|
|
65
|
-
/** Cost breakdown by provider */
|
|
66
|
-
byProvider: Record<string, number>;
|
|
67
|
-
/** Cost breakdown by model */
|
|
68
|
-
byModel: Record<string, number>;
|
|
69
|
-
/** Number of executions */
|
|
70
|
-
executionCount: number;
|
|
71
|
-
/** Average cost per execution (USD) */
|
|
72
|
-
avgCostPerExecution: number;
|
|
73
|
-
}
|
|
74
|
-
/**
|
|
75
|
-
* Get token costs for a model, falling back to default if unknown.
|
|
76
|
-
*/
|
|
77
|
-
export declare function getModelCosts(model: string): {
|
|
78
|
-
input: number;
|
|
79
|
-
output: number;
|
|
80
|
-
};
|
|
81
|
-
/**
|
|
82
|
-
* Estimate cost for a single execution.
|
|
83
|
-
*
|
|
84
|
-
* @param inputTokens - Number of input tokens
|
|
85
|
-
* @param outputTokens - Number of output tokens
|
|
86
|
-
* @param model - Model identifier
|
|
87
|
-
* @param cacheHitTokens - Optional tokens read from cache
|
|
88
|
-
* @returns Cost estimate with breakdown
|
|
89
|
-
*/
|
|
90
|
-
export declare function estimateCost(inputTokens: number, outputTokens: number, model: string, cacheHitTokens?: number): CostEstimate;
|
|
91
|
-
/**
|
|
92
|
-
* Aggregate costs from multiple telemetry events.
|
|
93
|
-
*
|
|
94
|
-
* @param events - Array of telemetry events with token data
|
|
95
|
-
* @returns Aggregated cost summary
|
|
96
|
-
*/
|
|
97
|
-
export declare function aggregateCosts(events: TelemetryEvent[]): CostSummary;
|
|
98
|
-
/**
|
|
99
|
-
* Format a cost value for display.
|
|
100
|
-
*
|
|
101
|
-
* @param cost - Cost in USD
|
|
102
|
-
* @returns Formatted string like "$0.0123" or "<$0.01"
|
|
103
|
-
*/
|
|
104
|
-
export declare function formatCost(cost: number): string;
|
|
105
|
-
/**
|
|
106
|
-
* Estimate cost for a planned execution based on token estimates.
|
|
107
|
-
* Useful for budget warnings before execution.
|
|
108
|
-
*
|
|
109
|
-
* @param estimatedInputTokens - Estimated input tokens
|
|
110
|
-
* @param model - Model to use
|
|
111
|
-
* @param estimatedOutputRatio - Expected output/input ratio (default 0.3)
|
|
112
|
-
* @returns Cost estimate
|
|
113
|
-
*/
|
|
114
|
-
export declare function estimatePlannedCost(estimatedInputTokens: number, model: string, estimatedOutputRatio?: number): CostEstimate;
|
|
@@ -1,183 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Token cost tracking and estimation for Orchex Learn.
|
|
3
|
-
* Provides cost estimation and aggregation for multi-provider token usage.
|
|
4
|
-
*/
|
|
5
|
-
/**
|
|
6
|
-
* Token costs per 1000 tokens (in USD).
|
|
7
|
-
* Prices as of February 2026 - should be updated periodically.
|
|
8
|
-
*
|
|
9
|
-
* Reference (per 1M tokens):
|
|
10
|
-
* - DeepSeek V3.2: $0.28 / $0.42 (~95% cheaper than Claude)
|
|
11
|
-
* - Gemini 2.5 Pro: $1.25 / $10.00 (~60% cheaper than Claude)
|
|
12
|
-
* - Claude Sonnet: $3.00 / $15.00 (baseline)
|
|
13
|
-
* - OpenAI GPT-4o: $5.00 / $15.00 (~40% more than Claude)
|
|
14
|
-
* - Claude Opus: $15.00 / $75.00 (5x Claude Sonnet)
|
|
15
|
-
*/
|
|
16
|
-
export const TOKEN_COSTS = {
|
|
17
|
-
// Anthropic models (Feb 2026)
|
|
18
|
-
'claude-opus-4-5-20251101': { input: 0.015, output: 0.075 },
|
|
19
|
-
'claude-sonnet-4-5-20250929': { input: 0.003, output: 0.015 },
|
|
20
|
-
'claude-sonnet-4-20250514': { input: 0.003, output: 0.015 },
|
|
21
|
-
'claude-3-5-sonnet-20241022': { input: 0.003, output: 0.015 },
|
|
22
|
-
'claude-3-opus-20240229': { input: 0.015, output: 0.075 },
|
|
23
|
-
'claude-3-haiku-20240307': { input: 0.00025, output: 0.00125 },
|
|
24
|
-
// OpenAI models (Feb 2026)
|
|
25
|
-
'gpt-4.5-turbo': { input: 0.005, output: 0.015 },
|
|
26
|
-
'gpt-4-turbo': { input: 0.01, output: 0.03 },
|
|
27
|
-
'gpt-4-turbo-preview': { input: 0.01, output: 0.03 },
|
|
28
|
-
'gpt-4o': { input: 0.005, output: 0.015 },
|
|
29
|
-
'gpt-4o-mini': { input: 0.00015, output: 0.0006 },
|
|
30
|
-
'o1-preview': { input: 0.015, output: 0.06 },
|
|
31
|
-
'o1-mini': { input: 0.003, output: 0.012 },
|
|
32
|
-
'o3-mini': { input: 0.0011, output: 0.0044 },
|
|
33
|
-
'gpt-3.5-turbo': { input: 0.0005, output: 0.0015 },
|
|
34
|
-
// Google models (Feb 2026)
|
|
35
|
-
'gemini-2.5-pro': { input: 0.00125, output: 0.01 },
|
|
36
|
-
'gemini-2.0-flash': { input: 0.0001, output: 0.0004 },
|
|
37
|
-
'gemini-1.5-pro': { input: 0.00125, output: 0.005 },
|
|
38
|
-
'gemini-1.5-flash': { input: 0.000075, output: 0.0003 },
|
|
39
|
-
'gemini-pro': { input: 0.000125, output: 0.000375 },
|
|
40
|
-
// DeepSeek models (Feb 2026) — ~95% cheaper than Claude!
|
|
41
|
-
'deepseek-chat': { input: 0.00028, output: 0.00042 },
|
|
42
|
-
'deepseek-coder': { input: 0.00028, output: 0.00042 },
|
|
43
|
-
'deepseek-reasoner': { input: 0.00055, output: 0.00219 },
|
|
44
|
-
// Ollama/Local (free but track for comparison)
|
|
45
|
-
'llama3.3:70b': { input: 0, output: 0 },
|
|
46
|
-
'llama3.2:latest': { input: 0, output: 0 },
|
|
47
|
-
'mistral:latest': { input: 0, output: 0 },
|
|
48
|
-
// Default fallback (conservative estimate)
|
|
49
|
-
default: { input: 0.003, output: 0.015 },
|
|
50
|
-
};
|
|
51
|
-
/**
|
|
52
|
-
* Cache discount rate for Anthropic prompt caching.
|
|
53
|
-
* Cached tokens cost 90% less than regular input tokens.
|
|
54
|
-
*/
|
|
55
|
-
export const CACHE_DISCOUNT_RATE = 0.9;
|
|
56
|
-
/**
|
|
57
|
-
* Get token costs for a model, falling back to default if unknown.
|
|
58
|
-
*/
|
|
59
|
-
export function getModelCosts(model) {
|
|
60
|
-
// Try exact match first
|
|
61
|
-
if (TOKEN_COSTS[model]) {
|
|
62
|
-
return TOKEN_COSTS[model];
|
|
63
|
-
}
|
|
64
|
-
// Try to match by prefix (handles versioned model names)
|
|
65
|
-
const modelLower = model.toLowerCase();
|
|
66
|
-
for (const [key, costs] of Object.entries(TOKEN_COSTS)) {
|
|
67
|
-
if (key !== 'default' && modelLower.includes(key.split('-').slice(0, 2).join('-'))) {
|
|
68
|
-
return costs;
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
return TOKEN_COSTS.default;
|
|
72
|
-
}
|
|
73
|
-
/**
|
|
74
|
-
* Estimate cost for a single execution.
|
|
75
|
-
*
|
|
76
|
-
* @param inputTokens - Number of input tokens
|
|
77
|
-
* @param outputTokens - Number of output tokens
|
|
78
|
-
* @param model - Model identifier
|
|
79
|
-
* @param cacheHitTokens - Optional tokens read from cache
|
|
80
|
-
* @returns Cost estimate with breakdown
|
|
81
|
-
*/
|
|
82
|
-
export function estimateCost(inputTokens, outputTokens, model, cacheHitTokens) {
|
|
83
|
-
const costs = getModelCosts(model);
|
|
84
|
-
// Calculate base costs (per 1000 tokens)
|
|
85
|
-
const inputCost = (inputTokens / 1000) * costs.input;
|
|
86
|
-
const outputCost = (outputTokens / 1000) * costs.output;
|
|
87
|
-
const totalCost = inputCost + outputCost;
|
|
88
|
-
// Calculate cache discount
|
|
89
|
-
let cacheDiscount;
|
|
90
|
-
if (cacheHitTokens && cacheHitTokens > 0) {
|
|
91
|
-
// Cache hits save CACHE_DISCOUNT_RATE of the input cost for those tokens
|
|
92
|
-
cacheDiscount = (cacheHitTokens / 1000) * costs.input * CACHE_DISCOUNT_RATE;
|
|
93
|
-
}
|
|
94
|
-
const finalCost = totalCost - (cacheDiscount ?? 0);
|
|
95
|
-
return {
|
|
96
|
-
inputTokens,
|
|
97
|
-
outputTokens,
|
|
98
|
-
inputCost,
|
|
99
|
-
outputCost,
|
|
100
|
-
totalCost,
|
|
101
|
-
cacheHitTokens,
|
|
102
|
-
cacheDiscount,
|
|
103
|
-
finalCost,
|
|
104
|
-
model,
|
|
105
|
-
};
|
|
106
|
-
}
|
|
107
|
-
/**
|
|
108
|
-
* Aggregate costs from multiple telemetry events.
|
|
109
|
-
*
|
|
110
|
-
* @param events - Array of telemetry events with token data
|
|
111
|
-
* @returns Aggregated cost summary
|
|
112
|
-
*/
|
|
113
|
-
export function aggregateCosts(events) {
|
|
114
|
-
const byProvider = {};
|
|
115
|
-
const byModel = {};
|
|
116
|
-
let totalInputTokens = 0;
|
|
117
|
-
let totalOutputTokens = 0;
|
|
118
|
-
let totalCacheHitTokens = 0;
|
|
119
|
-
let totalCost = 0;
|
|
120
|
-
let totalCacheSavings = 0;
|
|
121
|
-
let executionCount = 0;
|
|
122
|
-
for (const event of events) {
|
|
123
|
-
// Skip events without token data
|
|
124
|
-
if (!event.tokensInput && !event.tokensOutput) {
|
|
125
|
-
continue;
|
|
126
|
-
}
|
|
127
|
-
const inputTokens = event.tokensInput ?? 0;
|
|
128
|
-
const outputTokens = event.tokensOutput ?? 0;
|
|
129
|
-
const cacheHitTokens = event.cacheReadTokens ?? 0;
|
|
130
|
-
const model = event.model ?? 'default';
|
|
131
|
-
const provider = event.provider ?? 'unknown';
|
|
132
|
-
const estimate = estimateCost(inputTokens, outputTokens, model, cacheHitTokens);
|
|
133
|
-
totalInputTokens += inputTokens;
|
|
134
|
-
totalOutputTokens += outputTokens;
|
|
135
|
-
totalCacheHitTokens += cacheHitTokens;
|
|
136
|
-
totalCost += estimate.totalCost;
|
|
137
|
-
totalCacheSavings += estimate.cacheDiscount ?? 0;
|
|
138
|
-
executionCount++;
|
|
139
|
-
// Aggregate by provider
|
|
140
|
-
byProvider[provider] = (byProvider[provider] ?? 0) + estimate.finalCost;
|
|
141
|
-
// Aggregate by model
|
|
142
|
-
byModel[model] = (byModel[model] ?? 0) + estimate.finalCost;
|
|
143
|
-
}
|
|
144
|
-
const finalCost = totalCost - totalCacheSavings;
|
|
145
|
-
return {
|
|
146
|
-
totalCost,
|
|
147
|
-
totalInputTokens,
|
|
148
|
-
totalOutputTokens,
|
|
149
|
-
totalCacheHitTokens,
|
|
150
|
-
totalCacheSavings,
|
|
151
|
-
finalCost,
|
|
152
|
-
byProvider,
|
|
153
|
-
byModel,
|
|
154
|
-
executionCount,
|
|
155
|
-
avgCostPerExecution: executionCount > 0 ? finalCost / executionCount : 0,
|
|
156
|
-
};
|
|
157
|
-
}
|
|
158
|
-
/**
|
|
159
|
-
* Format a cost value for display.
|
|
160
|
-
*
|
|
161
|
-
* @param cost - Cost in USD
|
|
162
|
-
* @returns Formatted string like "$0.0123" or "<$0.01"
|
|
163
|
-
*/
|
|
164
|
-
export function formatCost(cost) {
|
|
165
|
-
if (cost === 0)
|
|
166
|
-
return '$0.00';
|
|
167
|
-
if (cost < 0.01)
|
|
168
|
-
return '< $0.01';
|
|
169
|
-
return `$${cost.toFixed(4)}`;
|
|
170
|
-
}
|
|
171
|
-
/**
|
|
172
|
-
* Estimate cost for a planned execution based on token estimates.
|
|
173
|
-
* Useful for budget warnings before execution.
|
|
174
|
-
*
|
|
175
|
-
* @param estimatedInputTokens - Estimated input tokens
|
|
176
|
-
* @param model - Model to use
|
|
177
|
-
* @param estimatedOutputRatio - Expected output/input ratio (default 0.3)
|
|
178
|
-
* @returns Cost estimate
|
|
179
|
-
*/
|
|
180
|
-
export function estimatePlannedCost(estimatedInputTokens, model, estimatedOutputRatio = 0.3) {
|
|
181
|
-
const estimatedOutputTokens = Math.ceil(estimatedInputTokens * estimatedOutputRatio);
|
|
182
|
-
return estimateCost(estimatedInputTokens, estimatedOutputTokens, model);
|
|
183
|
-
}
|
|
@@ -1,134 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Atomic deliverable extraction from parsed planning documents.
|
|
3
|
-
* Transforms parsed sections into stream-ready deliverables.
|
|
4
|
-
*
|
|
5
|
-
* Phase 8B-C: Semantic splitting based on file content classification.
|
|
6
|
-
* YAML-sourced deliverables are never auto-split (author knows best).
|
|
7
|
-
*/
|
|
8
|
-
import type { ParsedSection, ParsedPlan, CodeBlock } from './plan-parser.js';
|
|
9
|
-
import { type StreamCategory } from './learning-engine.js';
|
|
10
|
-
import type { LearnDiagnostics } from './diagnostics.js';
|
|
11
|
-
/**
|
|
12
|
-
* Concern types for semantic file classification.
|
|
13
|
-
* Used to group files by their purpose when splitting deliverables.
|
|
14
|
-
*/
|
|
15
|
-
export type FileConcern = 'types' | 'migrations' | 'core' | 'tests' | 'docs' | 'styles';
|
|
16
|
-
/**
|
|
17
|
-
* Classify a file path into a concern bucket based on filename and path.
|
|
18
|
-
* Uses CONCERN_PRIORITY to resolve ambiguous matches.
|
|
19
|
-
*/
|
|
20
|
-
export declare function classifyFile(filePath: string): FileConcern;
|
|
21
|
-
/**
|
|
22
|
-
* Extract relevant plan lines for a specific concern.
|
|
23
|
-
* Matches lines containing concern keywords or file names.
|
|
24
|
-
* Never returns generic template text - always preserves original content.
|
|
25
|
-
*/
|
|
26
|
-
export declare function extractPlanForConcern(originalPlan: string, concern: FileConcern, files: string[]): string;
|
|
27
|
-
/**
|
|
28
|
-
* A deliverable extracted from a planning document.
|
|
29
|
-
*/
|
|
30
|
-
export interface Deliverable {
|
|
31
|
-
/** Unique identifier (stream ID) */
|
|
32
|
-
id: string;
|
|
33
|
-
/** Human-readable name */
|
|
34
|
-
name: string;
|
|
35
|
-
/** Description of the deliverable */
|
|
36
|
-
description: string;
|
|
37
|
-
/** Stream category */
|
|
38
|
-
category: StreamCategory;
|
|
39
|
-
/** Files this deliverable will own */
|
|
40
|
-
ownedFiles: string[];
|
|
41
|
-
/** Files this deliverable needs to read */
|
|
42
|
-
readFiles: string[];
|
|
43
|
-
/** Explicit dependencies mentioned */
|
|
44
|
-
explicitDeps: string[];
|
|
45
|
-
/** Code examples from the document */
|
|
46
|
-
codeExamples: CodeBlock[];
|
|
47
|
-
/** Whether this is atomic (small enough for one stream) */
|
|
48
|
-
isAtomic: boolean;
|
|
49
|
-
/** Reasons for suggested split if not atomic */
|
|
50
|
-
suggestedSplit?: string[];
|
|
51
|
-
/** Number of H3+ children in the source section */
|
|
52
|
-
childCount?: number;
|
|
53
|
-
}
|
|
54
|
-
/**
|
|
55
|
-
* Generate a stream ID from a section title.
|
|
56
|
-
*/
|
|
57
|
-
export declare function generateStreamId(title: string, prefix?: string): string;
|
|
58
|
-
/**
|
|
59
|
-
* Infer owned files from section content and its children.
|
|
60
|
-
* Priority order:
|
|
61
|
-
* 1. "Create:/Modify:/Test:" in **Files:** sections (from section + children)
|
|
62
|
-
* 2. Code block filename comments (// filename on first line)
|
|
63
|
-
* 3. Explicit `owns: [files]` pattern in content
|
|
64
|
-
* 4. NO blind fallback to fileReferences — that causes false ownership
|
|
65
|
-
*
|
|
66
|
-
* Files in explicit `reads:` declarations are excluded from ownership.
|
|
67
|
-
*/
|
|
68
|
-
export declare function inferOwnedFiles(section: ParsedSection, codeBlocks: CodeBlock[]): string[];
|
|
69
|
-
/**
|
|
70
|
-
* Infer read files from section content (files referenced but not owned).
|
|
71
|
-
*/
|
|
72
|
-
export declare function inferReadFiles(section: ParsedSection, ownedFiles: string[]): string[];
|
|
73
|
-
/**
|
|
74
|
-
* Extended deliverable type with YAML source marker.
|
|
75
|
-
*/
|
|
76
|
-
export interface DeliverableWithMeta extends Deliverable {
|
|
77
|
-
/** True if this deliverable came from explicit YAML definition */
|
|
78
|
-
_fromYaml?: boolean;
|
|
79
|
-
/** Verify commands from YAML */
|
|
80
|
-
_verify?: string[];
|
|
81
|
-
/** Setup commands from YAML */
|
|
82
|
-
_setup?: string[];
|
|
83
|
-
}
|
|
84
|
-
/**
|
|
85
|
-
* Check if a deliverable should be split.
|
|
86
|
-
* YAML-sourced deliverables are never split (author knows best).
|
|
87
|
-
* Uses semantic concern-based analysis instead of templates.
|
|
88
|
-
*/
|
|
89
|
-
export declare function shouldSplit(deliverable: Deliverable): {
|
|
90
|
-
split: boolean;
|
|
91
|
-
reasons: string[];
|
|
92
|
-
};
|
|
93
|
-
/**
|
|
94
|
-
* Extract deliverables from YAML stream definitions in all sections.
|
|
95
|
-
* Scans entire document for yaml code blocks with stream definitions.
|
|
96
|
-
*/
|
|
97
|
-
export declare function extractFromYamlBlocks(plan: ParsedPlan, prefix?: string, diagnostics?: LearnDiagnostics): Deliverable[];
|
|
98
|
-
/**
|
|
99
|
-
* Check if a plan contains YAML stream definitions.
|
|
100
|
-
*/
|
|
101
|
-
export declare function hasYamlStreamDefinitions(plan: ParsedPlan): boolean;
|
|
102
|
-
/**
|
|
103
|
-
* Extract deliverables from a parsed plan.
|
|
104
|
-
* Automatically detects YAML stream definitions and uses them if found.
|
|
105
|
-
* Falls back to header-based extraction if no YAML streams are present.
|
|
106
|
-
*/
|
|
107
|
-
export declare function extractDeliverables(plan: ParsedPlan, options?: {
|
|
108
|
-
deliverableLevel?: number;
|
|
109
|
-
prefix?: string;
|
|
110
|
-
preferYaml?: boolean;
|
|
111
|
-
diagnostics?: LearnDiagnostics;
|
|
112
|
-
}): Deliverable[];
|
|
113
|
-
/**
|
|
114
|
-
* Split a non-atomic deliverable using semantic file classification.
|
|
115
|
-
*
|
|
116
|
-
* Phase 8B-C: Files are grouped by concern (types, migrations, core, tests, docs).
|
|
117
|
-
* Each group becomes a separate deliverable with:
|
|
118
|
-
* - Relevant plan content extracted from original (not generic templates)
|
|
119
|
-
* - Proper dependency chaining (types → migrations → core → tests → docs)
|
|
120
|
-
* - Parent's explicit dependencies inherited by first split
|
|
121
|
-
*/
|
|
122
|
-
export declare function splitDeliverable(deliverable: Deliverable): Deliverable[];
|
|
123
|
-
/**
|
|
124
|
-
* Process all deliverables, splitting non-atomic ones.
|
|
125
|
-
*/
|
|
126
|
-
export declare function processDeliverables(deliverables: Deliverable[]): Deliverable[];
|
|
127
|
-
/**
|
|
128
|
-
* Format deliverable as human-readable summary.
|
|
129
|
-
*/
|
|
130
|
-
export declare function formatDeliverable(deliverable: Deliverable): string;
|
|
131
|
-
/**
|
|
132
|
-
* Format all deliverables as a report.
|
|
133
|
-
*/
|
|
134
|
-
export declare function formatDeliverablesReport(deliverables: Deliverable[]): string;
|