@fliwright/tdd 0.0.0-stage → 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/LICENSE +21 -0
- package/README.md +7 -2
- package/dist/baseline/AppCapabilityResetAdapter.d.ts +6 -0
- package/dist/baseline/AppCapabilityResetAdapter.js +41 -0
- package/dist/baseline/BaselineManager.d.ts +67 -0
- package/dist/baseline/BaselineManager.js +145 -0
- package/dist/baseline/StorageResetAdapter.d.ts +19 -0
- package/dist/baseline/StorageResetAdapter.js +43 -0
- package/dist/daemon/DaemonTransport.d.ts +37 -0
- package/dist/daemon/DaemonTransport.js +1 -0
- package/dist/daemon/FlutterDaemonController.d.ts +19 -0
- package/dist/daemon/FlutterDaemonController.js +109 -0
- package/dist/daemon/FlutterDaemonEndpointSource.d.ts +23 -0
- package/dist/daemon/FlutterDaemonEndpointSource.js +37 -0
- package/dist/daemon/ReloadStrategy.d.ts +28 -0
- package/dist/daemon/ReloadStrategy.js +72 -0
- package/dist/daemon/SubprocessDaemonTransport.d.ts +29 -0
- package/dist/daemon/SubprocessDaemonTransport.js +155 -0
- package/dist/devassist/DevAssistCoordinator.d.ts +74 -0
- package/dist/devassist/DevAssistCoordinator.js +388 -0
- package/dist/diagnostics/TddFailureContext.d.ts +56 -0
- package/dist/diagnostics/TddFailureContext.js +220 -0
- package/dist/executor/FocusedRerunRecipe.d.ts +7 -0
- package/dist/executor/FocusedRerunRecipe.js +57 -0
- package/dist/executor/PersistentTestExecutor.d.ts +59 -0
- package/dist/executor/PersistentTestExecutor.js +242 -0
- package/dist/executor/ResultReporter.d.ts +23 -0
- package/dist/executor/ResultReporter.js +50 -0
- package/dist/generator/RedFirstTestGenerator.d.ts +32 -0
- package/dist/generator/RedFirstTestGenerator.js +189 -0
- package/dist/index.d.ts +36 -0
- package/dist/index.js +20 -0
- package/dist/repair/TddRepairPlanner.d.ts +54 -0
- package/dist/repair/TddRepairPlanner.js +132 -0
- package/dist/runtime/TddRuntime.d.ts +87 -0
- package/dist/runtime/TddRuntime.js +589 -0
- package/dist/selectors/SelectorSynthesizer.d.ts +34 -0
- package/dist/selectors/SelectorSynthesizer.js +174 -0
- package/dist/spec/InteractionSpec.d.ts +94 -0
- package/dist/spec/InteractionSpec.js +236 -0
- package/dist/spec/InteractionSpecCoverage.d.ts +17 -0
- package/dist/spec/InteractionSpecCoverage.js +69 -0
- package/dist/types.d.ts +314 -0
- package/dist/types.js +2 -0
- package/dist/workflow/RedFirstWorkflow.d.ts +28 -0
- package/dist/workflow/RedFirstWorkflow.js +33 -0
- package/package.json +42 -3
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
export type { AppHandle, AppStartParams, DaemonMessage, DaemonTransport } from './daemon/DaemonTransport.js';
|
|
2
|
+
export { FlutterDaemonController } from './daemon/FlutterDaemonController.js';
|
|
3
|
+
export { FlutterDaemonEndpointSource } from './daemon/FlutterDaemonEndpointSource.js';
|
|
4
|
+
export type { FlutterDaemonEndpointSourceOptions } from './daemon/FlutterDaemonEndpointSource.js';
|
|
5
|
+
export { SubprocessDaemonTransport, parseDaemonLines } from './daemon/SubprocessDaemonTransport.js';
|
|
6
|
+
export { decideSync, isStructuralFileChange, looksStructuralAfterReload, } from './daemon/ReloadStrategy.js';
|
|
7
|
+
export type { SyncDecision } from './daemon/ReloadStrategy.js';
|
|
8
|
+
export type { SubprocessDaemonTransportOptions } from './daemon/SubprocessDaemonTransport.js';
|
|
9
|
+
export { BaselineManager } from './baseline/BaselineManager.js';
|
|
10
|
+
export type { ResetAdapter, ResetContext, StorageResetOutcome, } from './baseline/BaselineManager.js';
|
|
11
|
+
export { AuthTokensResetAdapter, LocalDbResetAdapter, SecureStorageResetAdapter, StorageBackedResetAdapters, StorageResetAdapter, } from './baseline/StorageResetAdapter.js';
|
|
12
|
+
export { AppCapabilityResetAdapters, IsolatesResetAdapter, PermissionsResetAdapter, TimersResetAdapter, WebviewResetAdapter, } from './baseline/AppCapabilityResetAdapter.js';
|
|
13
|
+
export { TddRepairPlanner } from './repair/TddRepairPlanner.js';
|
|
14
|
+
export type { TddRepairPlannerOptions } from './repair/TddRepairPlanner.js';
|
|
15
|
+
export { TddRuntime } from './runtime/TddRuntime.js';
|
|
16
|
+
export { DevAssistCoordinator } from './devassist/DevAssistCoordinator.js';
|
|
17
|
+
export type { DevAssistAction, DevAssistCoordinatorDeps, DevAssistCycleInput, DevAssistCycleResult, DevAssistInferenceResult, DevAssistRuntime, DevAssistStatus, } from './devassist/DevAssistCoordinator.js';
|
|
18
|
+
export { PersistentTestExecutor } from './executor/PersistentTestExecutor.js';
|
|
19
|
+
export type { BootOptions, TestRunOutcome } from './executor/PersistentTestExecutor.js';
|
|
20
|
+
export { defaultArtifactsRoot, defaultStatusFilePath } from './executor/PersistentTestExecutor.js';
|
|
21
|
+
export { focusAndRerun } from './executor/FocusedRerunRecipe.js';
|
|
22
|
+
export { ResultReporter, collectResultsFromFiles } from './executor/ResultReporter.js';
|
|
23
|
+
export type { CollectedResult } from './executor/ResultReporter.js';
|
|
24
|
+
export { buildTddFailureContext, classifyFailure } from './diagnostics/TddFailureContext.js';
|
|
25
|
+
export type { BuildTddFailureContextInput, TddFailureArtifacts, TddFailureAssertion, TddFailureContext, TddFailureKind, TddRecoveryHint, TddRecoveryHintKind, TddFailureSource, } from './diagnostics/TddFailureContext.js';
|
|
26
|
+
export { generateRedFirstTest, generateRedFirstTestSuite } from './generator/RedFirstTestGenerator.js';
|
|
27
|
+
export type { GenerateRedFirstTestResult, GenerateRedFirstTestSuiteResult, RedFirstTestGeneratorOptions, RedFirstTestSuiteGeneratorOptions, } from './generator/RedFirstTestGenerator.js';
|
|
28
|
+
export { prepareRedFirstWorkflow } from './workflow/RedFirstWorkflow.js';
|
|
29
|
+
export type { PrepareRedFirstWorkflowResult, RedFirstWorkflowContext, RedFirstWorkflowOptions, RedFirstWorkflowPlan, RedFirstWorkflowStatus, } from './workflow/RedFirstWorkflow.js';
|
|
30
|
+
export { bestLocatorHint, synthesizeSelector, synthesizeSelectorsForElements, } from './selectors/SelectorSynthesizer.js';
|
|
31
|
+
export type { SelectorCandidate, SelectorSynthesisResult, SelectorSynthesisStatus, SelectorTraceStep, WidgetCandidate, } from './selectors/SelectorSynthesizer.js';
|
|
32
|
+
export type { InteractionSpec, InteractionSpecValidationIssue, InteractionSpecValidationResult, LocatorHint, SpecAssertion, SpecElement, SpecElementRole, SpecFlow, SpecStep, } from './spec/InteractionSpec.js';
|
|
33
|
+
export { InteractionSpecValidationError, parseInteractionSpec, validateInteractionSpec, } from './spec/InteractionSpec.js';
|
|
34
|
+
export { analyzeInteractionSpecCoverage } from './spec/InteractionSpecCoverage.js';
|
|
35
|
+
export type { InteractionSpecCoverageGap, InteractionSpecCoverageGapKind, InteractionSpecCoverageReport, } from './spec/InteractionSpecCoverage.js';
|
|
36
|
+
export type { CycleOpts, ResetAdapterResult, ResetCategory, ResetReport, RuntimeSnapshot, Scenario, StartOpts, TddCycleResult, TddSyncResult, TddRepairCycleResult, TddRepairOpts, TddRepairPlan, TddRepairPlannerLike, TddRepairProposalEntry, TddRepairStep, TddRepairTrace, TddRuntimeDeps, } from './types.js';
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export { FlutterDaemonController } from './daemon/FlutterDaemonController.js';
|
|
2
|
+
export { FlutterDaemonEndpointSource } from './daemon/FlutterDaemonEndpointSource.js';
|
|
3
|
+
export { SubprocessDaemonTransport, parseDaemonLines } from './daemon/SubprocessDaemonTransport.js';
|
|
4
|
+
export { decideSync, isStructuralFileChange, looksStructuralAfterReload, } from './daemon/ReloadStrategy.js';
|
|
5
|
+
export { BaselineManager } from './baseline/BaselineManager.js';
|
|
6
|
+
export { AuthTokensResetAdapter, LocalDbResetAdapter, SecureStorageResetAdapter, StorageBackedResetAdapters, StorageResetAdapter, } from './baseline/StorageResetAdapter.js';
|
|
7
|
+
export { AppCapabilityResetAdapters, IsolatesResetAdapter, PermissionsResetAdapter, TimersResetAdapter, WebviewResetAdapter, } from './baseline/AppCapabilityResetAdapter.js';
|
|
8
|
+
export { TddRepairPlanner } from './repair/TddRepairPlanner.js';
|
|
9
|
+
export { TddRuntime } from './runtime/TddRuntime.js';
|
|
10
|
+
export { DevAssistCoordinator } from './devassist/DevAssistCoordinator.js';
|
|
11
|
+
export { PersistentTestExecutor } from './executor/PersistentTestExecutor.js';
|
|
12
|
+
export { defaultArtifactsRoot, defaultStatusFilePath } from './executor/PersistentTestExecutor.js';
|
|
13
|
+
export { focusAndRerun } from './executor/FocusedRerunRecipe.js';
|
|
14
|
+
export { ResultReporter, collectResultsFromFiles } from './executor/ResultReporter.js';
|
|
15
|
+
export { buildTddFailureContext, classifyFailure } from './diagnostics/TddFailureContext.js';
|
|
16
|
+
export { generateRedFirstTest, generateRedFirstTestSuite } from './generator/RedFirstTestGenerator.js';
|
|
17
|
+
export { prepareRedFirstWorkflow } from './workflow/RedFirstWorkflow.js';
|
|
18
|
+
export { bestLocatorHint, synthesizeSelector, synthesizeSelectorsForElements, } from './selectors/SelectorSynthesizer.js';
|
|
19
|
+
export { InteractionSpecValidationError, parseInteractionSpec, validateInteractionSpec, } from './spec/InteractionSpec.js';
|
|
20
|
+
export { analyzeInteractionSpecCoverage } from './spec/InteractionSpecCoverage.js';
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { AgentRepair, type RepairProposal, type RepairResult } from '@fliwright/core';
|
|
2
|
+
import type { Page } from '@fliwright/core';
|
|
3
|
+
import type { TddCycleResult, TddRepairPlan, TddRepairPlannerLike } from '../types.js';
|
|
4
|
+
import { type TddFailureContext } from '../diagnostics/TddFailureContext.js';
|
|
5
|
+
export interface TddRepairPlannerOptions {
|
|
6
|
+
/**
|
|
7
|
+
* The `AgentRepair` instance backing the guardrail + safe-apply execution. In production this is
|
|
8
|
+
* constructed with the runtime-owned `Page` (so click/dismissModal/wait act on the live app). The
|
|
9
|
+
* guardrail (`validate`) is authoritative: nothing reaches the app unless it passes.
|
|
10
|
+
*/
|
|
11
|
+
repair: AgentRepair;
|
|
12
|
+
/**
|
|
13
|
+
* Optional override of the candidate-proposal synthesizer. Tests inject a deterministic one; the
|
|
14
|
+
* default maps failure kinds to bounded runtime actions (see {@link synthesizeCandidateProposal}).
|
|
15
|
+
*/
|
|
16
|
+
synthesize?: (failure: TddFailureContext | undefined) => RepairProposal | null;
|
|
17
|
+
/**
|
|
18
|
+
* Stable step id passed to `AgentRepair.execute` so its per-step retry counter is meaningful across
|
|
19
|
+
* loop iterations. Defaults to 'tdd-cycle'.
|
|
20
|
+
*/
|
|
21
|
+
stepId?: string;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Proposes a minimal, guardrail-bounded repair for a red TDD cycle, using `@fliwright/core`'s
|
|
25
|
+
* {@link AgentRepair} as the safety authority. Two modes (design §7 P3):
|
|
26
|
+
*
|
|
27
|
+
* - `'suggest'` returns the plan (diff + per-proposal guardrail verdicts) and applies nothing. The
|
|
28
|
+
* caller (an agent) reviews the diff and decides.
|
|
29
|
+
* - `'safe-apply'` applies only the proposals the AgentRepair `validate()` guard accepts (bounded
|
|
30
|
+
* runtime actions: click/wait/dismissModal/retryStep/observe) and returns their execute results.
|
|
31
|
+
* Source-mutating `codePatch` and unknown kinds are always rejected by the guardrail — the loop
|
|
32
|
+
* can never apply an unbounded edit.
|
|
33
|
+
*
|
|
34
|
+
* The planner never bypasses the guardrail: `validate()` is the single chokepoint. This keeps the
|
|
35
|
+
* closed loop safe even if a future synthesizer is LLM-driven.
|
|
36
|
+
*/
|
|
37
|
+
export declare class TddRepairPlanner implements TddRepairPlannerLike {
|
|
38
|
+
private readonly repair;
|
|
39
|
+
private readonly synthesize;
|
|
40
|
+
private readonly stepId;
|
|
41
|
+
constructor(options: TddRepairPlannerOptions);
|
|
42
|
+
/**
|
|
43
|
+
* Convenience factory: builds an `AgentRepair` over the given page (the same page the runtime's
|
|
44
|
+
* baseline reset uses) and wraps it. Pass the runtime-owned `Page` so safe-apply repairs act on
|
|
45
|
+
* the live app the loop is driving.
|
|
46
|
+
*/
|
|
47
|
+
static forPage(page: Page, options?: {
|
|
48
|
+
maxRetriesPerStep?: number;
|
|
49
|
+
synthesize?: TddRepairPlannerOptions['synthesize'];
|
|
50
|
+
}): TddRepairPlanner;
|
|
51
|
+
propose(result: TddCycleResult, mode: 'suggest' | 'safe-apply'): Promise<TddRepairPlan & {
|
|
52
|
+
applied?: RepairResult[];
|
|
53
|
+
}>;
|
|
54
|
+
}
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import { AgentRepair } from '@fliwright/core';
|
|
2
|
+
import { buildTddFailureContext } from '../diagnostics/TddFailureContext.js';
|
|
3
|
+
/**
|
|
4
|
+
* Maps a red TDD cycle's failure context to a *candidate* minimal `AgentRepair` proposal. This is
|
|
5
|
+
* deliberately heuristic and bounded: it only ever emits one of the runtime-action kinds the
|
|
6
|
+
* AgentRepair guardrail already understands (click / wait / dismissModal / retryStep / observe), so
|
|
7
|
+
* the guardrail can accept or reject each one deterministically. It never emits `codePatch` (the one
|
|
8
|
+
* kind `AgentRepair.validate` always rejects as "cannot mutate source code") — keeping repairs
|
|
9
|
+
* strictly runtime-side is the guardrail's invariant.
|
|
10
|
+
*
|
|
11
|
+
* The synthesizer is intentionally dumb on purpose: a real P3+ iteration would call an LLM here, but
|
|
12
|
+
* the closed loop's safety does NOT depend on the synthesizer being smart — it depends on every
|
|
13
|
+
* proposed action passing `AgentRepair.validate()` before it touches the app. An LLM-driven
|
|
14
|
+
* synthesizer that emitted a `codePatch` or an unknown kind would simply be rejected, exactly like
|
|
15
|
+
* the unit-tested unsafe-proposal case.
|
|
16
|
+
*/
|
|
17
|
+
function synthesizeCandidateProposal(failure) {
|
|
18
|
+
if (!failure)
|
|
19
|
+
return null;
|
|
20
|
+
switch (failure.kind) {
|
|
21
|
+
case 'missing-element':
|
|
22
|
+
case 'ambiguous-element':
|
|
23
|
+
// A common cause: a modal/overlay is in the way, or the element needs a beat to settle.
|
|
24
|
+
return { kind: 'dismissModal' };
|
|
25
|
+
case 'navigation-failed':
|
|
26
|
+
return { kind: 'wait', ms: 250 };
|
|
27
|
+
case 'timeout':
|
|
28
|
+
// A retry is the safe, bounded response; the guardrail caps retries per step.
|
|
29
|
+
return { kind: 'retryStep' };
|
|
30
|
+
case 'mock-not-called':
|
|
31
|
+
case 'state-mismatch':
|
|
32
|
+
case 'wrong-text':
|
|
33
|
+
case 'test-error':
|
|
34
|
+
case 'disconnected':
|
|
35
|
+
return null;
|
|
36
|
+
default:
|
|
37
|
+
return null;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Builds an agent-readable diff/patch string describing the proposed minimal fix. This is what
|
|
42
|
+
* `suggest` mode returns for approval and what `safe-apply` records per iteration so the agent can
|
|
43
|
+
* audit exactly which bounded runtime actions were applied.
|
|
44
|
+
*/
|
|
45
|
+
function describePlan(failure, entries, appliedResults) {
|
|
46
|
+
const header = failure
|
|
47
|
+
? `# TDD repair proposal\n## Failure\n- kind: ${failure.kind}\n- message: ${failure.message}\n- test: ${failure.testFile}${failure.testName ? ` :: ${failure.testName}` : ''}\n`
|
|
48
|
+
: `# TDD repair proposal\n## Failure\n- (no structured failure context)\n`;
|
|
49
|
+
const lines = [header, '## Proposed actions'];
|
|
50
|
+
if (entries.length === 0) {
|
|
51
|
+
lines.push('- (no safe runtime action could be synthesized for this failure)');
|
|
52
|
+
}
|
|
53
|
+
for (const entry of entries) {
|
|
54
|
+
const verdict = entry.safe ? 'SAFE' : `REJECTED${entry.reason ? ` (${entry.reason})` : ''}`;
|
|
55
|
+
lines.push(`- [${verdict}] ${JSON.stringify(entry.proposal)}`);
|
|
56
|
+
}
|
|
57
|
+
if (appliedResults && appliedResults.length > 0) {
|
|
58
|
+
lines.push('', '## Applied');
|
|
59
|
+
for (const r of appliedResults) {
|
|
60
|
+
lines.push(`- ${r.accepted ? 'accepted' : 'rejected'}: ${JSON.stringify(r.action)}${r.reason ? ` — ${r.reason}` : ''}`);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
return lines.join('\n');
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Proposes a minimal, guardrail-bounded repair for a red TDD cycle, using `@fliwright/core`'s
|
|
67
|
+
* {@link AgentRepair} as the safety authority. Two modes (design §7 P3):
|
|
68
|
+
*
|
|
69
|
+
* - `'suggest'` returns the plan (diff + per-proposal guardrail verdicts) and applies nothing. The
|
|
70
|
+
* caller (an agent) reviews the diff and decides.
|
|
71
|
+
* - `'safe-apply'` applies only the proposals the AgentRepair `validate()` guard accepts (bounded
|
|
72
|
+
* runtime actions: click/wait/dismissModal/retryStep/observe) and returns their execute results.
|
|
73
|
+
* Source-mutating `codePatch` and unknown kinds are always rejected by the guardrail — the loop
|
|
74
|
+
* can never apply an unbounded edit.
|
|
75
|
+
*
|
|
76
|
+
* The planner never bypasses the guardrail: `validate()` is the single chokepoint. This keeps the
|
|
77
|
+
* closed loop safe even if a future synthesizer is LLM-driven.
|
|
78
|
+
*/
|
|
79
|
+
export class TddRepairPlanner {
|
|
80
|
+
repair;
|
|
81
|
+
synthesize;
|
|
82
|
+
stepId;
|
|
83
|
+
constructor(options) {
|
|
84
|
+
this.repair = options.repair;
|
|
85
|
+
this.synthesize = options.synthesize ?? synthesizeCandidateProposal;
|
|
86
|
+
this.stepId = options.stepId ?? 'tdd-cycle';
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Convenience factory: builds an `AgentRepair` over the given page (the same page the runtime's
|
|
90
|
+
* baseline reset uses) and wraps it. Pass the runtime-owned `Page` so safe-apply repairs act on
|
|
91
|
+
* the live app the loop is driving.
|
|
92
|
+
*/
|
|
93
|
+
static forPage(page, options) {
|
|
94
|
+
return new TddRepairPlanner({
|
|
95
|
+
repair: new AgentRepair({ page, maxRetriesPerStep: options?.maxRetriesPerStep }),
|
|
96
|
+
synthesize: options?.synthesize,
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
async propose(result, mode) {
|
|
100
|
+
const failure = result.failureContext ?? toFallbackFailure(result);
|
|
101
|
+
const candidate = this.synthesize(failure);
|
|
102
|
+
const proposals = [];
|
|
103
|
+
if (candidate) {
|
|
104
|
+
// The guardrail is authoritative: validate() returns null when the proposal is a bounded,
|
|
105
|
+
// supported runtime action. A codePatch / unknown kind is rejected here regardless of source.
|
|
106
|
+
const reason = this.repair.validate(candidate, this.stepId);
|
|
107
|
+
proposals.push({ proposal: candidate, safe: reason === null, reason: reason ?? undefined });
|
|
108
|
+
}
|
|
109
|
+
let applied;
|
|
110
|
+
if (mode === 'safe-apply') {
|
|
111
|
+
applied = [];
|
|
112
|
+
for (const entry of proposals) {
|
|
113
|
+
if (!entry.safe)
|
|
114
|
+
continue;
|
|
115
|
+
// execute() re-validates and then applies via the page; capture its verdict for the trace.
|
|
116
|
+
applied.push(await this.repair.execute(entry.proposal, this.stepId));
|
|
117
|
+
}
|
|
118
|
+
if (applied.length === 0)
|
|
119
|
+
applied = undefined;
|
|
120
|
+
}
|
|
121
|
+
const diff = describePlan(failure, proposals, applied);
|
|
122
|
+
return { mode, diff, proposals, applied };
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
/** Builds a minimal failure context when a red result lacked a structured one (defensive). */
|
|
126
|
+
function toFallbackFailure(result) {
|
|
127
|
+
return buildTddFailureContext({
|
|
128
|
+
file: result.file,
|
|
129
|
+
testName: result.testName,
|
|
130
|
+
message: result.failure?.message ?? 'Focused TDD test failed.',
|
|
131
|
+
});
|
|
132
|
+
}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { type ResolvedScenario } from '@fliwright/core';
|
|
2
|
+
import type { CycleOpts, RuntimeSnapshot, Scenario, StartOpts, TddCycleResult, TddSyncResult, TddRuntimeDeps } from '../types.js';
|
|
3
|
+
export declare class TddRuntime {
|
|
4
|
+
private readonly daemon;
|
|
5
|
+
private readonly executor;
|
|
6
|
+
private readonly driverFactory;
|
|
7
|
+
private readonly injectedBaseline?;
|
|
8
|
+
private baseline?;
|
|
9
|
+
/** Optional AI repair planner (design §6.2, wired P3). Absent → no repair loop (additive). */
|
|
10
|
+
private repairPlanner?;
|
|
11
|
+
private driver?;
|
|
12
|
+
private app?;
|
|
13
|
+
private vmServiceUrl?;
|
|
14
|
+
private configRoot?;
|
|
15
|
+
private sharedConfig?;
|
|
16
|
+
private startAppParams?;
|
|
17
|
+
private testScenario?;
|
|
18
|
+
private defaultScenarioName?;
|
|
19
|
+
private scenario;
|
|
20
|
+
private focusedTest?;
|
|
21
|
+
private lastResult?;
|
|
22
|
+
private started;
|
|
23
|
+
private launchMode;
|
|
24
|
+
private driverConnections;
|
|
25
|
+
private startSignature?;
|
|
26
|
+
private updatedAtMs;
|
|
27
|
+
private readonly endpointLeases;
|
|
28
|
+
private operationChain;
|
|
29
|
+
private statusFilePath?;
|
|
30
|
+
private statusWriteChain;
|
|
31
|
+
constructor(deps?: TddRuntimeDeps);
|
|
32
|
+
start(opts: StartOpts): Promise<RuntimeSnapshot>;
|
|
33
|
+
/** Interrupt owned transports/execution; the operation chain still drains before reuse. */
|
|
34
|
+
cancel(): Promise<void>;
|
|
35
|
+
/** Wait for real work, including a cycle whose caller already received timeout. */
|
|
36
|
+
whenIdle(): Promise<void>;
|
|
37
|
+
focus(file: string, testName?: string): Promise<void>;
|
|
38
|
+
setTestScenario(scenario: ResolvedScenario): Promise<RuntimeSnapshot>;
|
|
39
|
+
setScenario(scenario: Scenario): Promise<RuntimeSnapshot>;
|
|
40
|
+
syncApp(sync: Exclude<NonNullable<CycleOpts['sync']>, 'auto'>): Promise<TddSyncResult>;
|
|
41
|
+
cycle(testName?: string, opts?: CycleOpts): Promise<TddCycleResult>;
|
|
42
|
+
/**
|
|
43
|
+
* Reconnect after a VM disconnect (design §8). Daemon-start relaunches the app and rebinds to the
|
|
44
|
+
* fresh VM service; attach retries the original URL. If the URL changed, the executor is rebooted
|
|
45
|
+
* so fixtures pick up the new `FLIWRIGHT_VM_SERVICE_URL`. Throws on failure; the caller surfaces a
|
|
46
|
+
* structured error. Awaited on the cycle chain so it never races an in-flight rerun.
|
|
47
|
+
*/
|
|
48
|
+
reconnect(): Promise<RuntimeSnapshot>;
|
|
49
|
+
private reconnectNow;
|
|
50
|
+
private verifyManagedEndpoint;
|
|
51
|
+
private runCycleWithEscalation;
|
|
52
|
+
/**
|
|
53
|
+
* The AI repair closed loop (design §7/§10 P3). Runs serialized inside the cycle chain task after
|
|
54
|
+
* the initial red cycle. Proposes a minimal, guardrail-bounded repair via the wired planner, then
|
|
55
|
+
* (safe-apply only) re-cycles until green or the iteration cap. Never reentrant: the caller has
|
|
56
|
+
* already acquired the chain; this method calls {@link performCycle} directly (not {@link cycle}).
|
|
57
|
+
*
|
|
58
|
+
* In 'suggest' mode it proposes once, attaches the diff as a repair trace, and returns the original
|
|
59
|
+
* red result unchanged (nothing applied). In 'safe-apply' mode it applies only guardrail-safe
|
|
60
|
+
* repairs and re-cycles; reaching the cap still red is a terminal state surfaced via the trace.
|
|
61
|
+
*/
|
|
62
|
+
private runRepairLoop;
|
|
63
|
+
private timeoutResult;
|
|
64
|
+
private performCycle;
|
|
65
|
+
/**
|
|
66
|
+
* Best-effort, non-blocking dump of {@link snapshot} to {@link statusFilePath}, serialized so
|
|
67
|
+
* concurrent writes never interleave. Read-only monitors (VS Code TDD Loop panel) poll this file
|
|
68
|
+
* instead of opening a second driver connection. Never throws; failures are swallowed.
|
|
69
|
+
*/
|
|
70
|
+
private persistStatus;
|
|
71
|
+
private persistStatusTo;
|
|
72
|
+
/** Current endpoint for an owning CLI host; changes after managed reconnect. */
|
|
73
|
+
get endpoint(): string | undefined;
|
|
74
|
+
snapshot(): RuntimeSnapshot;
|
|
75
|
+
stop(opts?: {
|
|
76
|
+
keepAppAlive?: boolean;
|
|
77
|
+
}): Promise<void>;
|
|
78
|
+
private markUpdated;
|
|
79
|
+
private enqueueOperation;
|
|
80
|
+
private controlPhase;
|
|
81
|
+
private sync;
|
|
82
|
+
/** True only when a daemon-started app advertised restart support (gates auto-escalation). */
|
|
83
|
+
private canRestart;
|
|
84
|
+
private requireDriver;
|
|
85
|
+
private requireBaseline;
|
|
86
|
+
private cleanupStartedResources;
|
|
87
|
+
}
|