@kjerneverk/riotplan-ai 1.0.0-dev.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.
- package/dist/index.d.ts +731 -0
- package/dist/index.js +1963 -0
- package/dist/index.js.map +1 -0
- package/package.json +69 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,731 @@
|
|
|
1
|
+
import { Tool } from '@kjerneverk/agentic';
|
|
2
|
+
|
|
3
|
+
export declare interface AIValidationReport {
|
|
4
|
+
overallPassed: boolean;
|
|
5
|
+
checks: {
|
|
6
|
+
name: string;
|
|
7
|
+
result: AIValidationResult;
|
|
8
|
+
}[];
|
|
9
|
+
allWarnings: string[];
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export declare interface AIValidationResult {
|
|
13
|
+
passed: boolean;
|
|
14
|
+
warnings: string[];
|
|
15
|
+
details: Record<string, any>;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Apply tiering decisions to evidence array
|
|
20
|
+
*/
|
|
21
|
+
export declare function applyEvidenceTiering(evidence: {
|
|
22
|
+
name: string;
|
|
23
|
+
content: string;
|
|
24
|
+
size: number;
|
|
25
|
+
}[], decision: TieringDecision): {
|
|
26
|
+
name: string;
|
|
27
|
+
content: string;
|
|
28
|
+
size: number;
|
|
29
|
+
tiered?: 'summarized' | 'listOnly';
|
|
30
|
+
}[];
|
|
31
|
+
|
|
32
|
+
export declare interface ApproachAnalysis {
|
|
33
|
+
selectedApproach: string;
|
|
34
|
+
commitments: string;
|
|
35
|
+
implementationStrategy: string;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Artifact Loading Utilities
|
|
40
|
+
*
|
|
41
|
+
* Shared functions for loading and extracting plan artifacts (IDEA.md, SHAPING.md, evidence, history)
|
|
42
|
+
* Used by both build.ts and context.ts to ensure consistent artifact handling
|
|
43
|
+
*/
|
|
44
|
+
export declare interface ArtifactBundle {
|
|
45
|
+
ideaContent: string | null;
|
|
46
|
+
shapingContent: string | null;
|
|
47
|
+
lifecycleContent: string | null;
|
|
48
|
+
artifactDiagnostics?: {
|
|
49
|
+
planId: string;
|
|
50
|
+
hasIdeaArtifact: boolean;
|
|
51
|
+
detectedArtifacts: Array<{
|
|
52
|
+
type: string;
|
|
53
|
+
filename: string;
|
|
54
|
+
}>;
|
|
55
|
+
};
|
|
56
|
+
constraints: string[];
|
|
57
|
+
questions: string[];
|
|
58
|
+
selectedApproach: {
|
|
59
|
+
name: string;
|
|
60
|
+
description: string;
|
|
61
|
+
reasoning: string;
|
|
62
|
+
} | null;
|
|
63
|
+
evidence: {
|
|
64
|
+
name: string;
|
|
65
|
+
content: string;
|
|
66
|
+
size: number;
|
|
67
|
+
}[];
|
|
68
|
+
historyContext: {
|
|
69
|
+
recentEvents: {
|
|
70
|
+
type: string;
|
|
71
|
+
timestamp: string;
|
|
72
|
+
summary: string;
|
|
73
|
+
}[];
|
|
74
|
+
totalEvents: number;
|
|
75
|
+
};
|
|
76
|
+
catalystContent?: {
|
|
77
|
+
constraints: string;
|
|
78
|
+
domainKnowledge: string;
|
|
79
|
+
outputTemplates: string;
|
|
80
|
+
processGuidance: string;
|
|
81
|
+
questions: string;
|
|
82
|
+
validationRules: string;
|
|
83
|
+
appliedCatalysts: string[];
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* Attributed content item from merged catalyst
|
|
89
|
+
*/
|
|
90
|
+
declare interface AttributedContentItem {
|
|
91
|
+
content: string;
|
|
92
|
+
sourceId: string;
|
|
93
|
+
filename?: string;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* Build the user prompt for plan generation
|
|
98
|
+
*
|
|
99
|
+
* If structured artifact fields are present (constraints, evidence, selectedApproach, history),
|
|
100
|
+
* constructs a rich prompt with labeled sections. Otherwise, falls back to the simple
|
|
101
|
+
* description-based prompt for backward compatibility.
|
|
102
|
+
*/
|
|
103
|
+
export declare function buildPlanPrompt(context: GenerationContext): string;
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* Calculate tiering decisions based on artifact sizes and budget
|
|
107
|
+
*/
|
|
108
|
+
export declare function calculateTiering(constraints: string[], selectedApproach: {
|
|
109
|
+
name: string;
|
|
110
|
+
description: string;
|
|
111
|
+
reasoning: string;
|
|
112
|
+
} | null, evidence: {
|
|
113
|
+
name: string;
|
|
114
|
+
content: string;
|
|
115
|
+
size: number;
|
|
116
|
+
}[], historyEventCount: number, budget?: TokenBudget): TieringDecision;
|
|
117
|
+
|
|
118
|
+
export declare interface ConstraintAnalysis {
|
|
119
|
+
constraint: string;
|
|
120
|
+
understanding: string;
|
|
121
|
+
plannedApproach: string;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* Constraint Coverage Validation
|
|
126
|
+
* Ensures each constraint from IDEA.md is addressed by at least one step
|
|
127
|
+
*/
|
|
128
|
+
export declare class ConstraintCoverageCheck implements ValidationCheck {
|
|
129
|
+
name: string;
|
|
130
|
+
validate(plan: GeneratedPlan, context: GenerationContext): AIValidationResult;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
* Create a write_plan tool with a connected promise.
|
|
135
|
+
*
|
|
136
|
+
* The caller awaits `planPromise` while the agent explores the codebase.
|
|
137
|
+
* When the agent is ready, it calls `write_plan` with the plan JSON,
|
|
138
|
+
* which resolves the promise and returns the plan to the caller.
|
|
139
|
+
*/
|
|
140
|
+
export declare function createWritePlanTool(): WritePlanToolResult;
|
|
141
|
+
|
|
142
|
+
export declare const DEFAULT_TOKEN_BUDGET: TokenBudget;
|
|
143
|
+
|
|
144
|
+
/**
|
|
145
|
+
* Detect available providers
|
|
146
|
+
*/
|
|
147
|
+
export declare function detectAvailableProviders(): Promise<string[]>;
|
|
148
|
+
|
|
149
|
+
/**
|
|
150
|
+
* Estimate token count from text
|
|
151
|
+
* Uses character count / 4 as a reasonable approximation
|
|
152
|
+
*/
|
|
153
|
+
export declare function estimateTokens(text: string): number;
|
|
154
|
+
|
|
155
|
+
export declare interface EvidenceAnalysis {
|
|
156
|
+
evidenceFile: string;
|
|
157
|
+
keyFindings: string;
|
|
158
|
+
impactOnPlan: string;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
/**
|
|
162
|
+
* Evidence Reference Validation
|
|
163
|
+
* Checks if provided evidence files are referenced in the plan
|
|
164
|
+
*/
|
|
165
|
+
export declare class EvidenceReferenceCheck implements ValidationCheck {
|
|
166
|
+
name: string;
|
|
167
|
+
validate(plan: GeneratedPlan, context: GenerationContext): AIValidationResult;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
export declare interface ExecutionOptions {
|
|
171
|
+
model?: string;
|
|
172
|
+
maxTokens?: number;
|
|
173
|
+
temperature?: number;
|
|
174
|
+
timeout?: number;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
/**
|
|
178
|
+
* Extract constraints from IDEA.md content
|
|
179
|
+
*/
|
|
180
|
+
export declare function extractConstraints(ideaContent: string): string[];
|
|
181
|
+
|
|
182
|
+
/**
|
|
183
|
+
* Extract questions from IDEA.md content
|
|
184
|
+
*/
|
|
185
|
+
export declare function extractQuestions(ideaContent: string): string[];
|
|
186
|
+
|
|
187
|
+
/**
|
|
188
|
+
* Extract selected approach from SHAPING.md content
|
|
189
|
+
*/
|
|
190
|
+
export declare function extractSelectedApproach(shapingContent: string): {
|
|
191
|
+
name: string;
|
|
192
|
+
description: string;
|
|
193
|
+
reasoning: string;
|
|
194
|
+
} | null;
|
|
195
|
+
|
|
196
|
+
/**
|
|
197
|
+
* Format step into markdown content
|
|
198
|
+
*/
|
|
199
|
+
export declare function formatStep(step: GeneratedStep): string;
|
|
200
|
+
|
|
201
|
+
/**
|
|
202
|
+
* Format a generated plan into markdown content for SUMMARY.md
|
|
203
|
+
*/
|
|
204
|
+
export declare function formatSummary(plan: GeneratedPlan, planName: string): string;
|
|
205
|
+
|
|
206
|
+
export declare interface GeneratedPlan {
|
|
207
|
+
summary: string;
|
|
208
|
+
approach: string;
|
|
209
|
+
successCriteria: string;
|
|
210
|
+
steps: GeneratedStep[];
|
|
211
|
+
analysis?: PlanAnalysis;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
export declare interface GeneratedStep {
|
|
215
|
+
number: number;
|
|
216
|
+
title: string;
|
|
217
|
+
objective: string;
|
|
218
|
+
background: string;
|
|
219
|
+
tasks: GeneratedTask[];
|
|
220
|
+
acceptanceCriteria: string[];
|
|
221
|
+
testing: string;
|
|
222
|
+
filesChanged: string[];
|
|
223
|
+
notes: string;
|
|
224
|
+
provenance?: StepProvenance;
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
export declare interface GeneratedTask {
|
|
228
|
+
id: string;
|
|
229
|
+
description: string;
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
/**
|
|
233
|
+
* Generate a plan using AI
|
|
234
|
+
*/
|
|
235
|
+
export declare function generatePlan(context: GenerationContext, provider: Provider, options?: GenerationOptionsWithProgress): Promise<GenerationResult>;
|
|
236
|
+
|
|
237
|
+
/**
|
|
238
|
+
* Generate a plan using an agent loop with codebase tools.
|
|
239
|
+
*
|
|
240
|
+
* The agent explores the codebase using read-only tools, then calls
|
|
241
|
+
* write_plan to submit the structured plan. This produces higher-quality
|
|
242
|
+
* plans than the one-shot approach because the agent can:
|
|
243
|
+
* - Read actual source files
|
|
244
|
+
* - Search for patterns and references
|
|
245
|
+
* - Understand the project structure
|
|
246
|
+
* - Reference real file paths, interfaces, and functions
|
|
247
|
+
*
|
|
248
|
+
* @param context - Generation context with artifacts and description
|
|
249
|
+
* @param provider - Execution provider (will be adapted to AgentProvider)
|
|
250
|
+
* @param codebaseTools - Read-only environment tools (read_file, grep, etc.)
|
|
251
|
+
* @param options - Generation options including model and progress callback
|
|
252
|
+
* @param projectRoot - Project root directory for tool working directory
|
|
253
|
+
* @returns GenerationResult with the plan and tiering info
|
|
254
|
+
*/
|
|
255
|
+
export declare function generatePlanWithAgent(context: GenerationContext, provider: Provider, codebaseTools: Tool[], options?: GenerationOptionsWithProgress, projectRoot?: string): Promise<GenerationResult>;
|
|
256
|
+
|
|
257
|
+
/**
|
|
258
|
+
* Generate PROVENANCE.md content
|
|
259
|
+
*/
|
|
260
|
+
export declare function generateProvenanceMarkdown(data: ProvenanceData): string;
|
|
261
|
+
|
|
262
|
+
export declare interface GenerationContext {
|
|
263
|
+
planName: string;
|
|
264
|
+
description: string;
|
|
265
|
+
elaborations?: string[];
|
|
266
|
+
stepCount?: number;
|
|
267
|
+
constraints?: string[];
|
|
268
|
+
questions?: string[];
|
|
269
|
+
selectedApproach?: {
|
|
270
|
+
name: string;
|
|
271
|
+
description: string;
|
|
272
|
+
reasoning: string;
|
|
273
|
+
};
|
|
274
|
+
evidence?: {
|
|
275
|
+
name: string;
|
|
276
|
+
content: string;
|
|
277
|
+
size: number;
|
|
278
|
+
}[];
|
|
279
|
+
historyContext?: {
|
|
280
|
+
recentEvents: {
|
|
281
|
+
type: string;
|
|
282
|
+
timestamp: string;
|
|
283
|
+
summary: string;
|
|
284
|
+
}[];
|
|
285
|
+
totalEvents: number;
|
|
286
|
+
};
|
|
287
|
+
ideaContent?: string;
|
|
288
|
+
shapingContent?: string;
|
|
289
|
+
tokenBudget?: {
|
|
290
|
+
maxTokens?: number;
|
|
291
|
+
evidenceFullThreshold?: number;
|
|
292
|
+
evidenceSummaryThreshold?: number;
|
|
293
|
+
historyFullCount?: number;
|
|
294
|
+
historyAbbreviatedCount?: number;
|
|
295
|
+
};
|
|
296
|
+
codebaseContext?: string;
|
|
297
|
+
catalystContent?: {
|
|
298
|
+
constraints: string;
|
|
299
|
+
domainKnowledge: string;
|
|
300
|
+
outputTemplates: string;
|
|
301
|
+
processGuidance: string;
|
|
302
|
+
questions: string;
|
|
303
|
+
validationRules: string;
|
|
304
|
+
appliedCatalysts: string[];
|
|
305
|
+
};
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
/**
|
|
309
|
+
* Extended options for plan generation
|
|
310
|
+
*/
|
|
311
|
+
export declare interface GenerationOptionsWithProgress extends ExecutionOptions {
|
|
312
|
+
onProgress?: GenerationProgressCallback;
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
/**
|
|
316
|
+
* Progress callback for plan generation
|
|
317
|
+
*/
|
|
318
|
+
export declare type GenerationProgressCallback = (event: {
|
|
319
|
+
type: 'started' | 'streaming' | 'parsing' | 'complete';
|
|
320
|
+
charsReceived?: number;
|
|
321
|
+
message?: string;
|
|
322
|
+
}) => void;
|
|
323
|
+
|
|
324
|
+
export declare interface GenerationResult {
|
|
325
|
+
plan: GeneratedPlan;
|
|
326
|
+
tiering?: TieringDecision;
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
/**
|
|
330
|
+
* Get default provider based on environment variables
|
|
331
|
+
*/
|
|
332
|
+
export declare function getDefaultProvider(): string | null;
|
|
333
|
+
|
|
334
|
+
export declare function getPlanGenerationSystemPrompt(): string;
|
|
335
|
+
|
|
336
|
+
/**
|
|
337
|
+
* Get API key for a provider from environment
|
|
338
|
+
*/
|
|
339
|
+
export declare function getProviderApiKey(provider: string): string | undefined;
|
|
340
|
+
|
|
341
|
+
/**
|
|
342
|
+
* Load all plan artifacts into a structured bundle
|
|
343
|
+
*
|
|
344
|
+
* This is the main entry point for artifact loading, used by build.ts
|
|
345
|
+
*/
|
|
346
|
+
export declare function loadArtifacts(planPath: string): Promise<ArtifactBundle>;
|
|
347
|
+
|
|
348
|
+
/**
|
|
349
|
+
* Convert merged catalyst to the format needed by GenerationContext
|
|
350
|
+
*
|
|
351
|
+
* Takes a MergedCatalyst from @kjerneverk/riotplan-catalyst and converts it
|
|
352
|
+
* to the catalystContent format used by the generator.
|
|
353
|
+
*
|
|
354
|
+
* The mergedCatalyst parameter uses a simplified type to avoid tight coupling
|
|
355
|
+
* with the riotplan-catalyst package types.
|
|
356
|
+
*/
|
|
357
|
+
export declare function loadCatalystContent(mergedCatalyst: {
|
|
358
|
+
catalystIds: string[];
|
|
359
|
+
facets: {
|
|
360
|
+
questions?: AttributedContentItem[];
|
|
361
|
+
constraints?: AttributedContentItem[];
|
|
362
|
+
outputTemplates?: AttributedContentItem[];
|
|
363
|
+
domainKnowledge?: AttributedContentItem[];
|
|
364
|
+
processGuidance?: AttributedContentItem[];
|
|
365
|
+
validationRules?: AttributedContentItem[];
|
|
366
|
+
};
|
|
367
|
+
} | null): ArtifactBundle['catalystContent'] | undefined;
|
|
368
|
+
|
|
369
|
+
/**
|
|
370
|
+
* Load a provider based on session context and configuration
|
|
371
|
+
*
|
|
372
|
+
* Priority:
|
|
373
|
+
* 1. If session has sampling available → use SamplingProvider
|
|
374
|
+
* 2. If explicit provider name given → use that provider
|
|
375
|
+
* 3. If API keys available → use default provider
|
|
376
|
+
* 4. Otherwise → error with helpful message
|
|
377
|
+
*/
|
|
378
|
+
export declare function loadProvider(config: ProviderConfig): Promise<Provider>;
|
|
379
|
+
|
|
380
|
+
/**
|
|
381
|
+
* LLM Provider types for AI plan generation
|
|
382
|
+
*
|
|
383
|
+
* These types define the interface between the AI module and LLM providers.
|
|
384
|
+
*/
|
|
385
|
+
export declare interface Message {
|
|
386
|
+
role: 'user' | 'assistant' | 'system' | 'developer' | 'tool';
|
|
387
|
+
content: string | string[] | null;
|
|
388
|
+
name?: string;
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
export declare function parsePlanResponse(content: string, _stepCount: number): GeneratedPlan;
|
|
392
|
+
|
|
393
|
+
export declare const PLAN_GENERATION_RESPONSE_SCHEMA: {
|
|
394
|
+
readonly type: "object";
|
|
395
|
+
readonly properties: {
|
|
396
|
+
readonly analysis: {
|
|
397
|
+
readonly type: "object";
|
|
398
|
+
readonly properties: {
|
|
399
|
+
readonly constraintAnalysis: {
|
|
400
|
+
readonly type: "array";
|
|
401
|
+
readonly items: {
|
|
402
|
+
readonly type: "object";
|
|
403
|
+
readonly properties: {
|
|
404
|
+
readonly constraint: {
|
|
405
|
+
readonly type: "string";
|
|
406
|
+
};
|
|
407
|
+
readonly understanding: {
|
|
408
|
+
readonly type: "string";
|
|
409
|
+
};
|
|
410
|
+
readonly plannedApproach: {
|
|
411
|
+
readonly type: "string";
|
|
412
|
+
};
|
|
413
|
+
};
|
|
414
|
+
readonly required: readonly ["constraint", "understanding", "plannedApproach"];
|
|
415
|
+
};
|
|
416
|
+
};
|
|
417
|
+
readonly evidenceAnalysis: {
|
|
418
|
+
readonly type: "array";
|
|
419
|
+
readonly items: {
|
|
420
|
+
readonly type: "object";
|
|
421
|
+
readonly properties: {
|
|
422
|
+
readonly evidenceFile: {
|
|
423
|
+
readonly type: "string";
|
|
424
|
+
};
|
|
425
|
+
readonly keyFindings: {
|
|
426
|
+
readonly type: "string";
|
|
427
|
+
};
|
|
428
|
+
readonly impactOnPlan: {
|
|
429
|
+
readonly type: "string";
|
|
430
|
+
};
|
|
431
|
+
};
|
|
432
|
+
readonly required: readonly ["evidenceFile", "keyFindings", "impactOnPlan"];
|
|
433
|
+
};
|
|
434
|
+
};
|
|
435
|
+
readonly approachAnalysis: {
|
|
436
|
+
readonly type: "object";
|
|
437
|
+
readonly properties: {
|
|
438
|
+
readonly selectedApproach: {
|
|
439
|
+
readonly type: "string";
|
|
440
|
+
};
|
|
441
|
+
readonly commitments: {
|
|
442
|
+
readonly type: "string";
|
|
443
|
+
};
|
|
444
|
+
readonly implementationStrategy: {
|
|
445
|
+
readonly type: "string";
|
|
446
|
+
};
|
|
447
|
+
};
|
|
448
|
+
};
|
|
449
|
+
readonly risks: {
|
|
450
|
+
readonly type: "array";
|
|
451
|
+
readonly items: {
|
|
452
|
+
readonly type: "string";
|
|
453
|
+
};
|
|
454
|
+
};
|
|
455
|
+
};
|
|
456
|
+
readonly required: readonly ["constraintAnalysis"];
|
|
457
|
+
};
|
|
458
|
+
readonly summary: {
|
|
459
|
+
readonly type: "string";
|
|
460
|
+
};
|
|
461
|
+
readonly approach: {
|
|
462
|
+
readonly type: "string";
|
|
463
|
+
};
|
|
464
|
+
readonly successCriteria: {
|
|
465
|
+
readonly type: "string";
|
|
466
|
+
};
|
|
467
|
+
readonly steps: {
|
|
468
|
+
readonly type: "array";
|
|
469
|
+
readonly items: {
|
|
470
|
+
readonly type: "object";
|
|
471
|
+
readonly properties: {
|
|
472
|
+
readonly number: {
|
|
473
|
+
readonly type: "number";
|
|
474
|
+
};
|
|
475
|
+
readonly title: {
|
|
476
|
+
readonly type: "string";
|
|
477
|
+
};
|
|
478
|
+
readonly objective: {
|
|
479
|
+
readonly type: "string";
|
|
480
|
+
};
|
|
481
|
+
readonly background: {
|
|
482
|
+
readonly type: "string";
|
|
483
|
+
};
|
|
484
|
+
readonly tasks: {
|
|
485
|
+
readonly type: "array";
|
|
486
|
+
readonly items: {
|
|
487
|
+
readonly type: "object";
|
|
488
|
+
readonly properties: {
|
|
489
|
+
readonly id: {
|
|
490
|
+
readonly type: "string";
|
|
491
|
+
};
|
|
492
|
+
readonly description: {
|
|
493
|
+
readonly type: "string";
|
|
494
|
+
};
|
|
495
|
+
};
|
|
496
|
+
readonly required: readonly ["id", "description"];
|
|
497
|
+
};
|
|
498
|
+
};
|
|
499
|
+
readonly acceptanceCriteria: {
|
|
500
|
+
readonly type: "array";
|
|
501
|
+
readonly items: {
|
|
502
|
+
readonly type: "string";
|
|
503
|
+
};
|
|
504
|
+
};
|
|
505
|
+
readonly testing: {
|
|
506
|
+
readonly type: "string";
|
|
507
|
+
};
|
|
508
|
+
readonly filesChanged: {
|
|
509
|
+
readonly type: "array";
|
|
510
|
+
readonly items: {
|
|
511
|
+
readonly type: "string";
|
|
512
|
+
};
|
|
513
|
+
};
|
|
514
|
+
readonly notes: {
|
|
515
|
+
readonly type: "string";
|
|
516
|
+
};
|
|
517
|
+
readonly provenance: {
|
|
518
|
+
readonly type: "object";
|
|
519
|
+
readonly properties: {
|
|
520
|
+
readonly constraintsAddressed: {
|
|
521
|
+
readonly type: "array";
|
|
522
|
+
readonly items: {
|
|
523
|
+
readonly type: "string";
|
|
524
|
+
};
|
|
525
|
+
};
|
|
526
|
+
readonly evidenceUsed: {
|
|
527
|
+
readonly type: "array";
|
|
528
|
+
readonly items: {
|
|
529
|
+
readonly type: "string";
|
|
530
|
+
};
|
|
531
|
+
};
|
|
532
|
+
readonly rationale: {
|
|
533
|
+
readonly type: "string";
|
|
534
|
+
};
|
|
535
|
+
};
|
|
536
|
+
};
|
|
537
|
+
};
|
|
538
|
+
readonly required: readonly ["number", "title", "objective", "background", "tasks", "acceptanceCriteria", "testing", "filesChanged", "notes"];
|
|
539
|
+
};
|
|
540
|
+
};
|
|
541
|
+
};
|
|
542
|
+
readonly required: readonly ["analysis", "summary", "approach", "successCriteria", "steps"];
|
|
543
|
+
};
|
|
544
|
+
|
|
545
|
+
export declare interface PlanAnalysis {
|
|
546
|
+
constraintAnalysis: ConstraintAnalysis[];
|
|
547
|
+
evidenceAnalysis?: EvidenceAnalysis[];
|
|
548
|
+
approachAnalysis?: ApproachAnalysis;
|
|
549
|
+
risks?: string[];
|
|
550
|
+
}
|
|
551
|
+
|
|
552
|
+
export declare interface ProvenanceData {
|
|
553
|
+
plan: GeneratedPlan;
|
|
554
|
+
context: GenerationContext;
|
|
555
|
+
validation: AIValidationReport;
|
|
556
|
+
tiering?: TieringDecision;
|
|
557
|
+
generatedAt: Date;
|
|
558
|
+
}
|
|
559
|
+
|
|
560
|
+
export declare interface Provider {
|
|
561
|
+
name: string;
|
|
562
|
+
execute(request: Request_2, options?: ExecutionOptions): Promise<ProviderResponse>;
|
|
563
|
+
executeStream?(request: Request_2, options?: ExecutionOptions): AsyncIterable<StreamChunk>;
|
|
564
|
+
}
|
|
565
|
+
|
|
566
|
+
export declare interface ProviderConfig {
|
|
567
|
+
name: string;
|
|
568
|
+
apiKey?: string;
|
|
569
|
+
model?: string;
|
|
570
|
+
session?: SessionContext;
|
|
571
|
+
mcpServer?: any;
|
|
572
|
+
}
|
|
573
|
+
|
|
574
|
+
export declare interface ProviderResponse {
|
|
575
|
+
content: string;
|
|
576
|
+
model: string;
|
|
577
|
+
usage?: {
|
|
578
|
+
inputTokens: number;
|
|
579
|
+
outputTokens: number;
|
|
580
|
+
};
|
|
581
|
+
toolCalls?: Array<{
|
|
582
|
+
id: string;
|
|
583
|
+
type: 'function';
|
|
584
|
+
function: {
|
|
585
|
+
name: string;
|
|
586
|
+
arguments: string;
|
|
587
|
+
};
|
|
588
|
+
}>;
|
|
589
|
+
}
|
|
590
|
+
|
|
591
|
+
/**
|
|
592
|
+
* Read evidence files from the evidence directory
|
|
593
|
+
*/
|
|
594
|
+
export declare function readEvidenceFiles(planPath: string, includeContent?: boolean): Promise<{
|
|
595
|
+
name: string;
|
|
596
|
+
content: string;
|
|
597
|
+
size: number;
|
|
598
|
+
}[]>;
|
|
599
|
+
|
|
600
|
+
/**
|
|
601
|
+
* Read recent history events from timeline.jsonl
|
|
602
|
+
*/
|
|
603
|
+
export declare function readRecentHistory(planPath: string, limit?: number): Promise<{
|
|
604
|
+
recentEvents: {
|
|
605
|
+
type: string;
|
|
606
|
+
timestamp: string;
|
|
607
|
+
summary: string;
|
|
608
|
+
}[];
|
|
609
|
+
totalEvents: number;
|
|
610
|
+
}>;
|
|
611
|
+
|
|
612
|
+
declare interface Request_2 {
|
|
613
|
+
messages: Message[];
|
|
614
|
+
model: string;
|
|
615
|
+
responseFormat?: any;
|
|
616
|
+
validator?: any;
|
|
617
|
+
addMessage(message: Message): void;
|
|
618
|
+
}
|
|
619
|
+
export { Request_2 as Request }
|
|
620
|
+
|
|
621
|
+
/**
|
|
622
|
+
* Selected Approach Validation
|
|
623
|
+
* Ensures the selected approach is reflected in the analysis
|
|
624
|
+
*/
|
|
625
|
+
export declare class SelectedApproachCheck implements ValidationCheck {
|
|
626
|
+
name: string;
|
|
627
|
+
validate(plan: GeneratedPlan, context: GenerationContext): AIValidationResult;
|
|
628
|
+
}
|
|
629
|
+
|
|
630
|
+
/**
|
|
631
|
+
* Minimal session context shape needed by the provider loader.
|
|
632
|
+
* The full SessionContext type lives in @kjerneverk/riotplan-mcp-http.
|
|
633
|
+
*/
|
|
634
|
+
declare interface SessionContext {
|
|
635
|
+
sessionId: string;
|
|
636
|
+
providerMode: 'sampling' | 'direct' | 'none';
|
|
637
|
+
clientInfo: {
|
|
638
|
+
name: string;
|
|
639
|
+
version: string;
|
|
640
|
+
} | null;
|
|
641
|
+
}
|
|
642
|
+
|
|
643
|
+
export declare interface StepProvenance {
|
|
644
|
+
constraintsAddressed?: string[];
|
|
645
|
+
evidenceUsed?: string[];
|
|
646
|
+
rationale?: string;
|
|
647
|
+
}
|
|
648
|
+
|
|
649
|
+
export declare interface StreamChunk {
|
|
650
|
+
type: 'text' | 'tool_call_start' | 'tool_call_delta' | 'tool_call_end' | 'usage' | 'done';
|
|
651
|
+
text?: string;
|
|
652
|
+
toolCall?: {
|
|
653
|
+
id?: string;
|
|
654
|
+
index?: number;
|
|
655
|
+
name?: string;
|
|
656
|
+
argumentsDelta?: string;
|
|
657
|
+
};
|
|
658
|
+
usage?: {
|
|
659
|
+
inputTokens: number;
|
|
660
|
+
outputTokens: number;
|
|
661
|
+
};
|
|
662
|
+
}
|
|
663
|
+
|
|
664
|
+
export declare interface TieringDecision {
|
|
665
|
+
totalEstimatedTokens: number;
|
|
666
|
+
budgetExceeded: boolean;
|
|
667
|
+
evidenceTiered: {
|
|
668
|
+
full: string[];
|
|
669
|
+
summarized: string[];
|
|
670
|
+
listOnly: string[];
|
|
671
|
+
};
|
|
672
|
+
historyAbbreviated: boolean;
|
|
673
|
+
warnings: string[];
|
|
674
|
+
}
|
|
675
|
+
|
|
676
|
+
/**
|
|
677
|
+
* Token Estimation and Budget Management
|
|
678
|
+
*
|
|
679
|
+
* Utilities for estimating token counts and managing prompt budgets
|
|
680
|
+
*/
|
|
681
|
+
export declare interface TokenBudget {
|
|
682
|
+
maxTokens: number;
|
|
683
|
+
evidenceFullThreshold: number;
|
|
684
|
+
evidenceSummaryThreshold: number;
|
|
685
|
+
historyFullCount: number;
|
|
686
|
+
historyAbbreviatedCount: number;
|
|
687
|
+
}
|
|
688
|
+
|
|
689
|
+
/**
|
|
690
|
+
* Truncate text to a line count with ellipsis
|
|
691
|
+
*/
|
|
692
|
+
export declare function truncateToLines(text: string, lineCount: number): string;
|
|
693
|
+
|
|
694
|
+
/**
|
|
695
|
+
* Create and run validation pipeline
|
|
696
|
+
*/
|
|
697
|
+
export declare function validateGeneratedPlan(plan: GeneratedPlan, context: GenerationContext): AIValidationReport;
|
|
698
|
+
|
|
699
|
+
export declare interface ValidationCheck {
|
|
700
|
+
name: string;
|
|
701
|
+
validate(plan: GeneratedPlan, context: GenerationContext): AIValidationResult;
|
|
702
|
+
}
|
|
703
|
+
|
|
704
|
+
/**
|
|
705
|
+
* Validation Pipeline
|
|
706
|
+
* Runs all validation checks and aggregates results
|
|
707
|
+
*/
|
|
708
|
+
export declare class ValidationPipeline {
|
|
709
|
+
private checks;
|
|
710
|
+
constructor();
|
|
711
|
+
/**
|
|
712
|
+
* Add a custom validation check
|
|
713
|
+
*/
|
|
714
|
+
addCheck(check: ValidationCheck): void;
|
|
715
|
+
/**
|
|
716
|
+
* Run all validation checks
|
|
717
|
+
*/
|
|
718
|
+
validate(plan: GeneratedPlan, context: GenerationContext): AIValidationReport;
|
|
719
|
+
}
|
|
720
|
+
|
|
721
|
+
/**
|
|
722
|
+
* Result of creating a write_plan tool
|
|
723
|
+
*/
|
|
724
|
+
export declare interface WritePlanToolResult {
|
|
725
|
+
/** The tool to register with the agent's ToolRegistry */
|
|
726
|
+
tool: Tool;
|
|
727
|
+
/** Promise that resolves when the agent calls write_plan */
|
|
728
|
+
planPromise: Promise<GeneratedPlan>;
|
|
729
|
+
}
|
|
730
|
+
|
|
731
|
+
export { }
|