@llm4ts/flow 2.51.0 → 2.53.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.
Files changed (63) hide show
  1. package/dist/Approval.d.ts +1 -1
  2. package/dist/Approval.d.ts.map +1 -1
  3. package/dist/Artifacts.d.ts +2 -2
  4. package/dist/Artifacts.d.ts.map +1 -1
  5. package/dist/BenchReport.d.ts +2 -2
  6. package/dist/BenchReport.d.ts.map +1 -1
  7. package/dist/CostLedger.d.ts +2 -2
  8. package/dist/CostLedger.d.ts.map +1 -1
  9. package/dist/Equiv.d.ts +3 -3
  10. package/dist/Equiv.d.ts.map +1 -1
  11. package/dist/Flow.d.ts +1 -1
  12. package/dist/Flow.d.ts.map +1 -1
  13. package/dist/FlowError.d.ts +33 -1
  14. package/dist/FlowError.d.ts.map +1 -1
  15. package/dist/FlowError.js +43 -1
  16. package/dist/FlowError.js.map +1 -1
  17. package/dist/FlowEvents.d.ts +23 -1
  18. package/dist/FlowEvents.d.ts.map +1 -1
  19. package/dist/FlowEvents.js +28 -0
  20. package/dist/FlowEvents.js.map +1 -1
  21. package/dist/Gates.d.ts +1 -1
  22. package/dist/Gates.d.ts.map +1 -1
  23. package/dist/GraphCache.d.ts +1 -1
  24. package/dist/GraphCache.d.ts.map +1 -1
  25. package/dist/Judgment.d.ts +2 -2
  26. package/dist/Judgment.d.ts.map +1 -1
  27. package/dist/Landing.d.ts +1 -1
  28. package/dist/Landing.d.ts.map +1 -1
  29. package/dist/NodePreflight.d.ts +1 -1
  30. package/dist/NodePreflight.d.ts.map +1 -1
  31. package/dist/Persistence.d.ts +2 -2
  32. package/dist/Persistence.d.ts.map +1 -1
  33. package/dist/PlanExecution.d.ts +2 -2
  34. package/dist/PlanExecution.d.ts.map +1 -1
  35. package/dist/ProgramJudge.d.ts +1 -1
  36. package/dist/ProgramJudge.d.ts.map +1 -1
  37. package/dist/Replay.d.ts +2 -2
  38. package/dist/Replay.d.ts.map +1 -1
  39. package/dist/Retro.d.ts +3 -3
  40. package/dist/Retro.d.ts.map +1 -1
  41. package/dist/Review.d.ts +5 -5
  42. package/dist/Review.d.ts.map +1 -1
  43. package/dist/ReviewCache.d.ts +1 -1
  44. package/dist/ReviewCache.d.ts.map +1 -1
  45. package/dist/Roster.d.ts +1 -1
  46. package/dist/Roster.d.ts.map +1 -1
  47. package/dist/RosterSeats.d.ts +1 -1
  48. package/dist/RosterSeats.d.ts.map +1 -1
  49. package/dist/Roundtable.d.ts +251 -0
  50. package/dist/Roundtable.d.ts.map +1 -0
  51. package/dist/Roundtable.js +845 -0
  52. package/dist/Roundtable.js.map +1 -0
  53. package/dist/Stories.d.ts +27 -3
  54. package/dist/Stories.d.ts.map +1 -1
  55. package/dist/Stories.js +19 -3
  56. package/dist/Stories.js.map +1 -1
  57. package/dist/WorkQueue.d.ts +1 -1
  58. package/dist/WorkQueue.d.ts.map +1 -1
  59. package/package.json +3 -2
  60. package/src/FlowError.ts +47 -1
  61. package/src/FlowEvents.ts +30 -0
  62. package/src/Roundtable.ts +1107 -0
  63. package/src/Stories.ts +42 -4
package/src/Stories.ts CHANGED
@@ -119,8 +119,18 @@ const join = (root: string, path: string): string =>
119
119
 
120
120
  /** A flow context rooted in a story's worktree, plus that story's own usage totals. */
121
121
  /** A story judge's review with the rubric's scores; a plain `ReviewResult` has none. */
122
+ /** A dimension below the bar the story was not held to, with the judge's reasoning (ADR 0045). */
123
+ export const ExcusedDimension = Schema.Struct({
124
+ id: Schema.String,
125
+ score: Schema.Number,
126
+ max: Schema.Number,
127
+ reasoning: Schema.String
128
+ })
129
+ export type ExcusedDimension = typeof ExcusedDimension.Type
130
+
122
131
  export class StoryVerdict extends ReviewResult.extend<StoryVerdict>("StoryVerdict")({
123
- dimensions: Schema.Array(JudgedDimension)
132
+ dimensions: Schema.Array(JudgedDimension),
133
+ excused: Schema.optionalKey(Schema.Array(ExcusedDimension))
124
134
  }) {}
125
135
 
126
136
  /** What a judge answers: a scored verdict, or a plain review result. */
@@ -820,6 +830,12 @@ export interface StoriesOptions {
820
830
  * for a follow-up round. Default false: every finding is fixed or fails.
821
831
  */
822
832
  readonly deferNonBlocking?: boolean
833
+ /**
834
+ * Names the bar the judge holds stories to when it is not the default
835
+ * (`defer-tests`, ADR 0045). It enters the judge's cache fingerprint, so a
836
+ * verdict judged under one bar is never reused under another.
837
+ */
838
+ readonly judgeBar?: string
823
839
  /**
824
840
  * Second opinion on a BLOCKED_ON claim the plan cannot settle (a path no
825
841
  * story owns, or a parallel story's). `real: false` sends the coder back
@@ -872,6 +888,27 @@ export const deferredPath = (stateDir: string, storyId: string): string =>
872
888
  export const reviewStatePath = (stateDir: string, storyId: string): string =>
873
889
  join(stateDir, `stories/${storyId}.review-state.json`)
874
890
 
891
+ /** Where a story's last judge verdict is kept, beside a fingerprint of what it judged. */
892
+ export const judgeVerdictPath = (stateDir: string, storyId: string): string =>
893
+ join(stateDir, `stories/${storyId}.judge.json`)
894
+
895
+ /** A story's last judge verdict, when it was a scored one (ADR 0045: what the debt reads). */
896
+ export const lastStoryVerdict = (
897
+ files: PlainFileStoreShape,
898
+ stateDir: string,
899
+ storyId: string
900
+ ): Effect.Effect<StoryVerdict | undefined> =>
901
+ files.read(judgeVerdictPath(stateDir, storyId)).pipe(
902
+ Effect.flatMap((text) =>
903
+ text === undefined
904
+ ? Effect.succeed(undefined)
905
+ : Schema.decodeUnknownEffect(
906
+ Schema.fromJsonString(Schema.Struct({ result: StoryVerdict }))
907
+ )(text).pipe(Effect.map((entry) => entry.result))
908
+ ),
909
+ Effect.catch(() => Effect.succeed(undefined))
910
+ )
911
+
875
912
  /** A deferred finding as one Markdown bullet, prefixed with where it was found. */
876
913
  export const deferredLine = (source: string, issue: ReviewIssue): string => {
877
914
  const where =
@@ -974,8 +1011,7 @@ export const implementStoriesFlow = Effect.fn("@llm4ts/flow/Stories.implement")(
974
1011
  const statePath = (story: Story): string => join(options.stateDir, `stories/${story.id}.json`)
975
1012
  const planPath = (story: Story): string => join(options.stateDir, `stories/${story.id}.plan.md`)
976
1013
  /** The judge's last verdict beside a fingerprint of what it judged. */
977
- const judgePath = (story: Story): string =>
978
- join(options.stateDir, `stories/${story.id}.judge.json`)
1014
+ const judgePath = (story: Story): string => judgeVerdictPath(options.stateDir, story.id)
979
1015
  /** One file per review lens, beside a fingerprint of the task and diff. */
980
1016
  const reviewCacheDir = (story: Story): string =>
981
1017
  join(options.stateDir, `stories/${story.id}.review`)
@@ -2073,7 +2109,9 @@ export const implementStoriesFlow = Effect.fn("@llm4ts/flow/Stories.implement")(
2073
2109
  story.id,
2074
2110
  story.title,
2075
2111
  story.description,
2076
- story.provides.join("\n")
2112
+ story.provides.join("\n"),
2113
+ // Absent for the default bar: verdicts stored before 2.52 stay valid.
2114
+ ...(options.judgeBar === undefined ? [] : [options.judgeBar])
2077
2115
  ]),
2078
2116
  withTimedRole(
2079
2117
  "judge",