@cristochang/spec-execution 0.1.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/completion.d.ts +128 -0
- package/dist/completion.d.ts.map +1 -0
- package/dist/context.d.ts +183 -0
- package/dist/context.d.ts.map +1 -0
- package/dist/contract.d.ts +24 -0
- package/dist/contract.d.ts.map +1 -0
- package/dist/failure.d.ts +134 -0
- package/dist/failure.d.ts.map +1 -0
- package/dist/gate.d.ts +84 -0
- package/dist/gate.d.ts.map +1 -0
- package/dist/index.d.ts +26 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +1282 -0
- package/dist/runner/executor.d.ts +48 -0
- package/dist/runner/executor.d.ts.map +1 -0
- package/dist/runner/index.d.ts +10 -0
- package/dist/runner/index.d.ts.map +1 -0
- package/dist/runner/ralph.d.ts +48 -0
- package/dist/runner/ralph.d.ts.map +1 -0
- package/dist/runner/session.d.ts +164 -0
- package/dist/runner/session.d.ts.map +1 -0
- package/dist/state.d.ts +141 -0
- package/dist/state.d.ts.map +1 -0
- package/dist/types.d.ts +122 -0
- package/dist/types.d.ts.map +1 -0
- package/package.json +45 -0
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Completion Detector and Recommendation
|
|
3
|
+
*
|
|
4
|
+
* Evaluates whether a Spec is complete and generates recommendations.
|
|
5
|
+
* Does NOT directly modify Spec status - only suggests next actions.
|
|
6
|
+
*/
|
|
7
|
+
import type { CriterionStatus, SpecInfo } from "./types.js";
|
|
8
|
+
import type { CriteriaProgress } from "./state.js";
|
|
9
|
+
/**
|
|
10
|
+
* Test evidence for automated verification
|
|
11
|
+
*/
|
|
12
|
+
export interface TestEvidence {
|
|
13
|
+
readonly passed: boolean;
|
|
14
|
+
readonly total: number;
|
|
15
|
+
readonly passedCount: number;
|
|
16
|
+
readonly failed: number;
|
|
17
|
+
readonly summary?: string;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Completion evidence
|
|
21
|
+
*/
|
|
22
|
+
export interface CompletionEvidence {
|
|
23
|
+
readonly criteriaStatus: ReadonlyMap<string, CriterionStatus>;
|
|
24
|
+
readonly filesModified: readonly string[];
|
|
25
|
+
readonly testResults?: TestEvidence;
|
|
26
|
+
readonly verificationSummary?: string;
|
|
27
|
+
readonly timestamp: number;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Create completion evidence
|
|
31
|
+
*/
|
|
32
|
+
export declare function createEvidence(criteriaStatus: ReadonlyMap<string, CriterionStatus>, filesModified: readonly string[], testResults?: TestEvidence, verificationSummary?: string): CompletionEvidence;
|
|
33
|
+
/**
|
|
34
|
+
* Suggested next step after completion evaluation
|
|
35
|
+
*/
|
|
36
|
+
export type NextStep = "mark_implemented" | "needs_verification" | "needs_user_review" | "continue" | "abort";
|
|
37
|
+
/**
|
|
38
|
+
* Confidence level for recommendations
|
|
39
|
+
*/
|
|
40
|
+
export type Confidence = "low" | "medium" | "high";
|
|
41
|
+
/**
|
|
42
|
+
* Completion recommendation
|
|
43
|
+
*
|
|
44
|
+
* Generated by spec-execution, consumed by user/orchestrator.
|
|
45
|
+
* The execution layer does NOT directly call spec_mark_implemented.
|
|
46
|
+
*/
|
|
47
|
+
export interface CompletionRecommendation {
|
|
48
|
+
readonly specID: string;
|
|
49
|
+
readonly ready: boolean;
|
|
50
|
+
readonly confidence: Confidence;
|
|
51
|
+
readonly evidence: CompletionEvidence;
|
|
52
|
+
readonly suggestedNextStep: NextStep;
|
|
53
|
+
readonly reason: string;
|
|
54
|
+
readonly requiresUserConfirmation: boolean;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Create a completion recommendation
|
|
58
|
+
*/
|
|
59
|
+
export declare function createRecommendation(specID: string, ready: boolean, confidence: Confidence, evidence: CompletionEvidence, suggestedNextStep: NextStep, reason: string, requiresUserConfirmation?: boolean): CompletionRecommendation;
|
|
60
|
+
/**
|
|
61
|
+
* Completion proposal
|
|
62
|
+
*
|
|
63
|
+
* Sent to user/upper layer for action.
|
|
64
|
+
* Contains all information needed to make a decision.
|
|
65
|
+
*/
|
|
66
|
+
export interface CompletionProposal {
|
|
67
|
+
readonly specID: string;
|
|
68
|
+
readonly type: "completion" | "partial" | "failed";
|
|
69
|
+
readonly content: ProposalContent;
|
|
70
|
+
readonly nextStep: ProposalAction;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Content of the proposal
|
|
74
|
+
*/
|
|
75
|
+
export interface ProposalContent {
|
|
76
|
+
readonly evidence: CompletionEvidence;
|
|
77
|
+
readonly summary: string;
|
|
78
|
+
readonly confidence: Confidence;
|
|
79
|
+
readonly suggestedAction?: SuggestedAction;
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Suggested action to take
|
|
83
|
+
*/
|
|
84
|
+
export interface SuggestedAction {
|
|
85
|
+
readonly tool: string;
|
|
86
|
+
readonly params: Record<string, unknown>;
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Next step action
|
|
90
|
+
*/
|
|
91
|
+
export interface ProposalAction {
|
|
92
|
+
readonly action: NextStep;
|
|
93
|
+
readonly reason: string;
|
|
94
|
+
readonly requiresUserConfirmation: boolean;
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Create a completion proposal from a recommendation
|
|
98
|
+
*/
|
|
99
|
+
export declare function createProposal(recommendation: CompletionRecommendation): CompletionProposal;
|
|
100
|
+
/**
|
|
101
|
+
* Completion Detector
|
|
102
|
+
*
|
|
103
|
+
* Evaluates Spec completion and generates recommendations.
|
|
104
|
+
* Pure function - does not modify any state.
|
|
105
|
+
*/
|
|
106
|
+
export declare namespace CompletionDetector {
|
|
107
|
+
/**
|
|
108
|
+
* Evaluate completion status
|
|
109
|
+
*
|
|
110
|
+
* @param spec - The spec to evaluate
|
|
111
|
+
* @param progress - Current progress
|
|
112
|
+
* @param evidence - Completion evidence
|
|
113
|
+
* @param verificationMode - Verification mode from contract
|
|
114
|
+
* @returns Completion recommendation
|
|
115
|
+
*/
|
|
116
|
+
function evaluate(spec: SpecInfo, progress: CriteriaProgress, evidence: CompletionEvidence, verificationMode: "none" | "manual" | "automated"): CompletionRecommendation;
|
|
117
|
+
/**
|
|
118
|
+
* Quick check: is the spec complete based on evidence only?
|
|
119
|
+
*
|
|
120
|
+
* Does not consider verification mode - just checks if all criteria are verified.
|
|
121
|
+
*/
|
|
122
|
+
function isComplete(evidence: CompletionEvidence): boolean;
|
|
123
|
+
/**
|
|
124
|
+
* Quick check: can execution continue based on evidence?
|
|
125
|
+
*/
|
|
126
|
+
function canContinue(evidence: CompletionEvidence): boolean;
|
|
127
|
+
}
|
|
128
|
+
//# sourceMappingURL=completion.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"completion.d.ts","sourceRoot":"","sources":["../src/completion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AAC3D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAA;AAMlD;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAA;IACxB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;IACtB,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAA;IAC5B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;IACvB,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAA;CAC1B;AAED;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,cAAc,EAAE,WAAW,CAAC,MAAM,EAAE,eAAe,CAAC,CAAA;IAC7D,QAAQ,CAAC,aAAa,EAAE,SAAS,MAAM,EAAE,CAAA;IACzC,QAAQ,CAAC,WAAW,CAAC,EAAE,YAAY,CAAA;IACnC,QAAQ,CAAC,mBAAmB,CAAC,EAAE,MAAM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execution round.
|
|
5
|
+
*
|
|
6
|
+
* Layers:
|
|
7
|
+
* 1. Immutable Truth - never changes between rounds
|
|
8
|
+
* 2. Execution State - monotonically grows
|
|
9
|
+
* 3. Failure Memory - capacity-limited
|
|
10
|
+
* 4. Working Context - replaced each round
|
|
11
|
+
*/
|
|
12
|
+
import type { CriterionStatus } from "./types.js";
|
|
13
|
+
import type { CriteriaProgress, ToolCallSummary } from "./state.js";
|
|
14
|
+
import type { FailureSummary } from "./failure.js";
|
|
15
|
+
/**
|
|
16
|
+
* Immutable context - Layer 1
|
|
17
|
+
* Never changes between rounds
|
|
18
|
+
*/
|
|
19
|
+
export interface ImmutableContext {
|
|
20
|
+
readonly spec: {
|
|
21
|
+
readonly objective: string;
|
|
22
|
+
readonly scope: {
|
|
23
|
+
readonly in: readonly string[];
|
|
24
|
+
readonly out: readonly string[];
|
|
25
|
+
};
|
|
26
|
+
readonly criteria: readonly CriterionDescriptor[];
|
|
27
|
+
readonly constraints: readonly string[];
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Criterion descriptor for immutable context
|
|
32
|
+
*/
|
|
33
|
+
export interface CriterionDescriptor {
|
|
34
|
+
readonly id: string;
|
|
35
|
+
readonly text: string;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* State context - Layer 2
|
|
39
|
+
* Monotonically grows, compressed
|
|
40
|
+
*/
|
|
41
|
+
export interface StateContext {
|
|
42
|
+
readonly iteration: number;
|
|
43
|
+
readonly progress: {
|
|
44
|
+
readonly current: number;
|
|
45
|
+
readonly total: number;
|
|
46
|
+
readonly percentage: number;
|
|
47
|
+
};
|
|
48
|
+
readonly files: {
|
|
49
|
+
readonly count: number;
|
|
50
|
+
readonly list: readonly string[];
|
|
51
|
+
};
|
|
52
|
+
readonly criteria: readonly CriterionStatusEntry[];
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Criterion status entry
|
|
56
|
+
*/
|
|
57
|
+
export interface CriterionStatusEntry {
|
|
58
|
+
readonly id: string;
|
|
59
|
+
readonly status: CriterionStatus;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Failure context - Layer 3
|
|
63
|
+
* Capacity-limited, compressed
|
|
64
|
+
*/
|
|
65
|
+
export interface FailureContext {
|
|
66
|
+
readonly count: number;
|
|
67
|
+
readonly patterns: readonly string[];
|
|
68
|
+
readonly recent: readonly FailureHint[];
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Failure hint for context
|
|
72
|
+
*/
|
|
73
|
+
export interface FailureHint {
|
|
74
|
+
readonly criterion: string;
|
|
75
|
+
readonly error: string;
|
|
76
|
+
readonly hint?: string;
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Working context - Layer 4
|
|
80
|
+
* Replaced each round
|
|
81
|
+
*/
|
|
82
|
+
export interface WorkingContext {
|
|
83
|
+
readonly task: string;
|
|
84
|
+
readonly criterion: string;
|
|
85
|
+
readonly file?: string;
|
|
86
|
+
readonly lastResult?: string;
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Assembled context for Ralph
|
|
90
|
+
*/
|
|
91
|
+
export interface AssembledContext {
|
|
92
|
+
readonly immutable: ImmutableContext;
|
|
93
|
+
readonly state: StateContext;
|
|
94
|
+
readonly failures: FailureContext;
|
|
95
|
+
readonly working: WorkingContext;
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Metadata about the assembled context
|
|
99
|
+
*/
|
|
100
|
+
export interface ContextMetadata {
|
|
101
|
+
readonly tokenEstimate: number;
|
|
102
|
+
readonly compressionRatio: number;
|
|
103
|
+
readonly layers: readonly string[];
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Options for context assembly
|
|
107
|
+
*/
|
|
108
|
+
export interface AssembleOptions {
|
|
109
|
+
readonly maxFiles?: number;
|
|
110
|
+
readonly maxFailures?: number;
|
|
111
|
+
readonly includeCodeSnippet?: boolean;
|
|
112
|
+
readonly maxCodeLines?: number;
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Default options
|
|
116
|
+
*/
|
|
117
|
+
export declare const DEFAULT_ASSEMBLE_OPTIONS: AssembleOptions;
|
|
118
|
+
/**
|
|
119
|
+
* Current focus for execution
|
|
120
|
+
*/
|
|
121
|
+
export interface WorkingFocus {
|
|
122
|
+
readonly targetCriterionId: string;
|
|
123
|
+
readonly targetCriterionText: string;
|
|
124
|
+
readonly targetFile?: string;
|
|
125
|
+
readonly contextSnippet?: string;
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* Create a working focus
|
|
129
|
+
*/
|
|
130
|
+
export declare function createWorkingFocus(criterionId: string, criterionText: string, targetFile?: string, contextSnippet?: string): WorkingFocus;
|
|
131
|
+
/**
|
|
132
|
+
* Context Assembler input
|
|
133
|
+
*
|
|
134
|
+
* Combines all necessary information for context generation
|
|
135
|
+
*/
|
|
136
|
+
export interface ContextInput {
|
|
137
|
+
readonly contract: {
|
|
138
|
+
readonly boundaries: {
|
|
139
|
+
readonly objective: string;
|
|
140
|
+
readonly inclusions: readonly string[];
|
|
141
|
+
readonly exclusions: readonly string[];
|
|
142
|
+
readonly constraints: readonly string[];
|
|
143
|
+
};
|
|
144
|
+
readonly completion: {
|
|
145
|
+
readonly criteria: readonly {
|
|
146
|
+
id: string;
|
|
147
|
+
description: string;
|
|
148
|
+
status: CriterionStatus;
|
|
149
|
+
}[];
|
|
150
|
+
};
|
|
151
|
+
};
|
|
152
|
+
readonly iteration: number;
|
|
153
|
+
readonly progress: CriteriaProgress;
|
|
154
|
+
readonly touchedFiles: readonly string[];
|
|
155
|
+
readonly criteriaStatus: ReadonlyMap<string, CriterionStatus>;
|
|
156
|
+
readonly failureSummary: FailureSummary;
|
|
157
|
+
readonly currentFocus?: WorkingFocus;
|
|
158
|
+
readonly lastToolCall?: ToolCallSummary;
|
|
159
|
+
}
|
|
160
|
+
/**
|
|
161
|
+
* Context Assembler
|
|
162
|
+
*
|
|
163
|
+
* Pure function: ContextInput → AssembledContext
|
|
164
|
+
*/
|
|
165
|
+
export declare namespace ContextAssembler {
|
|
166
|
+
/**
|
|
167
|
+
* Assemble context for the next execution round
|
|
168
|
+
*
|
|
169
|
+
* @param input - Context input data
|
|
170
|
+
* @param options - Assembly options
|
|
171
|
+
* @returns Assembled context for Ralph
|
|
172
|
+
*/
|
|
173
|
+
function assemble(input: ContextInput, options?: AssembleOptions): AssembledContext;
|
|
174
|
+
/**
|
|
175
|
+
* Estimate token count for assembled context
|
|
176
|
+
*/
|
|
177
|
+
function estimateTokens(context: AssembledContext): number;
|
|
178
|
+
/**
|
|
179
|
+
* Format context as human-readable text
|
|
180
|
+
*/
|
|
181
|
+
function formatAsText(context: AssembledContext): string;
|
|
182
|
+
}
|
|
183
|
+
//# sourceMappingURL=context.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../src/context.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAA;AACjD,OAAO,KAAK,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,YAAY,CAAA;AACnE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,cAAc,CAAA;AAMlD;;;GAGG;AACH,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,IAAI,EAAE;QACb,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAA;QAC1B,QAAQ,CAAC,KAAK,EAAE;YACd,QAAQ,CAAC,EAAE,EAAE,SAAS,MAAM,EAAE,CAAA;YAC9B,QAAQ,CAAC,GAAG,EAAE,SAAS,MAAM,EAAE,CAAA;SAChC,CAAA;QACD,QAAQ,CAAC,QAAQ,EAAE,SAAS,mBAAmB,EAAE,CAAA;QACjD,QAAQ,CAAC,WAAW,EAAE,SAAS,MAAM,EAAE,CAAA;KACxC,CAAA;CACF;AAED;;GAE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execution Contract Factory
|
|
3
|
+
*
|
|
4
|
+
* Creates ExecutionContract from SpecInfo.
|
|
5
|
+
* All rules come from spec-core, no additional logic introduced.
|
|
6
|
+
*/
|
|
7
|
+
import type { ExecutionContract, Gate, Boundaries, CompletionConfig, VerificationConfig, SuccessCriterion, SpecSnapshot, SpecInfo, CriterionStatus, GateDeniedReason } from "./types.js";
|
|
8
|
+
/**
|
|
9
|
+
* Contract Factory
|
|
10
|
+
*
|
|
11
|
+
* Pure function: SpecInfo → ExecutionContract
|
|
12
|
+
*/
|
|
13
|
+
export declare namespace ContractFactory {
|
|
14
|
+
/**
|
|
15
|
+
* Create an ExecutionContract from a Spec
|
|
16
|
+
*
|
|
17
|
+
* @param spec - The spec to create contract from, or null if spec not found
|
|
18
|
+
* @returns ExecutionContract with gate check and execution boundaries
|
|
19
|
+
*/
|
|
20
|
+
function create(spec: SpecInfo | null): ExecutionContract;
|
|
21
|
+
}
|
|
22
|
+
export type { ExecutionContract, Gate, Boundaries, CompletionConfig, VerificationConfig, SuccessCriterion, SpecSnapshot, SpecInfo, CriterionStatus, GateDeniedReason, };
|
|
23
|
+
export { EMPTY_BOUNDARIES, EMPTY_COMPLETION, EMPTY_SNAPSHOT } from "./types.js";
|
|
24
|
+
//# sourceMappingURL=contract.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contract.d.ts","sourceRoot":"","sources":["../src/contract.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EACV,iBAAiB,EACjB,IAAI,EACJ,UAAU,EACV,gBAAgB,EAChB,kBAAkB,EAClB,gBAAgB,EAChB,YAAY,EACZ,QAAQ,EACR,eAAe,EACf,gBAAgB,EACjB,MAAM,YAAY,CAAA;AAOnB;;;;GAIG;AACH,yBAAiB,eAAe,CAAC;IAC/B;;;;;OAKG;IACH,SAAgB,MAAM,CAAC,IAAI,EAAE,QAAQ,GAAG,IAAI,GAAG,iBAAiB,CAsB/D;CA8GF;AAGD,YAAY,EACV,iBAAiB,EACjB,IAAI,EACJ,UAAU,EACV,gBAAgB,EAChB,kBAAkB,EAClB,gBAAgB,EAChB,YAAY,EACZ,QAAQ,EACR,eAAe,EACf,gBAAgB,GACjB,CAAA;AAGD,OAAO,EACL,gBAAgB,EAChB,gBAAgB,EAChB,cAAc,EACf,MAAM,YAAY,CAAA"}
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Failure Memory
|
|
3
|
+
*
|
|
4
|
+
* Records and tracks failed execution patterns.
|
|
5
|
+
* Prevents repeated mistakes by recognizing failure patterns.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Structured failure patterns
|
|
9
|
+
*
|
|
10
|
+
* These are machine-classifiable error types.
|
|
11
|
+
* "other" is intentionally excluded - unknown failures should not be recorded.
|
|
12
|
+
*/
|
|
13
|
+
export type FailurePattern = "type_error" | "missing_import" | "dependency_missing" | "test_failure" | "runtime_error" | "permission_denied" | "file_not_found" | "syntax_error";
|
|
14
|
+
/**
|
|
15
|
+
* Failure memory configuration
|
|
16
|
+
*/
|
|
17
|
+
export interface FailureMemoryConfig {
|
|
18
|
+
readonly capacity: number;
|
|
19
|
+
readonly retryThreshold: number;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Default configuration
|
|
23
|
+
*/
|
|
24
|
+
export declare const DEFAULT_FAILURE_CONFIG: FailureMemoryConfig;
|
|
25
|
+
/**
|
|
26
|
+
* A single failure record
|
|
27
|
+
*/
|
|
28
|
+
export interface FailureEntry {
|
|
29
|
+
readonly id: string;
|
|
30
|
+
readonly criterionId: string;
|
|
31
|
+
readonly pattern: FailurePattern;
|
|
32
|
+
readonly hint?: string;
|
|
33
|
+
readonly count: number;
|
|
34
|
+
readonly firstSeen: number;
|
|
35
|
+
readonly lastSeen: number;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Input for recording a failure
|
|
39
|
+
*/
|
|
40
|
+
export interface FailureInput {
|
|
41
|
+
readonly criterionId: string;
|
|
42
|
+
readonly pattern: FailurePattern;
|
|
43
|
+
readonly hint?: string;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Failure summary for context
|
|
47
|
+
*/
|
|
48
|
+
export interface FailureSummary {
|
|
49
|
+
readonly total: number;
|
|
50
|
+
readonly patterns: readonly string[];
|
|
51
|
+
readonly recent: readonly FailureEntry[];
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Pattern Extractor
|
|
55
|
+
*
|
|
56
|
+
* Extracts structured failure patterns from tool outputs.
|
|
57
|
+
*
|
|
58
|
+
* IMPORTANT: Returns null for unclassifiable failures.
|
|
59
|
+
* Null results should NOT be recorded in FailureMemory
|
|
60
|
+
* to prevent noise pollution.
|
|
61
|
+
*/
|
|
62
|
+
export declare namespace PatternExtractor {
|
|
63
|
+
/**
|
|
64
|
+
* Extract failure pattern from tool output
|
|
65
|
+
*
|
|
66
|
+
* @param tool - Tool name that was executed
|
|
67
|
+
* @param output - Tool output (any type)
|
|
68
|
+
* @returns FailurePattern if recognized, null otherwise
|
|
69
|
+
*/
|
|
70
|
+
function fromToolOutput(tool: string, output: unknown): FailurePattern | null;
|
|
71
|
+
/**
|
|
72
|
+
* Check if a pattern should be recorded
|
|
73
|
+
*
|
|
74
|
+
* Null patterns should not be recorded.
|
|
75
|
+
*/
|
|
76
|
+
function shouldRecord(pattern: FailurePattern | null): boolean;
|
|
77
|
+
/**
|
|
78
|
+
* Extract hint from output for debugging
|
|
79
|
+
*/
|
|
80
|
+
function extractHint(output: unknown): string | undefined;
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Failure Memory class
|
|
84
|
+
*
|
|
85
|
+
* Records failures with LRU eviction when capacity is reached.
|
|
86
|
+
* Checks retry threshold to prevent repeated mistakes.
|
|
87
|
+
*/
|
|
88
|
+
export declare class FailureMemory {
|
|
89
|
+
private readonly _config;
|
|
90
|
+
private readonly _entries;
|
|
91
|
+
constructor(config?: FailureMemoryConfig);
|
|
92
|
+
/**
|
|
93
|
+
* Record a failure
|
|
94
|
+
*
|
|
95
|
+
* If the same failure (same criterion + pattern) already exists,
|
|
96
|
+
* increments the count. Otherwise, adds a new entry.
|
|
97
|
+
*/
|
|
98
|
+
record(input: FailureInput): void;
|
|
99
|
+
/**
|
|
100
|
+
* Check if a criterion should be skipped due to repeated failures
|
|
101
|
+
*
|
|
102
|
+
* Returns true if the same failure has occurred >= retryThreshold times.
|
|
103
|
+
*/
|
|
104
|
+
shouldSkip(criterionId: string, pattern: FailurePattern): boolean;
|
|
105
|
+
/**
|
|
106
|
+
* Get failure count for a specific criterion + pattern
|
|
107
|
+
*/
|
|
108
|
+
getFailureCount(criterionId: string, pattern: FailurePattern): number;
|
|
109
|
+
/**
|
|
110
|
+
* Get all failures for a criterion
|
|
111
|
+
*/
|
|
112
|
+
getFailuresForCriterion(criterionId: string): FailureEntry[];
|
|
113
|
+
/**
|
|
114
|
+
* Get compressed failure summary
|
|
115
|
+
*/
|
|
116
|
+
summarize(): FailureSummary;
|
|
117
|
+
/**
|
|
118
|
+
* Clear all entries
|
|
119
|
+
*/
|
|
120
|
+
clear(): void;
|
|
121
|
+
/**
|
|
122
|
+
* Get total entry count
|
|
123
|
+
*/
|
|
124
|
+
get size(): number;
|
|
125
|
+
/**
|
|
126
|
+
* Create key for storing entries
|
|
127
|
+
*/
|
|
128
|
+
private _makeKey;
|
|
129
|
+
/**
|
|
130
|
+
* Find least recently used entry
|
|
131
|
+
*/
|
|
132
|
+
private _findLRU;
|
|
133
|
+
}
|
|
134
|
+
//# sourceMappingURL=failure.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"failure.d.ts","sourceRoot":"","sources":["../src/failure.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAMH;;;;;GAKG;AACH,MAAM,MAAM,cAAc,GACtB,YAAY,GACZ,gBAAgB,GAChB,oBAAoB,GACpB,cAAc,GACd,eAAe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OAEG;IACH,SAAgB,WAAW,CAAC,MAAM,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,CAc/D;CA+EF;AAMD;;;;;GAKG;AACH,qBAAa,aAAa;IACxB,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAqB;IAC7C,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAA2B;gBAExC,MAAM,GAAE,mBAA4C;IAKhE;;;;;OAKG;IACH,MAAM,CAAC,KAAK,EAAE,YAAY,GAAG,IAAI;IAwCjC;;;;OAIG;IACH,UAAU,CAAC,WAAW,EAAE,MAAM,EAAE,OAAO,EAAE,cAAc,GAAG,OAAO;IAMjE;;OAEG;IACH,eAAe,CAAC,WAAW,EAAE,MAAM,EAAE,OAAO,EAAE,cAAc,GAAG,MAAM;IAKrE;;OAEG;IACH,uBAAuB,CAAC,WAAW,EAAE,MAAM,GAAG,YAAY,EAAE;IAU5D;;OAEG;IACH,SAAS,IAAI,cAAc;IAa3B;;OAEG;IACH,KAAK,IAAI,IAAI;IAIb;;OAEG;IACH,IAAI,IAAI,IAAI,MAAM,CAEjB;IAED;;OAEG;IACH,OAAO,CAAC,QAAQ;IAIhB;;OAEG;IACH,OAAO,CAAC,QAAQ;CAajB"}
|
package/dist/gate.d.ts
ADDED
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Execution Gate
|
|
3
|
+
*
|
|
4
|
+
* Determines if execution is allowed based on:
|
|
5
|
+
* 1. Spec existence
|
|
6
|
+
* 2. Spec status (cancelled, implemented, approved)
|
|
7
|
+
* 3. Iteration limits
|
|
8
|
+
* 4. Failure blocking
|
|
9
|
+
*
|
|
10
|
+
* Check order is critical for correct behavior.
|
|
11
|
+
*/
|
|
12
|
+
import type { SpecInfo } from "./types.js";
|
|
13
|
+
/**
|
|
14
|
+
* Gate check result
|
|
15
|
+
*
|
|
16
|
+
* If allowed is true, contract contains the execution contract.
|
|
17
|
+
* If allowed is false, reason contains the denial reason.
|
|
18
|
+
*/
|
|
19
|
+
export interface GateResult {
|
|
20
|
+
readonly allowed: boolean;
|
|
21
|
+
readonly reason?: GateDeniedReason;
|
|
22
|
+
readonly contract?: import("./contract.js").ExecutionContract;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Reasons why execution is denied
|
|
26
|
+
*/
|
|
27
|
+
export type GateDeniedReason = "spec_not_found" | "spec_cancelled" | "spec_already_implemented" | "spec_not_approved" | "max_iterations_exceeded" | "blocked_by_failures";
|
|
28
|
+
/**
|
|
29
|
+
* Execution session state interface (partial)
|
|
30
|
+
* Used for gate checks without requiring full import
|
|
31
|
+
*/
|
|
32
|
+
export interface ExecutionSessionState {
|
|
33
|
+
readonly iteration: number;
|
|
34
|
+
readonly config: {
|
|
35
|
+
readonly maxIterations: number;
|
|
36
|
+
};
|
|
37
|
+
/**
|
|
38
|
+
* Check if session is blocked by failures
|
|
39
|
+
*/
|
|
40
|
+
isBlockedByFailures(): boolean;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Execution Gate
|
|
44
|
+
*
|
|
45
|
+
* Performs pre-execution checks in the correct order:
|
|
46
|
+
* 1. Spec not found
|
|
47
|
+
* 2. Spec cancelled
|
|
48
|
+
* 3. Spec already implemented
|
|
49
|
+
* 4. Spec not approved
|
|
50
|
+
* 5. Max iterations exceeded
|
|
51
|
+
* 6. Blocked by failures
|
|
52
|
+
*/
|
|
53
|
+
export declare namespace ExecutionGate {
|
|
54
|
+
/**
|
|
55
|
+
* Check if execution is allowed
|
|
56
|
+
*
|
|
57
|
+
* @param spec - The spec to check, or null if not found
|
|
58
|
+
* @param session - Current execution session state
|
|
59
|
+
* @returns Gate check result
|
|
60
|
+
*/
|
|
61
|
+
function check(spec: SpecInfo | null, session: ExecutionSessionState): GateResult;
|
|
62
|
+
/**
|
|
63
|
+
* Quick check without session state
|
|
64
|
+
*
|
|
65
|
+
* Only checks spec-related conditions (1-4),
|
|
66
|
+
* not iteration or failure blocking.
|
|
67
|
+
*
|
|
68
|
+
* @param spec - The spec to check, or null if not found
|
|
69
|
+
* @returns Gate check result
|
|
70
|
+
*/
|
|
71
|
+
function checkSpecOnly(spec: SpecInfo | null): Omit<GateResult, "contract">;
|
|
72
|
+
/**
|
|
73
|
+
* Check if a specific reason allows retry
|
|
74
|
+
*
|
|
75
|
+
* Some denial reasons are permanent (cancelled, implemented),
|
|
76
|
+
* others are temporary (not_approved, iterations_exceeded).
|
|
77
|
+
*/
|
|
78
|
+
function isRetryableReason(reason: GateDeniedReason): boolean;
|
|
79
|
+
/**
|
|
80
|
+
* Check if a specific reason is permanent (terminal)
|
|
81
|
+
*/
|
|
82
|
+
function isTerminalReason(reason: GateDeniedReason): boolean;
|
|
83
|
+
}
|
|
84
|
+
//# sourceMappingURL=gate.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gate.d.ts","sourceRoot":"","sources":["../src/gate.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AAG1C;;;;;GAKG;AACH,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAA;IACzB,QAAQ,CAAC,MAAM,CAAC,EAAE,gBAAgB,CAAA;IAClC,QAAQ,CAAC,QAAQ,CAAC,EAAE,OAAO,eAAe,EAAE,iBAAiB,CAAA;CAC9D;AAED;;GAEG;AACH,MAAM,MAAM,gBAAgB,GACxB,gBAAgB,GAChB,gBAAgB,GAChB,0BAA0B,GAC1B,mBAAmB,GACnB,yBAAyB,GACzB,qBAAqB,CAAA;AAEzB;;;GAGG;AACH,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAA;IAC1B,QAAQ,CAAC,MAAM,EAAE;QACf,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAA;KAC/B,CAAA;IACD;;OAEG;IACH,mBAAmB,IAAI,OAAO,CAAA;CAC/B;AAED;;;;;;;;;;GAUG;AACH,yBAAiB,aAAa,CAAC;IAC7B;;;;;;OAMG;IACH,SAAgB,KAAK,CACnB,IAAI,EAAE,QAAQ,GAAG,IAAI,EACrB,OAAO,EAAE,qBAAqB,GAC7B,UAAU,CAqCZ;IAED;;;;;;;;OAQG;IACH,SAAgB,aAAa,CAAC,IAAI,EAAE,QAAQ,GAAG,IAAI,GAAG,IAAI,CAAC,UAAU,EAAE,UAAU,CAAC,CAuBjF;IAED;;;;;OAKG;IACH,SAAgB,iBAAiB,CAAC,MAAM,EAAE,gBAAgB,GAAG,OAAO,CAOnE;IAED;;OAEG;IACH,SAAgB,gBAAgB,CAAC,MAAM,EAAE,gBAAgB,GAAG,OAAO,CAOlE;CACF"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @cristochang/spec-execution
|
|
3
|
+
*
|
|
4
|
+
* Spec execution orchestration layer for OpenCode
|
|
5
|
+
*
|
|
6
|
+
* This package provides the execution and orchestration layer for Spec workflows.
|
|
7
|
+
* It bridges the gap between Spec governance (spec-core) and execution runners (Ralph).
|
|
8
|
+
*
|
|
9
|
+
* @packageDocumentation
|
|
10
|
+
*/
|
|
11
|
+
export type { SpecInfo, ExecutionContract, Gate, Boundaries, CompletionConfig, VerificationConfig, SuccessCriterion, SpecSnapshot, CriterionStatus, GateDeniedReason, } from "./types.js";
|
|
12
|
+
export { EMPTY_BOUNDARIES, EMPTY_COMPLETION, EMPTY_SNAPSHOT, } from "./contract.js";
|
|
13
|
+
export { ContractFactory } from "./contract.js";
|
|
14
|
+
export { ExecutionGate } from "./gate.js";
|
|
15
|
+
export type { GateResult, ExecutionSessionState, } from "./gate.js";
|
|
16
|
+
export { ExecutionState, computeProgress, createToolCallSummary, restoreFromSnapshot, } from "./state.js";
|
|
17
|
+
export type { CriteriaProgress, ToolCallSummary, ExecutionStateSnapshot, } from "./state.js";
|
|
18
|
+
export { FailureMemory, PatternExtractor, DEFAULT_FAILURE_CONFIG, } from "./failure.js";
|
|
19
|
+
export type { FailurePattern, FailureMemoryConfig, FailureEntry, FailureInput, FailureSummary, } from "./failure.js";
|
|
20
|
+
export { ContextAssembler, DEFAULT_ASSEMBLE_OPTIONS, createWorkingFocus, } from "./context.js";
|
|
21
|
+
export type { ImmutableContext, StateContext, FailureContext, WorkingContext, AssembledContext, ContextMetadata, AssembleOptions, WorkingFocus, CriterionDescriptor, CriterionStatusEntry, FailureHint, } from "./context.js";
|
|
22
|
+
export { CompletionDetector, createEvidence, createRecommendation, createProposal, } from "./completion.js";
|
|
23
|
+
export type { TestEvidence, CompletionEvidence, NextStep, Confidence, CompletionRecommendation, CompletionProposal, ProposalContent, SuggestedAction, ProposalAction, } from "./completion.js";
|
|
24
|
+
export { createSuccessResult, createFailureResult, isExecutorAvailable, createRalphAdapter, createSession, RalphAdapter, ExecutionSession, } from "./runner/index.js";
|
|
25
|
+
export type { Executor, ExecutorResult, RalphConfig, RalphInput, RalphResult, ExecutionSessionConfig, SessionState, SessionStatus, IterationResult, } from "./runner/index.js";
|
|
26
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAGH,YAAY,EACV,QAAQ,EACR,iBAAiB,EACjB,IAAI,EACJ,UAAU,EACV,gBAAgB,EAChB,kBAAkB,EAClB,gBAAgB,EAChB,YAAY,EACZ,eAAe,EACf,gBAAgB,GACjB,MAAM,YAAY,CAAA;AAGnB,OAAO,EACL,gBAAgB,EAChB,gBAAgB,EAChB,cAAc,GACf,MAAM,eAAe,CAAA;AAGtB,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAA;AAG/C,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAA;AACzC,YAAY,EACV,UAAU,EACV,qBAAqB,GACtB,MAAM,WAAW,CAAA;AAGlB,OAAO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