yam-flow 0.1.2 → 0.1.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.
@@ -15,6 +15,8 @@ export type TruthStatus = (typeof TRUTH_STATUSES)[number];
15
15
  export type SafetyLevel = 'danger' | 'warning';
16
16
  export type EvidenceKind = 'command' | 'evidence' | 'visual' | 'runtime' | 'skipped' | 'blocked' | 'assumption' | 'cleanup' | 'none';
17
17
  export type RuntimeSubsystem = 'real_runtime' | 'tmux_physical' | 'process_cleanup' | 'browser_visual' | 'db_safety';
18
+ export type RuntimeBackend = 'none' | 'in_app_browser' | 'playwright' | 'terminal' | 'tmux' | 'zellij' | 'unknown';
19
+ export type RuntimeClaim = 'not_started' | 'started' | 'observed' | 'stopped' | 'cleanup_verified' | 'blocked' | 'unknown';
18
20
 
19
21
  export interface SafetyHit {
20
22
  level: SafetyLevel;
@@ -79,6 +81,41 @@ export interface MissionPatchEnvelope {
79
81
  truth_status: TruthStatus;
80
82
  }
81
83
 
84
+ export interface RuntimeBackendEvidence {
85
+ schema: 'yam.runtime-backend-evidence.v1';
86
+ backend: RuntimeBackend;
87
+ claim: RuntimeClaim;
88
+ evidence_id: string;
89
+ command: string;
90
+ cleanup_checked: boolean;
91
+ note: string;
92
+ truth_status: TruthStatus;
93
+ }
94
+
95
+ export interface UeyeRunReport {
96
+ schema: 'yam.ueye-run-report.v1';
97
+ reference_sources: UeyeVisualProvenance[];
98
+ implementation_sources: UeyeVisualProvenance[];
99
+ comparison_result: string;
100
+ design_quality: string;
101
+ blocked_reason: string;
102
+ next_action: string;
103
+ truth_status: TruthStatus;
104
+ }
105
+
106
+ export interface MediaGenerationProof {
107
+ schema: 'yam.media-generation-proof.v1';
108
+ tool_name: string;
109
+ generation_requested: boolean;
110
+ generation_attempted: boolean;
111
+ output_path: string;
112
+ output_hash: string;
113
+ wait_loop_checked: boolean;
114
+ blocked_reason: string;
115
+ next_action: string;
116
+ truth_status: TruthStatus;
117
+ }
118
+
82
119
  export interface FakeRealPolicyResult {
83
120
  schema: 'yam.fake-real-policy.v1';
84
121
  ok: boolean;
@@ -106,6 +143,8 @@ export interface ProofSummary {
106
143
  visualProvenance?: unknown;
107
144
  missionEnvelope?: unknown;
108
145
  rollbackHint?: unknown;
146
+ runtimeBackendEvidence?: unknown;
147
+ mediaProof?: unknown;
109
148
  }
110
149
 
111
150
  export interface ProofOptions {
@@ -139,6 +178,8 @@ export interface YamCompletionProof {
139
178
  visualProvenance: string[];
140
179
  missionEnvelope: string[];
141
180
  rollbackHint: string[];
181
+ runtimeBackendEvidence: string[];
182
+ mediaProof: string[];
142
183
  cleanup: unknown;
143
184
  changed: string[];
144
185
  skipped: string[];
@@ -193,6 +234,73 @@ export function buildMissionPatchEnvelope(input: Partial<MissionPatchEnvelope> =
193
234
  };
194
235
  }
195
236
 
237
+ export function buildRuntimeBackendEvidence(input: Partial<RuntimeBackendEvidence> = {}): RuntimeBackendEvidence {
238
+ const backend = normalizeRuntimeBackend(input.backend);
239
+ const claim = normalizeRuntimeClaim(input.claim);
240
+ return {
241
+ schema: 'yam.runtime-backend-evidence.v1',
242
+ backend,
243
+ claim,
244
+ evidence_id: String(input.evidence_id || ''),
245
+ command: String(input.command || ''),
246
+ cleanup_checked: Boolean(input.cleanup_checked),
247
+ note: String(input.note || ''),
248
+ truth_status: isTruthStatus(input.truth_status) ? input.truth_status : runtimeBackendTruth(backend, claim, Boolean(input.cleanup_checked))
249
+ };
250
+ }
251
+
252
+ export function buildUeyeRunReport(input: Partial<UeyeRunReport> = {}): UeyeRunReport {
253
+ const references = Array.isArray(input.reference_sources)
254
+ ? input.reference_sources.map((item) => buildUeyeVisualProvenance(item))
255
+ : [];
256
+ const implementations = Array.isArray(input.implementation_sources)
257
+ ? input.implementation_sources.map((item) => buildUeyeVisualProvenance(item))
258
+ : [];
259
+ const blockedReason = String(input.blocked_reason || '');
260
+ const comparisonResult = String(input.comparison_result || 'not-verified');
261
+ const hasImplementation = implementations.length > 0;
262
+ const derivedTruth: TruthStatus = blockedReason ? 'blocked'
263
+ : !references.length && !hasImplementation ? 'assumed'
264
+ : comparisonResult === 'matched' && hasImplementation ? 'verified'
265
+ : hasImplementation ? 'partial'
266
+ : 'partial';
267
+ return {
268
+ schema: 'yam.ueye-run-report.v1',
269
+ reference_sources: references,
270
+ implementation_sources: implementations,
271
+ comparison_result: comparisonResult,
272
+ design_quality: String(input.design_quality || 'not-checked'),
273
+ blocked_reason: blockedReason,
274
+ next_action: String(input.next_action || (derivedTruth === 'verified' ? 'no action required' : 'capture or provide implementation screenshot before claiming verified visual status')),
275
+ truth_status: isTruthStatus(input.truth_status) ? input.truth_status : derivedTruth
276
+ };
277
+ }
278
+
279
+ export function buildMediaGenerationProof(input: Partial<MediaGenerationProof> = {}): MediaGenerationProof {
280
+ const requested = Boolean(input.generation_requested);
281
+ const attempted = Boolean(input.generation_attempted);
282
+ const outputHash = String(input.output_hash || 'unknown');
283
+ const blockedReason = String(input.blocked_reason || '');
284
+ const derivedTruth: TruthStatus = blockedReason ? 'blocked'
285
+ : requested && !attempted ? 'blocked'
286
+ : attempted && outputHash !== 'unknown' ? 'verified'
287
+ : attempted ? 'partial'
288
+ : requested ? 'assumed'
289
+ : 'skipped';
290
+ return {
291
+ schema: 'yam.media-generation-proof.v1',
292
+ tool_name: String(input.tool_name || ''),
293
+ generation_requested: requested,
294
+ generation_attempted: attempted,
295
+ output_path: String(input.output_path || ''),
296
+ output_hash: outputHash,
297
+ wait_loop_checked: Boolean(input.wait_loop_checked),
298
+ blocked_reason: blockedReason,
299
+ next_action: String(input.next_action || (derivedTruth === 'blocked' ? 'provide a usable media tool or mark generation as skipped' : 'record output evidence before using generated media as implementation proof')),
300
+ truth_status: isTruthStatus(input.truth_status) ? input.truth_status : derivedTruth
301
+ };
302
+ }
303
+
196
304
  const TRUTH_RANK: Readonly<Record<TruthStatus, number>> = Object.freeze({
197
305
  blocked: 0,
198
306
  real_required_missing: 0,
@@ -273,6 +381,12 @@ export function classifyEvidenceTruth(summary: ProofSummary = {}, options: Proof
273
381
  for (const rollback of asList(summary.rollbackHint)) {
274
382
  rows.push(evidenceRow('evidence', rollback, metadataTruth(rollback, 'partial')));
275
383
  }
384
+ for (const backend of asList(summary.runtimeBackendEvidence)) {
385
+ rows.push(evidenceRow('runtime', backend, readStructuredTruth(backend, 'partial')));
386
+ }
387
+ for (const media of asList(summary.mediaProof)) {
388
+ rows.push(evidenceRow('evidence', media, readStructuredTruth(media, 'partial')));
389
+ }
276
390
  for (const runtime of asList(summary.runtime)) {
277
391
  rows.push(evidenceRow('runtime', runtime, classifyRuntimeEvidence(runtime, options)));
278
392
  }
@@ -359,6 +473,8 @@ export function buildYamCompletionProof(summary: ProofSummary = {}, options: Pro
359
473
  visualProvenance: asList(summary.visualProvenance),
360
474
  missionEnvelope: asList(summary.missionEnvelope),
361
475
  rollbackHint: asList(summary.rollbackHint),
476
+ runtimeBackendEvidence: asList(summary.runtimeBackendEvidence),
477
+ mediaProof: asList(summary.mediaProof),
362
478
  cleanup: summary.cleanup || '',
363
479
  changed: asList(summary.changed),
364
480
  skipped: asList(summary.skipped),
@@ -491,6 +607,37 @@ function runtimeRow(subsystem: RuntimeSubsystem, proofLevel: TruthStatus, requir
491
607
  };
492
608
  }
493
609
 
610
+ function normalizeRuntimeBackend(value: unknown = ''): RuntimeBackend {
611
+ const text = String(value || '').toLowerCase().replace(/[-\s]/g, '_');
612
+ if (text === 'in_app_browser' || text === 'browser') return 'in_app_browser';
613
+ if (text === 'playwright') return 'playwright';
614
+ if (text === 'terminal' || text === 'shell') return 'terminal';
615
+ if (text === 'tmux') return 'tmux';
616
+ if (text === 'zellij') return 'zellij';
617
+ if (text === 'none' || text === 'not_started') return 'none';
618
+ return 'unknown';
619
+ }
620
+
621
+ function normalizeRuntimeClaim(value: unknown = ''): RuntimeClaim {
622
+ const text = String(value || '').toLowerCase().replace(/[-\s]/g, '_');
623
+ if (text === 'not_started' || text === 'none') return 'not_started';
624
+ if (text === 'started') return 'started';
625
+ if (text === 'observed' || text === 'checked') return 'observed';
626
+ if (text === 'stopped') return 'stopped';
627
+ if (text === 'cleanup_verified' || text === 'cleanup_checked') return 'cleanup_verified';
628
+ if (text === 'blocked') return 'blocked';
629
+ return 'unknown';
630
+ }
631
+
632
+ function runtimeBackendTruth(backend: RuntimeBackend, claim: RuntimeClaim, cleanupChecked = false): TruthStatus {
633
+ if (claim === 'blocked') return 'blocked';
634
+ if (backend === 'none' || claim === 'not_started') return 'skipped';
635
+ if (backend === 'unknown' || claim === 'unknown') return 'partial';
636
+ if (claim === 'cleanup_verified' || cleanupChecked) return 'proven';
637
+ if (claim === 'observed' || claim === 'stopped' || claim === 'started') return 'verified';
638
+ return 'partial';
639
+ }
640
+
494
641
  function evidenceRow(kind: EvidenceKind, value: unknown, truth: TruthStatus): EvidenceRow {
495
642
  return { kind, value: String(value || ''), truth };
496
643
  }
@@ -36,6 +36,18 @@ Patch envelope:
36
36
  - verification_hint:
37
37
  - truth_status: verified / partial / skipped / blocked / assumed
38
38
 
39
+ Patch queue lite:
40
+ - status: pending / applied / verified / reverted / blocked
41
+ - lane_id:
42
+ - depends_on:
43
+ - assigned_scope:
44
+ - changed_files:
45
+ - verification_hint:
46
+ - rollback_hint:
47
+ - truth_status:
48
+ - next_action:
49
+ - --out optional persistence path:
50
+
39
51
  Rollback hint:
40
52
  - touched_files:
41
53
  - generated_files:
@@ -13,8 +13,11 @@
13
13
  - Command:
14
14
  - PID/session/pane:
15
15
  - Port:
16
- - Started:
17
- - Stopped:
16
+ - URL:
17
+ - Screenshot id:
18
+ - Started at:
19
+ - Stopped at:
20
+ - Exit code:
18
21
  - Exit/closure verified:
19
22
 
20
23
  ## tmux
@@ -32,6 +35,42 @@
32
35
  - During:
33
36
  - After:
34
37
 
38
+ ## Runtime Evidence Mini
39
+
40
+ ```json
41
+ {
42
+ "kind": "runtime_evidence_mini",
43
+ "route": "deep",
44
+ "required": true,
45
+ "command": "",
46
+ "target": "",
47
+ "pid": "unknown",
48
+ "port": "",
49
+ "url": "",
50
+ "exit_code": null,
51
+ "screenshot_id": "",
52
+ "started_at": "",
53
+ "stopped_at": "",
54
+ "process": {
55
+ "session": "",
56
+ "pane": ""
57
+ },
58
+ "observation": {
59
+ "before": "",
60
+ "after": ""
61
+ },
62
+ "cleanup": {
63
+ "status": "not-checked",
64
+ "evidence": ""
65
+ },
66
+ "truth_status": "partial",
67
+ "next_action": {
68
+ "kind": "",
69
+ "summary": ""
70
+ }
71
+ }
72
+ ```
73
+
35
74
  ## Verification
36
75
 
37
76
  - Command/check:
@@ -25,7 +25,17 @@ Use this to tune route wording from real use.
25
25
  - Seconds:
26
26
  - Budget result:
27
27
 
28
- ## Fix To Harness
28
+ ## Benchmark Optimization Loop Lite
29
+
30
+ - Baseline command: yam measure <route> --files --commands --report-lines --seconds
31
+ - Baseline result:
32
+ - One route wording or doc change:
33
+ - Rerun command:
34
+ - Rerun result:
35
+ - Decision: keep / revert / retry once / stop
36
+ - Stop condition:
37
+
38
+ ## Fix To yam
29
39
 
30
40
  - Skill to edit:
31
41
  - Proposed wording:
@@ -23,6 +23,8 @@
23
23
  | source_hash | unknown |
24
24
  | reference_id | |
25
25
  | screenshot_id | |
26
+ | viewport | |
27
+ | state | |
26
28
  | local_only | true / false |
27
29
  | redacted | true / false |
28
30
  | operator_provided | true / false |
@@ -56,6 +58,26 @@ Use `matched`, `similar`, `different`, `not-verified`, or `not-applicable`.
56
58
  | Accessibility visuals | not-verified | | |
57
59
  | Brand and mood fit | not-verified | | |
58
60
 
61
+ ## Review Continuity
62
+
63
+ | Field | Value |
64
+ | --- | --- |
65
+ | previous_report_id/path | |
66
+ | previous_screenshot_id | |
67
+ | previous_source_hash | unknown |
68
+ | current_report_id/path | |
69
+ | current_screenshot_id | |
70
+ | current_source_hash | unknown |
71
+ | viewport | |
72
+ | state | |
73
+ | changed_surface | |
74
+ | continuity_result | improved / regressed / unchanged / not-verified |
75
+ | regression | true / false / not-verified |
76
+ | resolved_findings | |
77
+ | new_findings | |
78
+ | still_open_findings | |
79
+ | next_action | |
80
+
59
81
  ## Design Quality Review
60
82
 
61
83
  Use `pass`, `needs-polish`, or `fails` for each relevant design dimension before listing actionable issues.
@@ -91,3 +113,25 @@ Use `pass`, `needs-polish`, or `fails` for each relevant design dimension before
91
113
  ## Truth Status
92
114
 
93
115
  - verified / partial / skipped / blocked / assumed:
116
+
117
+ ## Comparison Report JSON
118
+
119
+ ```json
120
+ {
121
+ "kind": "ueye_comparison_report",
122
+ "previous_report_id": "",
123
+ "previous_screenshot_id": "",
124
+ "current_report_id": "",
125
+ "current_screenshot_id": "",
126
+ "viewport": "",
127
+ "state": "",
128
+ "comparison_result": "not-verified",
129
+ "regression": "not-verified",
130
+ "resolved_findings": [],
131
+ "new_findings": [],
132
+ "still_open": [],
133
+ "design_quality": "needs-polish",
134
+ "truth_status": "partial",
135
+ "next_action": ""
136
+ }
137
+ ```
@@ -34,6 +34,8 @@
34
34
  | source_hash | unknown |
35
35
  | reference_id | |
36
36
  | screenshot_id | |
37
+ | viewport | |
38
+ | state | |
37
39
  | local_only | true / false |
38
40
  | redacted | true / false |
39
41
  | operator_provided | true / false |
@@ -67,6 +69,26 @@
67
69
 
68
70
  Status values: matched / similar / different / not-verified / not-applicable.
69
71
 
72
+ ## Review Continuity
73
+
74
+ | Field | Value |
75
+ | --- | --- |
76
+ | previous_report_id/path | |
77
+ | previous_screenshot_id | |
78
+ | previous_source_hash | unknown |
79
+ | current_report_id/path | |
80
+ | current_screenshot_id | |
81
+ | current_source_hash | unknown |
82
+ | viewport | |
83
+ | state | |
84
+ | changed_surface | |
85
+ | continuity_result | improved / regressed / unchanged / not-verified |
86
+ | regression | true / false / not-verified |
87
+ | resolved_findings | |
88
+ | new_findings | |
89
+ | still_open_findings | |
90
+ | next_action | |
91
+
70
92
  ## Design Quality Review
71
93
 
72
94
  | Dimension | Result | Evidence |
@@ -123,3 +145,25 @@ Result values: pass / needs-polish / fails.
123
145
  ## Truth Status
124
146
 
125
147
  - verified / partial / skipped / blocked / assumed:
148
+
149
+ ## Review Report JSON
150
+
151
+ ```json
152
+ {
153
+ "kind": "ueye_review_report",
154
+ "previous_report_id": "",
155
+ "previous_screenshot_id": "",
156
+ "current_report_id": "",
157
+ "current_screenshot_id": "",
158
+ "viewport": "",
159
+ "state": "",
160
+ "comparison_result": "not-verified",
161
+ "regression": "not-verified",
162
+ "resolved_findings": [],
163
+ "new_findings": [],
164
+ "still_open": [],
165
+ "design_quality": "needs-polish",
166
+ "truth_status": "partial",
167
+ "next_action": ""
168
+ }
169
+ ```
@@ -44,7 +44,7 @@
44
44
  - UI changes:
45
45
  - Feature changes:
46
46
  - Risky changes:
47
- - Public/release changes: scan for external harness/tool names, comparison wording, and origin-credit wording; remove those hits unless the user explicitly approves keeping them.
47
+ - Public/release changes: scan for external tool names, comparison wording, and attribution wording; remove those hits unless the user explicitly approves keeping them.
48
48
 
49
49
  ## Known Risks
50
50
 
@@ -62,7 +62,7 @@
62
62
 
63
63
  - Do not:
64
64
  - Avoid:
65
- - Do not leave external harness/tool/project comparison, attribution, or origin-credit language in public-facing source, docs, npm metadata, release notes, or GitHub repository text.
65
+ - Do not leave external tool/project comparison or attribution language in public-facing source, docs, npm metadata, release notes, or GitHub repository text.
66
66
 
67
67
  ## MD Management
68
68