diff --git a/mateclaw-server/src/main/java/vip/mate/wiki/dto/GeneratedPage.java b/mateclaw-server/src/main/java/vip/mate/wiki/dto/GeneratedPage.java new file mode 100644 index 00000000..87c6693f --- /dev/null +++ b/mateclaw-server/src/main/java/vip/mate/wiki/dto/GeneratedPage.java @@ -0,0 +1,28 @@ +package vip.mate.wiki.dto; + +import java.util.List; + +/** + * RFC-051 PR-6 (skeleton): structured create/merge output. + *

+ * Replaces the legacy {@code ---FILE---} block protocol used by + * {@code WikiBatchCreateParser}. {@code evidenceChunkIds} is optional and + * intended for the on-demand compile path so per-page citations bind to + * the chunks the prompt actually consumed. + *

+ * Fields are ordered to mirror the existing prompt template so the + * follow-up Spring-AI {@code BeanOutputConverter} swap is a one-shot + * replace of the parser, not a prompt rewrite. + */ +public record GeneratedPage( + String slug, + String title, + String summary, + String pageType, + String content, + List evidenceChunkIds +) { + public GeneratedPage { + if (evidenceChunkIds == null) evidenceChunkIds = List.of(); + } +} diff --git a/mateclaw-server/src/main/java/vip/mate/wiki/dto/RouteResult.java b/mateclaw-server/src/main/java/vip/mate/wiki/dto/RouteResult.java new file mode 100644 index 00000000..f5c0cbfd --- /dev/null +++ b/mateclaw-server/src/main/java/vip/mate/wiki/dto/RouteResult.java @@ -0,0 +1,30 @@ +package vip.mate.wiki.dto; + +import java.util.List; + +/** + * RFC-051 PR-6 (skeleton): structured route-phase output. + *

+ * Today {@code processChunkTwoPhase} parses the route LLM's free-form JSON + * with a hand-rolled extractor, which fails on weak models that emit + * trailing commentary or mismatched braces. The follow-up wiring will use + * Spring AI {@code BeanOutputConverter} so the prompt and the + * parser share one schema. + *

+ * Defining the type up-front (PR-6 partial) lets the prompt rewrite, parser + * swap, and call-site change land in one cohesive PR without renames. + * + * @param create new pages the router proposes (slug + title + summary) + * @param update slugs of existing pages that should absorb this chunk + */ +public record RouteResult(List create, List update) { + + public RouteResult { + if (create == null) create = List.of(); + if (update == null) update = List.of(); + } + + public boolean isEmpty() { + return create.isEmpty() && update.isEmpty(); + } +} diff --git a/mateclaw-server/src/main/java/vip/mate/wiki/dto/RoutedPageMeta.java b/mateclaw-server/src/main/java/vip/mate/wiki/dto/RoutedPageMeta.java new file mode 100644 index 00000000..09f4c7fc --- /dev/null +++ b/mateclaw-server/src/main/java/vip/mate/wiki/dto/RoutedPageMeta.java @@ -0,0 +1,14 @@ +package vip.mate.wiki.dto; + +/** + * RFC-051 PR-6 (skeleton): one entry of {@link RouteResult#create()}. + *

+ * {@code purposeHint} is optional; when populated by the router it feeds + * the create-page prompt's framing. + */ +public record RoutedPageMeta(String slug, String title, String summary, String purposeHint) { + + public RoutedPageMeta(String slug, String title, String summary) { + this(slug, title, summary, null); + } +}