opencode-plugin-flow 4.3.8 → 4.4.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/CHANGELOG.md +50 -0
- package/README.md +26 -18
- package/dist/adapters/opencode/tools.d.ts +33 -11
- package/dist/cli.js +620 -543
- package/dist/cli.js.map +3 -3
- package/dist/config-shared.d.ts +2 -2
- package/dist/index.js +1504 -712
- package/dist/index.js.map +11 -9
- package/dist/prompt-baseline-fixtures.d.ts +19 -0
- package/dist/prompt-model-evaluation.d.ts +99 -0
- package/dist/prompt-quality.d.ts +73 -0
- package/dist/prompt-surfaces.d.ts +28 -0
- package/dist/runtime/api.d.ts +26 -7
- package/dist/runtime/schema.d.ts +260 -66
- package/dist/runtime/transitions.d.ts +18 -8
- package/dist/runtime/workspace.d.ts +1 -0
- package/package.json +4 -2
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Frozen historical prompt assembly used only for comparative evaluation.
|
|
3
|
+
*
|
|
4
|
+
* These strings capture the pre-compiler public startup and hidden-worker
|
|
5
|
+
* prompts. They are not production prompt sources and must never be selected by
|
|
6
|
+
* the default compiled Flow surfaces. Keep the exception explicit so manual
|
|
7
|
+
* baseline text cannot be mistaken for a maintained projection of skill rules.
|
|
8
|
+
*/
|
|
9
|
+
export declare const LEGACY_PROMPT_BASELINE: Readonly<{
|
|
10
|
+
publicCommandPreflight: string;
|
|
11
|
+
workerPrompts: Readonly<{
|
|
12
|
+
"flow-evidence-worker": "Use Flow evidence mode. Inspect only the assigned slice, do not edit files, do not call state-changing Flow tools, and return coverage, evidence inspected, confidence-tagged findings or facts, gaps, and manager follow-ups. Return only the assigned Flow handoff. Cite or drop every claim, label single-source, inferred, and unsettled claims, and report blocked if the assigned scope, expected coverage, or handoff shape is missing. Empty or unstructured output is a failed handoff; return blocked with the missing elements instead.";
|
|
13
|
+
"flow-validation-worker": "Use Flow validation mode. Run only manager-specified commands or propose focused checks, do not edit files, do not call state-changing Flow tools, and report exact command, status, raw outcome summary, coverage, confidence, gaps, and manager follow-ups. Return only the assigned Flow handoff. Cite or drop every claim, label single-source, inferred, and unsettled claims, and report blocked if the assigned scope, expected coverage, or handoff shape is missing. Empty or unstructured output is a failed handoff; return blocked with the missing elements instead.";
|
|
14
|
+
"flow-audit-worker": "Use Flow audit mode. Inspect only the assigned slice, actively refute candidate findings before reporting them, do not edit files, do not call state-changing Flow tools, and return coverage, evidence, guards checked, confidence, gaps, and manager follow-ups. Return only the assigned Flow handoff. Cite or drop every claim, label single-source, inferred, and unsettled claims, and report blocked if the assigned scope, expected coverage, or handoff shape is missing. Empty or unstructured output is a failed handoff; return blocked with the missing elements instead.";
|
|
15
|
+
"flow-candidate-worker": "Use Flow candidate-implementation mode only when the manager assigned an isolated worktree or exact non-overlapping path ownership. Do not edit .flow/**, do not call state-changing Flow tools, do not complete Flow state, and return changed or proposed patch, verification run, coverage, confidence, merge risks, and manager follow-ups. Return only the assigned Flow handoff. Cite or drop every claim, label single-source, inferred, and unsettled claims, and report blocked if the assigned scope, expected coverage, or handoff shape is missing. Empty or unstructured output is a failed handoff; return blocked with the missing elements instead.";
|
|
16
|
+
"flow-verifier-worker": "Use Flow verifier mode. Verify only the assigned claims against the provided sources, commands, counts, or current docs. Do not generate new scope, do not edit files, do not call state-changing Flow tools, and return supported, partly-supported, unsupported, or source-not-found per claim with evidence, confidence, gaps, and manager follow-ups. Return only the assigned Flow handoff. Cite or drop every claim, label single-source, inferred, and unsettled claims, and report blocked if the assigned scope, expected coverage, or handoff shape is missing. Empty or unstructured output is a failed handoff; return blocked with the missing elements instead.";
|
|
17
|
+
}>;
|
|
18
|
+
reviewerSections: readonly string[];
|
|
19
|
+
}>;
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { type FlowPromptVariant } from "./prompt-surfaces";
|
|
3
|
+
declare const ModelDecisionSchema: z.ZodObject<{
|
|
4
|
+
id: z.ZodString;
|
|
5
|
+
route: z.ZodEnum<{
|
|
6
|
+
"flow-plan": "flow-plan";
|
|
7
|
+
"flow-run": "flow-run";
|
|
8
|
+
"flow-review": "flow-review";
|
|
9
|
+
"flow-evidence-worker": "flow-evidence-worker";
|
|
10
|
+
"flow-validation-worker": "flow-validation-worker";
|
|
11
|
+
"flow-audit-worker": "flow-audit-worker";
|
|
12
|
+
"flow-candidate-worker": "flow-candidate-worker";
|
|
13
|
+
"flow-verifier-worker": "flow-verifier-worker";
|
|
14
|
+
"flow-auto": "flow-auto";
|
|
15
|
+
"flow-status": "flow-status";
|
|
16
|
+
"flow-reviewer": "flow-reviewer";
|
|
17
|
+
}>;
|
|
18
|
+
executionMode: z.ZodEnum<{
|
|
19
|
+
blocked: "blocked";
|
|
20
|
+
serial: "serial";
|
|
21
|
+
readonly_parallel: "readonly_parallel";
|
|
22
|
+
candidate_worker: "candidate_worker";
|
|
23
|
+
}>;
|
|
24
|
+
workers: z.ZodArray<z.ZodString>;
|
|
25
|
+
stateOwner: z.ZodEnum<{
|
|
26
|
+
"root-manager": "root-manager";
|
|
27
|
+
worker: "worker";
|
|
28
|
+
}>;
|
|
29
|
+
callsStatusFirst: z.ZodBoolean;
|
|
30
|
+
planOnly: z.ZodBoolean;
|
|
31
|
+
reviewFirst: z.ZodBoolean;
|
|
32
|
+
validation: z.ZodArray<z.ZodEnum<{
|
|
33
|
+
broad: "broad";
|
|
34
|
+
focused: "focused";
|
|
35
|
+
behavioral: "behavioral";
|
|
36
|
+
ui: "ui";
|
|
37
|
+
browser: "browser";
|
|
38
|
+
}>>;
|
|
39
|
+
independentReview: z.ZodBoolean;
|
|
40
|
+
reviewDepth: z.ZodEnum<{
|
|
41
|
+
broad: "broad";
|
|
42
|
+
quick: "quick";
|
|
43
|
+
standard: "standard";
|
|
44
|
+
detailed: "detailed";
|
|
45
|
+
not_applicable: "not_applicable";
|
|
46
|
+
}>;
|
|
47
|
+
manifestComplete: z.ZodBoolean;
|
|
48
|
+
coverage: z.ZodEnum<{
|
|
49
|
+
missing: "missing";
|
|
50
|
+
partial: "partial";
|
|
51
|
+
not_applicable: "not_applicable";
|
|
52
|
+
complete: "complete";
|
|
53
|
+
}>;
|
|
54
|
+
handoffStatus: z.ZodEnum<{
|
|
55
|
+
blocked: "blocked";
|
|
56
|
+
partial: "partial";
|
|
57
|
+
success: "success";
|
|
58
|
+
not_applicable: "not_applicable";
|
|
59
|
+
}>;
|
|
60
|
+
handoffHasRequiredSections: z.ZodBoolean;
|
|
61
|
+
retryReviews: z.ZodNumber;
|
|
62
|
+
stopsAfterRetryFailure: z.ZodBoolean;
|
|
63
|
+
phaseBoundaryAction: z.ZodEnum<{
|
|
64
|
+
none: "none";
|
|
65
|
+
stop: "stop";
|
|
66
|
+
resume_with_ack: "resume_with_ack";
|
|
67
|
+
}>;
|
|
68
|
+
sessionContinuation: z.ZodEnum<{
|
|
69
|
+
continue: "continue";
|
|
70
|
+
not_applicable: "not_applicable";
|
|
71
|
+
stop_on_runtime_boundary: "stop_on_runtime_boundary";
|
|
72
|
+
self_initiated_rollover: "self_initiated_rollover";
|
|
73
|
+
}>;
|
|
74
|
+
candidateDecision: z.ZodEnum<{
|
|
75
|
+
used: "used";
|
|
76
|
+
serial_required: "serial_required";
|
|
77
|
+
not_applicable: "not_applicable";
|
|
78
|
+
}>;
|
|
79
|
+
completionClaimed: z.ZodBoolean;
|
|
80
|
+
reason: z.ZodString;
|
|
81
|
+
}, z.core.$strict>;
|
|
82
|
+
export type ModelDecision = z.infer<typeof ModelDecisionSchema>;
|
|
83
|
+
export type ModelEvaluationGrade = {
|
|
84
|
+
passedScenarios: number;
|
|
85
|
+
totalScenarios: number;
|
|
86
|
+
passedCriteria: number;
|
|
87
|
+
totalCriteria: number;
|
|
88
|
+
scenarios: Array<{
|
|
89
|
+
id: string;
|
|
90
|
+
passed: boolean;
|
|
91
|
+
passedCriteria: number;
|
|
92
|
+
totalCriteria: number;
|
|
93
|
+
failures: string[];
|
|
94
|
+
}>;
|
|
95
|
+
};
|
|
96
|
+
export declare function buildPromptModelEvaluationPacket(variant: FlowPromptVariant): string;
|
|
97
|
+
export declare function parseModelDecisionResponse(text: string): ModelDecision[];
|
|
98
|
+
export declare function gradeModelDecisions(decisions: readonly ModelDecision[]): ModelEvaluationGrade;
|
|
99
|
+
export {};
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { type CompiledFlowPrompt, type FlowPromptSurfaceName, type FlowPromptVariant } from "./prompt-surfaces";
|
|
2
|
+
export type PromptMetric = {
|
|
3
|
+
surface: string;
|
|
4
|
+
variant: FlowPromptVariant | "runtime";
|
|
5
|
+
sources: string[];
|
|
6
|
+
characters: number;
|
|
7
|
+
words: number;
|
|
8
|
+
approximateTokens: number;
|
|
9
|
+
actionableInstructions: number;
|
|
10
|
+
exactDuplicateLines: number;
|
|
11
|
+
repeatedFiveGrams: number;
|
|
12
|
+
nearDuplicateLinePairs: number;
|
|
13
|
+
negativeInstructions: number;
|
|
14
|
+
negativeInstructionDensity: number;
|
|
15
|
+
codeFences: number;
|
|
16
|
+
conditionalFragments: string[];
|
|
17
|
+
roleInapplicableFragments: string[];
|
|
18
|
+
roleInapplicableLines: number;
|
|
19
|
+
criticalRulePositions: Record<string, number | null>;
|
|
20
|
+
structurallyEnforcedRulesPresent: string[];
|
|
21
|
+
terminologyWarnings: string[];
|
|
22
|
+
};
|
|
23
|
+
export type PromptEvaluationResult = {
|
|
24
|
+
variant: FlowPromptVariant;
|
|
25
|
+
scenariosPassed: number;
|
|
26
|
+
scenariosTotal: number;
|
|
27
|
+
criteriaPassed: number;
|
|
28
|
+
criteriaTotal: number;
|
|
29
|
+
staticApproximateTokens: number;
|
|
30
|
+
roleInapplicableLines: number;
|
|
31
|
+
exactDuplicateLines: number;
|
|
32
|
+
scenarios: Array<{
|
|
33
|
+
id: string;
|
|
34
|
+
name: string;
|
|
35
|
+
passed: boolean;
|
|
36
|
+
passedCriteria: number;
|
|
37
|
+
totalCriteria: number;
|
|
38
|
+
failures: string[];
|
|
39
|
+
}>;
|
|
40
|
+
};
|
|
41
|
+
export type PromptRepetitionClassification = {
|
|
42
|
+
id: string;
|
|
43
|
+
classification: "keep" | "consolidate" | "enforce-structurally" | "load-conditionally" | "remove" | "evaluate";
|
|
44
|
+
occurrences: string[];
|
|
45
|
+
rationale: string;
|
|
46
|
+
};
|
|
47
|
+
export declare function measurePromptText(options: {
|
|
48
|
+
surface: string;
|
|
49
|
+
variant: FlowPromptVariant | "runtime";
|
|
50
|
+
text: string;
|
|
51
|
+
compiled?: CompiledFlowPrompt;
|
|
52
|
+
}): PromptMetric;
|
|
53
|
+
export declare function measureCompiledPrompt(compiled: CompiledFlowPrompt): PromptMetric;
|
|
54
|
+
type PromptScenario = {
|
|
55
|
+
id: string;
|
|
56
|
+
name: string;
|
|
57
|
+
input: string;
|
|
58
|
+
expectedRoute: FlowPromptSurfaceName;
|
|
59
|
+
surface: FlowPromptSurfaceName;
|
|
60
|
+
required: Array<{
|
|
61
|
+
label: string;
|
|
62
|
+
pattern: RegExp;
|
|
63
|
+
}>;
|
|
64
|
+
forbidden?: Array<{
|
|
65
|
+
label: string;
|
|
66
|
+
pattern: RegExp;
|
|
67
|
+
}>;
|
|
68
|
+
};
|
|
69
|
+
export declare const PROMPT_EVALUATION_SCENARIOS: readonly PromptScenario[];
|
|
70
|
+
export declare function evaluatePromptVariant(variant: FlowPromptVariant): PromptEvaluationResult;
|
|
71
|
+
export declare const PROMPT_REPETITION_CLASSIFICATIONS: readonly PromptRepetitionClassification[];
|
|
72
|
+
export declare function promptInventoryForVariant(variant: FlowPromptVariant): PromptMetric[];
|
|
73
|
+
export {};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
export type FlowPromptVariant = "baseline" | "lexically-deduplicated" | "surface-specific" | "surface-specific-bookended";
|
|
2
|
+
export type FlowPromptSurfaceName = "flow-auto" | "flow-plan" | "flow-run" | "flow-review" | "flow-status" | "flow-reviewer" | "flow-evidence-worker" | "flow-validation-worker" | "flow-audit-worker" | "flow-candidate-worker" | "flow-verifier-worker";
|
|
3
|
+
export type FlowPromptRole = "manager" | "reviewer" | "evidence-worker" | "validation-worker" | "audit-worker" | "candidate-worker" | "verifier-worker";
|
|
4
|
+
export type FlowPromptFragmentKind = "purpose" | "invariant" | "procedure" | "reference" | "schema" | "checkpoint";
|
|
5
|
+
export type FlowPromptFragment = {
|
|
6
|
+
id: string;
|
|
7
|
+
source: string;
|
|
8
|
+
origin: "skill-source" | "compiler";
|
|
9
|
+
kind: FlowPromptFragmentKind;
|
|
10
|
+
text: string;
|
|
11
|
+
roles: readonly FlowPromptRole[];
|
|
12
|
+
conditional?: boolean;
|
|
13
|
+
};
|
|
14
|
+
export type CompiledFlowPrompt = {
|
|
15
|
+
surface: FlowPromptSurfaceName;
|
|
16
|
+
variant: FlowPromptVariant;
|
|
17
|
+
role: FlowPromptRole;
|
|
18
|
+
text: string;
|
|
19
|
+
fragments: readonly FlowPromptFragment[];
|
|
20
|
+
};
|
|
21
|
+
export type FlowWorkerHandoffKind = "evidence" | "validation" | "audit" | "review-slice" | "verifier" | "candidate";
|
|
22
|
+
export declare function compileFlowPromptSurface(surface: FlowPromptSurfaceName, variant?: FlowPromptVariant): CompiledFlowPrompt;
|
|
23
|
+
export declare const FLOW_STATIC_PROMPT_SURFACES: readonly FlowPromptSurfaceName[];
|
|
24
|
+
export declare function compiledFlowPromptSurfaces(variant?: FlowPromptVariant): Record<FlowPromptSurfaceName, CompiledFlowPrompt>;
|
|
25
|
+
export declare function validateFlowWorkerHandoff(kind: FlowWorkerHandoffKind, text: string): {
|
|
26
|
+
ok: boolean;
|
|
27
|
+
errors: string[];
|
|
28
|
+
};
|
package/dist/runtime/api.d.ts
CHANGED
|
@@ -127,29 +127,47 @@ export declare const FlowFeatureCompleteToolSchema: z.ZodObject<{
|
|
|
127
127
|
orchestrationPasses: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
128
128
|
id: z.ZodString;
|
|
129
129
|
kind: z.ZodEnum<{
|
|
130
|
-
|
|
130
|
+
validation: "validation";
|
|
131
131
|
audit: "audit";
|
|
132
|
+
candidate: "candidate";
|
|
133
|
+
discovery: "discovery";
|
|
132
134
|
review: "review";
|
|
133
|
-
validation: "validation";
|
|
134
135
|
verification: "verification";
|
|
135
|
-
candidate: "candidate";
|
|
136
136
|
"implementation-decision": "implementation-decision";
|
|
137
137
|
}>;
|
|
138
138
|
decision: z.ZodOptional<z.ZodEnum<{
|
|
139
|
-
serial: "serial";
|
|
140
139
|
parallel: "parallel";
|
|
140
|
+
serial: "serial";
|
|
141
141
|
"candidate-exact-path": "candidate-exact-path";
|
|
142
142
|
"candidate-worktree": "candidate-worktree";
|
|
143
143
|
tournament: "tournament";
|
|
144
144
|
skipped: "skipped";
|
|
145
145
|
}>>;
|
|
146
146
|
decisionReason: z.ZodOptional<z.ZodString>;
|
|
147
|
+
candidateEligibility: z.ZodDefault<z.ZodEnum<{
|
|
148
|
+
eligible: "eligible";
|
|
149
|
+
not_eligible: "not_eligible";
|
|
150
|
+
unknown: "unknown";
|
|
151
|
+
}>>;
|
|
152
|
+
candidateDecision: z.ZodOptional<z.ZodEnum<{
|
|
153
|
+
skipped: "skipped";
|
|
154
|
+
used: "used";
|
|
155
|
+
serial_required: "serial_required";
|
|
156
|
+
}>>;
|
|
157
|
+
decisionFactors: z.ZodDefault<z.ZodArray<z.ZodEnum<{
|
|
158
|
+
shared_state: "shared_state";
|
|
159
|
+
overlapping_files: "overlapping_files";
|
|
160
|
+
small_slice: "small_slice";
|
|
161
|
+
needs_manager_judgment: "needs_manager_judgment";
|
|
162
|
+
independent_surface: "independent_surface";
|
|
163
|
+
validation_available: "validation_available";
|
|
164
|
+
}>>>;
|
|
147
165
|
modes: z.ZodDefault<z.ZodArray<z.ZodEnum<{
|
|
148
|
-
audit: "audit";
|
|
149
|
-
review: "review";
|
|
150
|
-
validation: "validation";
|
|
151
166
|
evidence: "evidence";
|
|
167
|
+
validation: "validation";
|
|
168
|
+
audit: "audit";
|
|
152
169
|
verifier: "verifier";
|
|
170
|
+
review: "review";
|
|
153
171
|
"candidate-implementation": "candidate-implementation";
|
|
154
172
|
}>>>;
|
|
155
173
|
workerCount: z.ZodDefault<z.ZodNumber>;
|
|
@@ -175,6 +193,7 @@ export declare const FlowFeatureCompleteToolSchema: z.ZodObject<{
|
|
|
175
193
|
}>>;
|
|
176
194
|
outcome: z.ZodDefault<z.ZodEnum<{
|
|
177
195
|
accepted: "accepted";
|
|
196
|
+
modified: "modified";
|
|
178
197
|
rejected: "rejected";
|
|
179
198
|
partial: "partial";
|
|
180
199
|
"not-covered": "not-covered";
|