Unify referenced result validation

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
2026-05-21 12:58:16 +08:00
parent 4870e8a577
commit cb298f2099
8 changed files with 753 additions and 89 deletions
+14 -7
View File
@@ -4,7 +4,8 @@ import { z } from "zod";
import { type LearningOrchestrator } from "../learning/orchestrator.js";
import { logger } from "../logger.js";
import { MemoryStore } from "../memory/store.js";
import { type ResultReferenceStore } from "../results/store.js";
import { type ResultReferenceResolver } from "../results/resolver.js";
import { RESULT_REFERENCE_KIND } from "../results/store.js";
import { type OpencodeRuntimeAdapter } from "../runtime/opencode.js";
import { type ChatSessionBridge } from "../chat/sessionBridge.js";
import { toActorKey } from "../utils/fileStore.js";
@@ -40,7 +41,7 @@ export const buildChatRouter = (
runtime: OpencodeRuntimeAdapter,
memoryStore: MemoryStore,
learningOrchestrator: LearningOrchestrator,
resultReferenceStore: ResultReferenceStore,
resultReferenceResolver: ResultReferenceResolver,
) => {
const chatRouter = Router();
@@ -67,11 +68,17 @@ export const buildChatRouter = (
return;
}
const result = await resultReferenceStore.getFullAuthorized(renderRef, {
actorKey: toActorKey(userId),
clientSessionId,
projectId,
});
const result = await resultReferenceResolver.getFullAuthorized(
renderRef,
{
actorKey: toActorKey(userId),
clientSessionId,
projectId,
},
{
expectedKind: RESULT_REFERENCE_KIND.renderJunctionsPayload,
},
);
if (!result) {
res.status(404).json({ message: "render_ref not found" });