intentdna 1.5.20 → 1.6.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.
@@ -239,28 +239,29 @@ roles:
239
239
  - "DO NOT run tests. DO NOT edit app code. Analysis only."
240
240
 
241
241
  analysis_reviewer:
242
- description: "Reviews analyzer output quality. Read-only."
242
+ description: "Reviews analyzer output quality and writes durable diagnosis review verdict."
243
243
  tool_permissions:
244
- allow: [Read, Grep, Glob]
245
- deny: [Bash, Edit, Write, NotebookEdit]
244
+ allow: [Read, Grep, Glob, Write]
245
+ deny: [Bash, Edit, NotebookEdit]
246
246
  scope:
247
247
  read: ["**/*"]
248
- write: []
248
+ write: [".dna/specs/diagnosis-*.review.json"]
249
249
  instructions:
250
250
  - "REQUIRED FIRST: Read all context files listed in SKILL.md"
251
251
  - "Verify analyzer spec: v1 references exist? Classifications sound?"
252
252
  - "Check missing: any failing test not covered?"
253
253
  - "Verify diagnosis remains evidence-only: no fix prescriptions, implementation order, call-site instructions, or Notes for Surgeon"
254
- - "Output a structured verdict block with verdict, artifact_reviewed, sections_to_fix, evidence_paths, confidence, and summary"
254
+ - "Output a structured verdict block with verdict, artifact_reviewed, sections_to_fix, evidence_paths, confidence, summary, and updated_at"
255
+ - "Write the same structured verdict JSON to .dna/specs/diagnosis-$ARGUMENTS.review.json before finishing"
255
256
 
256
257
  fix_reviewer:
257
- description: "Reviews surgeon changes against approved diagnosis, v1 evidence, and v2 architecture. Read-only."
258
+ description: "Reviews surgeon changes against approved diagnosis, v1 evidence, and v2 architecture. Writes only the structured review verdict artifact."
258
259
  tool_permissions:
259
- allow: [Read, Grep, Glob, Bash]
260
- deny: [Edit, Write, NotebookEdit]
260
+ allow: [Read, Grep, Glob, Bash, Write]
261
+ deny: [Edit, NotebookEdit]
261
262
  scope:
262
263
  read: ["**/*"]
263
- write: []
264
+ write: [".dna/reviews/**"]
264
265
  instructions:
265
266
  - "Read diagnosis spec, behavior doc, and git diff before judging"
266
267
  - "Verify changes are minimal and limited to the approved diagnosis classifications"
@@ -283,6 +284,26 @@ roles:
283
284
  - "Classify red tests by type (compile/logic/widget/hung)"
284
285
  - "Output progress delta, not test content"
285
286
 
287
+ controllers:
288
+ fix-loop:
289
+ name: Fix Loop
290
+ description: "Run diagnosis once if needed, then loop fix/review/verify until PASS or stop condition"
291
+ kind: flutter_rewrite_fix_loop
292
+ max_rounds: 10
293
+ progress_artifact_path: ".dna/fix-progress/$ARGUMENTS.json"
294
+ diagnosis_workflow: diagnosis
295
+ fix_workflow: fix
296
+ diagnosis_artifact_path: ".dna/specs/diagnosis-$ARGUMENTS.md"
297
+ diagnosis_review_artifact_path: ".dna/specs/diagnosis-$ARGUMENTS.review.json"
298
+ review_artifact_path: ".dna/reviews/$ARGUMENTS-review.json"
299
+ roles:
300
+ analyzer: analyzer
301
+ analysis_reviewer: analysis_reviewer
302
+ surgeon: surgeon
303
+ fix_reviewer: fix_reviewer
304
+ test_runner: test_runner
305
+ stop_format: zh_three_part
306
+
286
307
  workflows:
287
308
  behavior-lock:
288
309
  name: Behavior Lock
@@ -411,10 +432,13 @@ workflows:
411
432
  "sections_to_fix": ["section ids or titles; empty when approved"],
412
433
  "evidence_paths": ["paths that justify the verdict"],
413
434
  "confidence": "high" | "medium" | "low",
414
- "summary": "brief reason"
435
+ "summary": "brief reason",
436
+ "updated_at": "ISO-8601 timestamp"
415
437
  }
416
438
  ```
417
439
 
440
+ Write the same verdict JSON to .dna/specs/diagnosis-$ARGUMENTS.review.json before finishing.
441
+
418
442
  APPROVE → diagnosis complete.
419
443
  REQUEST_REANALYSIS → sections_to_fix must be passed back to analyze. docs/behavior/blocked_items.md is historical context only and must not be treated as the current run verdict.
420
444
  handoff:
@@ -423,7 +447,11 @@ workflows:
423
447
  path: ".dna/specs/diagnosis-$ARGUMENTS.md"
424
448
  description: "Diagnosis spec from analyzer"
425
449
  produces:
450
+ - type: file
451
+ path: ".dna/specs/diagnosis-$ARGUMENTS.review.json"
452
+ description: "Durable diagnosis review verdict (APPROVE or REQUEST_REANALYSIS)"
426
453
  - type: summary
454
+ required: false
427
455
  description: "Review verdict (APPROVE or REQUEST_REANALYSIS)"
428
456
 
429
457
  fix:
@@ -474,9 +502,9 @@ workflows:
474
502
  depends_on: [fix_bugs]
475
503
  description: "Review surgeon changes before verification"
476
504
  prompt: |
477
- Read diagnosis spec, behavior doc, and git diff.
505
+ Read diagnosis spec and behavior doc before reviewing the surgeon's handoff changes.
478
506
 
479
- Review only the surgeon's changes:
507
+ Review only the surgeon's handoff changes:
480
508
  1. Are changes limited to BUG / UNIMPLEMENTED / INFRA / TEST_BUG items in the approved diagnosis?
481
509
  2. Is REMOVED handling absent unless explicitly approved by user?
482
510
  3. Does implementation preserve v1 behavior and follow v2 architecture?
@@ -487,14 +515,26 @@ workflows:
487
515
  ```json
488
516
  {
489
517
  "verdict": "APPROVE" | "REQUEST_CHANGES",
518
+ "module": "$ARGUMENTS",
519
+ "round": 1,
520
+ "run_id": "controller run id or manual-run",
490
521
  "issues": ["specific issue with evidence path; empty when approved"],
491
522
  "evidence_paths": ["paths that justify the verdict"],
492
523
  "failure_reason": "why changes need another round; empty when approved",
493
524
  "next_round_focus": "specific priority/classification/test file for the next fix invocation; empty when approved",
494
- "summary": "brief reason"
525
+ "summary": "brief reason",
526
+ "updated_at": "ISO-8601 timestamp"
495
527
  }
496
528
  ```
497
529
 
530
+ Write the same verdict JSON to .dna/reviews/$ARGUMENTS-review.json before finishing.
531
+
532
+ JSON field rules:
533
+ - module is required and must equal $ARGUMENTS.
534
+ - round is required and must be the provided current_round, or 1 for manual fix invocation.
535
+ - run_id is required and must equal the provided controller_run_id, or "manual-run" for manual fix invocation.
536
+ - updated_at is a required ISO timestamp string.
537
+
498
538
  REQUEST_CHANGES → include failure_reason and concrete next_round_focus for the next fix invocation. The next_round_focus must name the priority/classification and specific test file or evidence path to address first.
499
539
  handoff:
500
540
  consumes:
@@ -508,7 +548,8 @@ workflows:
508
548
  path: "docs/behavior/$ARGUMENTS.md"
509
549
  description: "Behavior document"
510
550
  produces:
511
- - type: summary
551
+ - type: file
552
+ path: ".dna/reviews/$ARGUMENTS-review.json"
512
553
  description: "Review verdict (APPROVE or REQUEST_CHANGES)"
513
554
 
514
555
  - id: verify_report
@@ -522,37 +563,101 @@ workflows:
522
563
 
523
564
  If the review verdict is APPROVE:
524
565
  - Run full module test suite for $ARGUMENTS.
566
+ - Read diagnosis classification summary.
567
+ - Read current test summary.
525
568
  - Compare with diagnosis spec baseline.
569
+ - Compare skipped tests against remaining UNIMPLEMENTED diagnosis items.
570
+
571
+ Hard PASS rules:
572
+ - 0 failed is not sufficient for PASS.
573
+ - PASS is forbidden if any approved diagnosis UNIMPLEMENTED item remains skipped.
574
+ - Diagnosis-backed UNIMPLEMENTED skipped tests count as Remaining, not Blocked.
575
+ - UNIMPLEMENTED skipped tests count as Remaining.
576
+ - Before writing Module complete: yes, read diagnosis classification summary, read current test summary, compare skipped tests against remaining UNIMPLEMENTED diagnosis items, and if any UNIMPLEMENTED skipped remains, Module complete must be no.
577
+
578
+ Verdict mapping:
579
+ - review REQUEST_CHANGES -> Verdict: BLOCKED, Failure reason: BLOCKED_BY_REVIEW.
580
+ - 0 failed + remaining UNIMPLEMENTED skipped > 0 -> Verdict: CONTINUE, Module complete: no, Next Round Focus: next diagnosis-backed UNIMPLEMENTED test/evidence path.
581
+ - progress contradicts diagnosis/test evidence -> Verdict: BLOCKED, Failure reason: PROGRESS_DIAGNOSIS_CONFLICT.
582
+ - new red caused by current round -> Verdict: REQUEST_CHANGES.
583
+ - new red appears to be newly exposed baseline gap AND remaining count decreases -> Verdict: CONTINUE.
584
+ - ambiguous new red -> Verdict: BLOCKED, Failure reason: AMBIGUOUS_NEW_RED.
585
+ - 0 failed + no remaining diagnosis-backed UNIMPLEMENTED skipped + no unresolved actionable BUG / UNIMPLEMENTED items + only TEST_BUG / INFRA / REMOVED / explicitly user-approved blocked items remain -> Verdict: PASS.
526
586
 
527
587
  Output report:
528
588
  - Verdict: PASS / CONTINUE / REQUEST_CHANGES / BLOCKED
529
589
  - Review: APPROVE / REQUEST_CHANGES
590
+ - Module complete: yes/no
530
591
  - Fixed: N tests now green
531
592
  - New red: M tests that regressed
532
- - Blocked: K tests skipped (see blocked_items.md)
533
- - Remaining: R tests still failing
593
+ - Blocked: K tests skipped for TEST_BUG / INFRA / REMOVED / user-approved blocked reasons
594
+ - Remaining: R tests still failing or diagnosis-backed UNIMPLEMENTED skipped
595
+ - Remaining UNIMPLEMENTED skipped: U diagnosis-backed skipped tests still remaining
534
596
  - Failure reason: why progress stopped, if any
535
597
  - Next round focus: the priority/classification/test file to continue with, if verdict is CONTINUE or REQUEST_CHANGES
536
598
 
537
599
  Always write or update .dna/fix-progress/$ARGUMENTS.md before finishing, even when review blocks verification. Include these sections:
538
- - Current verdict: Verdict, Review, Last fix commit, Updated at
539
- - Round summary: Fixed, New red, Blocked, Remaining, Failure reason
600
+ - Current verdict: Verdict, Review, Module complete, Last fix commit, Updated at
601
+ - Round summary: Fixed, New red, Blocked, Remaining, Remaining UNIMPLEMENTED skipped, Failure reason
540
602
  - Next Round Focus: non-empty when Verdict is CONTINUE or REQUEST_CHANGES
541
603
  - Review Issues To Address First: reviewer issues when Review is REQUEST_CHANGES
542
604
  - Failed approaches / Do not repeat: approaches that failed or caused regressions
543
605
  - Evidence: commands run and relevant paths
544
606
 
545
- If Verdict is PASS, mark the module complete in .dna/fix-progress/$ARGUMENTS.md.
607
+ Always write or update .dna/fix-progress/$ARGUMENTS.json before finishing, even when review blocks verification. The JSON must match this contract exactly:
608
+ ```json
609
+ {
610
+ "verdict": "PASS | CONTINUE | REQUEST_CHANGES | BLOCKED",
611
+ "review": "APPROVE | REQUEST_CHANGES",
612
+ "module": "$ARGUMENTS",
613
+ "round": 1,
614
+ "run_id": "controller run id or manual-run",
615
+ "diagnosis_artifact": ".dna/specs/diagnosis-$ARGUMENTS.md",
616
+ "review_artifact": ".dna/reviews/$ARGUMENTS-review.json",
617
+ "git_head": null,
618
+ "module_complete": false,
619
+ "fixed_count": 0,
620
+ "new_red_count": 0,
621
+ "blocked_count": 0,
622
+ "remaining_count": 0,
623
+ "remaining_unimplemented_skipped_count": 0,
624
+ "next_round_focus": "",
625
+ "failure_reason": "",
626
+ "last_fix_commit": null,
627
+ "evidence_paths": [],
628
+ "updated_at": "ISO-8601 timestamp"
629
+ }
630
+ ```
631
+
632
+ JSON field rules:
633
+ - module is required and must equal $ARGUMENTS.
634
+ - round is required and must be the current fix-loop round number, or 1 for manual fix invocation.
635
+ - run_id is required and must identify the current controller run, or "manual-run" for manual fix invocation.
636
+ - diagnosis_artifact is required and must equal .dna/specs/diagnosis-$ARGUMENTS.md.
637
+ - review_artifact is required and must equal .dna/reviews/$ARGUMENTS-review.json.
638
+ - git_head is the current git HEAD after verification if available, otherwise null.
639
+ - verdict is required and must be PASS, CONTINUE, REQUEST_CHANGES, or BLOCKED.
640
+ - review is required and must be APPROVE or REQUEST_CHANGES.
641
+ - module_complete is a required boolean and must match the Markdown Module complete value.
642
+ - fixed_count, new_red_count, blocked_count, remaining_count, and remaining_unimplemented_skipped_count are required non-negative integers.
643
+ - next_round_focus is required and non-empty when verdict is CONTINUE or REQUEST_CHANGES; empty string is allowed when verdict is PASS.
644
+ - failure_reason is required and non-empty when verdict is BLOCKED or REQUEST_CHANGES; empty string is allowed when verdict is PASS or CONTINUE.
645
+ - last_fix_commit is the commit hash string if available, otherwise null.
646
+ - evidence_paths is a required array of command/test/diagnosis/review evidence paths.
647
+ - updated_at is a required ISO timestamp string.
648
+
649
+ If Verdict is PASS, mark Module complete: yes in .dna/fix-progress/$ARGUMENTS.md and set module_complete true in .dna/fix-progress/$ARGUMENTS.json.
546
650
 
547
651
  Verdict meanings:
548
- - PASS: all approved diagnosis items are fixed or intentionally skipped
652
+ - PASS: all actionable BUG / UNIMPLEMENTED items are fixed, with no diagnosis-backed UNIMPLEMENTED skipped tests remaining; only TEST_BUG / INFRA / REMOVED / explicitly user-approved blocked items may remain
549
653
  - CONTINUE: this round made progress and remaining approved items should continue in the next fix invocation
550
- - REQUEST_CHANGES: review or verification found issues in this round's changes
551
- - BLOCKED: user confirmation is needed or repeated no-progress prevents safe continuation
654
+ - REQUEST_CHANGES: verification found issues in this round's changes
655
+ - BLOCKED: review blocks verification, user confirmation is needed, evidence conflicts, or repeated no-progress prevents safe continuation
552
656
  handoff:
553
657
  consumes:
554
- - type: summary
658
+ - type: file
555
659
  from: review_changes
660
+ path: ".dna/reviews/$ARGUMENTS-review.json"
556
661
  description: "Review verdict from fix_reviewer"
557
662
  - type: git_commit
558
663
  from: fix_bugs
@@ -564,5 +669,9 @@ workflows:
564
669
  - type: file
565
670
  path: ".dna/fix-progress/$ARGUMENTS.md"
566
671
  description: "Durable cumulative fix-progress artifact for the next fix invocation"
672
+ - type: file
673
+ path: ".dna/fix-progress/$ARGUMENTS.json"
674
+ description: "Machine-readable fix-progress verdict sidecar for controllers"
567
675
  - type: summary
676
+ required: false
568
677
  description: "Verification report with test delta"
@@ -142,6 +142,7 @@ workflow:
142
142
  description: "Implementation to test"
143
143
  produces:
144
144
  - type: test_result
145
+ name: test_results
145
146
  description: "Test results after fixes"
146
147
  - id: review
147
148
  role: reviewer
@@ -151,9 +152,11 @@ workflow:
151
152
  consumes:
152
153
  - type: test_result
153
154
  from: test
155
+ name: test_results
154
156
  description: "Test results to review"
155
157
  produces:
156
158
  - type: summary
159
+ required: false
157
160
  description: "Review verdict (PASS/FAIL)"
158
161
  transitions:
159
162
  - from: review
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "intentdna",
3
- "version": "1.5.20",
3
+ "version": "1.6.0",
4
4
  "description": "Intent DNA — Declarative policy layer for AI agent behavior",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -239,6 +239,8 @@ output_schema:
239
239
 
240
240
  Workflows define multi-step agent pipelines with dependency ordering, parallel execution, retry, and artifact handoff.
241
241
 
242
+ Handoff artifacts compile into local session-scoped manifests. A required artifact must have a stable identity from `path`, `name`, or `artifact_id`; required `summary`/`state` artifacts without one are invalid. Runtime enforcement treats the manifest as the local fact source and uses workflow inputs such as `$ARGUMENTS` before resolving artifact keys. User-provided workflow `inputs` used in artifact path templates are constrained to safe single path components; trusted `resolved_variables` may still provide configured path prefixes. This blocks prompt/path/metadata-only satisfaction; cryptographic protection against direct manifest forgery is deferred to signing/registry work.
243
+
242
244
  ### Single Workflow
243
245
  ```yaml
244
246
  workflow:
@@ -266,6 +268,7 @@ workflow:
266
268
  description: "Implementation to review"
267
269
  produces:
268
270
  - type: summary
271
+ required: false
269
272
  description: "Review verdict"
270
273
 
271
274
  transitions: