@getripple/core 1.0.4

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.
@@ -0,0 +1,242 @@
1
+ import { ContextPlanSummary } from "./graph";
2
+ import { StagedCheckAgentActions, StagedCheckSummary } from "./staged-check";
3
+ import type { AgentRuntimeNextPhaseId } from "./agent-workflow";
4
+ import type { RipplePolicyExplanation, RipplePolicyResolution } from "./policy";
5
+ import type { RippleEnforcementLevel, RippleReadinessSummary } from "./readiness";
6
+ export type ChangeIntent = {
7
+ protocol: "ripple-change-intent";
8
+ version: 1;
9
+ id: string;
10
+ createdAt: string;
11
+ task: string;
12
+ targetFile: string;
13
+ risk: ContextPlanSummary["risk"];
14
+ tokenBudget: number;
15
+ controlMode: ControlMode;
16
+ allowedSymbols: string[];
17
+ humanGate: HumanGate;
18
+ humanGateReason: string[];
19
+ boundaryRisk: ControlBoundaryRisk;
20
+ policySource: string;
21
+ policyMatches: string[];
22
+ policyExplanation: RipplePolicyExplanation;
23
+ editableFiles: string[];
24
+ contextFiles: string[];
25
+ allowedFiles: string[];
26
+ expectedFiles: string[];
27
+ expectedSymbols: string[];
28
+ protectedContracts: string[];
29
+ verificationTargets: string[];
30
+ readinessSnapshot: ChangeIntentReadinessSnapshot;
31
+ why: string;
32
+ };
33
+ export type ChangeIntentReadinessSnapshot = {
34
+ status: RippleReadinessSummary["status"];
35
+ enforcementLevel: RippleEnforcementLevel;
36
+ canGuideAgents: boolean;
37
+ canDetectDrift: boolean;
38
+ canBlockInCi: boolean;
39
+ policyExplicit: boolean;
40
+ graphOk: boolean;
41
+ gitOk: boolean;
42
+ ciWorkflowOk: boolean;
43
+ latestIntentOk: boolean;
44
+ gaps: string[];
45
+ nextSteps: string[];
46
+ };
47
+ export type ChangeIntentVerdict = "matched" | "drifted" | "dangerous";
48
+ export type ChangeIntentScope = "matched" | "violated";
49
+ export type ControlMode = "brainstorm" | "function" | "file" | "task" | "pr";
50
+ export type HumanGate = "none" | "required-before-edit" | "required-before-merge";
51
+ export type ControlBoundaryRisk = "low" | "medium" | "high" | "critical";
52
+ export type DriftVerdictStatus = "pass" | "drift" | "danger" | "unknown";
53
+ export type DriftDecision = "continue" | "fix-before-commit" | "stop-and-ask-human" | "create-intent-first";
54
+ export type DriftVerdictSummary = {
55
+ status: DriftVerdictStatus;
56
+ decision: DriftDecision;
57
+ label: "PASS" | "DRIFT" | "DANGER" | "UNKNOWN";
58
+ summary: string;
59
+ why: string[];
60
+ fix: string[];
61
+ };
62
+ export type PolicyDriftStatus = "unchecked" | "unchanged" | "changed";
63
+ export type PolicyDriftDecision = "continue" | "compare-current-policy" | "review-current-policy";
64
+ export type PolicyDriftSummary = {
65
+ status: PolicyDriftStatus;
66
+ decision: PolicyDriftDecision;
67
+ label: "UNKNOWN" | "PASS" | "DRIFT";
68
+ summary: string;
69
+ changedFields: string[];
70
+ why: string[];
71
+ fix: string[];
72
+ currentPolicyExplanation?: RipplePolicyExplanation;
73
+ };
74
+ export type ReadinessDriftStatus = "unchecked" | "unchanged" | "weakened";
75
+ export type ReadinessDriftDecision = "continue" | "compare-current-readiness" | "restore-readiness";
76
+ export type ReadinessDriftSummary = {
77
+ status: ReadinessDriftStatus;
78
+ decision: ReadinessDriftDecision;
79
+ label: "UNKNOWN" | "PASS" | "DRIFT";
80
+ summary: string;
81
+ changedFields: string[];
82
+ weakenedFields: string[];
83
+ savedReadiness: ChangeIntentReadinessSnapshot;
84
+ currentReadiness?: ChangeIntentReadinessSnapshot;
85
+ why: string[];
86
+ fix: string[];
87
+ };
88
+ export type RippleAgentHandoffSource = "check" | "repair" | "audit";
89
+ export type RippleAgentHandoffDecision = "continue" | "audit" | "repair" | "human-review" | "restore-readiness" | "create-intent";
90
+ export type RippleAgentHandoffCommands = {
91
+ doctor: string[];
92
+ plan: string[];
93
+ check: string[];
94
+ audit: string[];
95
+ repair: string[];
96
+ approve: string[];
97
+ unstage: string[];
98
+ verify: string[];
99
+ };
100
+ export type RippleAgentHandoffVerdict = {
101
+ protocol: "ripple-agent-handoff";
102
+ version: 1;
103
+ source: RippleAgentHandoffSource;
104
+ canContinue: boolean;
105
+ mustStop: boolean;
106
+ needsHuman: boolean;
107
+ decision: RippleAgentHandoffDecision;
108
+ nextRequiredPhase: AgentRuntimeNextPhaseId;
109
+ nextRequiredAction: string;
110
+ summary: string;
111
+ why: string[];
112
+ fixNow: string[];
113
+ askHuman: string[];
114
+ commands: RippleAgentHandoffCommands;
115
+ };
116
+ export type BoundaryVerdictStatus = "pass" | "drift" | "danger";
117
+ export type BoundaryDecision = "continue" | "fix-before-commit" | "stop-and-ask-human";
118
+ export type BoundaryVerdictSummary = {
119
+ status: BoundaryVerdictStatus;
120
+ decision: BoundaryDecision;
121
+ label: "PASS" | "DRIFT" | "DANGER";
122
+ controlMode: ControlMode;
123
+ humanRequired: boolean;
124
+ humanGate: HumanGate;
125
+ summary: string;
126
+ why: string[];
127
+ fix: string[];
128
+ changedOutsideBoundaryFiles: string[];
129
+ changedOutsideBoundarySymbols: string[];
130
+ };
131
+ export type ChangeIntentValidationSummary = {
132
+ intentId: string;
133
+ targetFile: string;
134
+ task: string;
135
+ verdict: ChangeIntentVerdict;
136
+ driftVerdict: DriftVerdictSummary;
137
+ boundaryVerdict: BoundaryVerdictSummary;
138
+ controlMode: ControlMode;
139
+ allowedFiles: string[];
140
+ allowedSymbols: string[];
141
+ humanGate: HumanGate;
142
+ humanGateReason: string[];
143
+ boundaryRisk: ControlBoundaryRisk;
144
+ policyExplanation: RipplePolicyExplanation;
145
+ policyDrift: PolicyDriftSummary;
146
+ readinessDrift: ReadinessDriftSummary;
147
+ plannedScope: ChangeIntentScope;
148
+ editableFiles: string[];
149
+ contextFiles: string[];
150
+ plannedFilesChanged: string[];
151
+ contextFilesChanged: string[];
152
+ expectedSymbolsChanged: string[];
153
+ unplannedFiles: string[];
154
+ unplannedSymbols: string[];
155
+ protectedContractChanges: string[];
156
+ unplannedContractChanges: string[];
157
+ reasons: string[];
158
+ recommendedAction: string;
159
+ nextRequiredPhase: AgentRuntimeNextPhaseId;
160
+ nextRequiredAction: string;
161
+ blockingReasons: string[];
162
+ nextSteps: string[];
163
+ requiresAttention: boolean;
164
+ handoff: RippleAgentHandoffVerdict;
165
+ };
166
+ export type StagedCheckWithIntentSummary = StagedCheckSummary & {
167
+ intentValidation?: ChangeIntentValidationSummary;
168
+ nextRequiredPhase?: AgentRuntimeNextPhaseId;
169
+ nextRequiredAction?: string;
170
+ };
171
+ export type IntentDriftRepairStatus = "no-repair-needed" | "repair-required" | "human-review-required" | "contract-review-required" | "intent-required";
172
+ export type IntentDriftRepairActionType = "proceed" | "unstage-file" | "review-symbol" | "review-contract" | "review-policy" | "review-readiness" | "replan" | "verify" | "create-intent";
173
+ export type IntentDriftRepairActionPriority = "blocker" | "required" | "recommended";
174
+ export type IntentDriftRepairAction = {
175
+ type: IntentDriftRepairActionType;
176
+ priority: IntentDriftRepairActionPriority;
177
+ target?: string;
178
+ command?: string;
179
+ reason: string;
180
+ instruction: string;
181
+ };
182
+ export type IntentDriftRepairPlan = {
183
+ protocol: "ripple-intent-drift-repair";
184
+ version: 1;
185
+ intentId?: string;
186
+ verdict: ChangeIntentVerdict | "missing-intent";
187
+ driftVerdict: DriftVerdictSummary;
188
+ boundaryVerdict?: BoundaryVerdictSummary;
189
+ policyExplanation?: RipplePolicyExplanation;
190
+ policyDrift?: PolicyDriftSummary;
191
+ readinessDrift?: ReadinessDriftSummary;
192
+ status: IntentDriftRepairStatus;
193
+ summary: string;
194
+ recommendedAction: string;
195
+ blockingReasons: string[];
196
+ unstageFiles: string[];
197
+ reviewContracts: string[];
198
+ createNewIntent: boolean;
199
+ verificationTargets: string[];
200
+ fixActions: IntentDriftRepairAction[];
201
+ agentActions: StagedCheckAgentActions;
202
+ commands: {
203
+ unstage: string[];
204
+ replan: string[];
205
+ verify: string[];
206
+ };
207
+ nextSteps: string[];
208
+ handoff: RippleAgentHandoffVerdict;
209
+ };
210
+ export type BuildChangeIntentOptions = {
211
+ controlMode?: ControlMode;
212
+ allowedFiles?: string[];
213
+ allowedSymbols?: string[];
214
+ policy?: RipplePolicyResolution;
215
+ policyExplanation?: RipplePolicyExplanation;
216
+ readinessSnapshot?: ChangeIntentReadinessSnapshot;
217
+ };
218
+ export type ValidateChangeIntentOptions = {
219
+ currentPolicyExplanation?: RipplePolicyExplanation;
220
+ currentReadinessSnapshot?: ChangeIntentReadinessSnapshot;
221
+ };
222
+ export declare function buildChangeIntent(plan: ContextPlanSummary, options?: BuildChangeIntentOptions): ChangeIntent;
223
+ export declare function buildChangeIntentReadinessSnapshot(readiness: RippleReadinessSummary): ChangeIntentReadinessSnapshot;
224
+ export declare function buildAgentHandoffVerdict(input: {
225
+ source: RippleAgentHandoffSource;
226
+ canContinue: boolean;
227
+ needsHuman: boolean;
228
+ decision: RippleAgentHandoffDecision;
229
+ nextRequiredPhase: AgentRuntimeNextPhaseId;
230
+ nextRequiredAction: string;
231
+ summary: string;
232
+ why: string[];
233
+ fixNow: string[];
234
+ askHuman?: string[];
235
+ commands?: Partial<RippleAgentHandoffCommands>;
236
+ mustStop?: boolean;
237
+ }): RippleAgentHandoffVerdict;
238
+ export declare function validateStagedCheckAgainstIntent(staged: StagedCheckSummary, intent: ChangeIntent, options?: ValidateChangeIntentOptions): StagedCheckWithIntentSummary;
239
+ export declare function buildIntentDriftRepairPlan(staged: StagedCheckWithIntentSummary): IntentDriftRepairPlan;
240
+ export declare function saveChangeIntent(workspaceRoot: string, intent: ChangeIntent, intentPath?: string): string;
241
+ export declare function loadChangeIntent(workspaceRoot: string, intentPath?: string): ChangeIntent;
242
+ export declare function defaultChangeIntentPath(workspaceRoot: string): string;