Unify dispatch and add supervisor routing signals

This commit is contained in:
dahyeon committed 2026-05-18 18:42:35 -07:00
1 parent f0b00e5fd2
commit b63985694a
19 files changed
+1345 -812

No files matched your search

+34 -24
View File
@@ -25,31 +25,41 @@ describe("operations review CLI formatters", () => {
it("formats packet details for show output", () => {
expect(
formatReviewShow({
chatroomId: "room-1",
id: "1-0",
packet: {
constraints: [],
currentState: {},
evidence: [
{
id: "e1",
kind: "message",
summary: "unclear message",
},
],
expectedOutputSchema: "text",
handoffReason: "low-confidence",
sourceChain: ["onboarding", "supervisor"],
summary: "needs review",
userGoal: "의도 확인",
formatReviewShow(
{
chatroomId: "room-1",
id: "1-0",
packet: {
constraints: [],
currentState: {},
evidence: [
{
id: "e1",
kind: "message",
summary: "unclear message",
},
],
expectedOutputSchema: "text",
handoffReason: "low-confidence",
sourceChain: ["onboarding", "supervisor"],
summary: "needs review",
userGoal: "의도 확인",
},
queuedAt: "2026-05-18T00:00:00.000Z",
reason: "low-confidence",
requestId: "request-1",
target: "human-review",
userId: "user-1",
},
queuedAt: "2026-05-18T00:00:00.000Z",
reason: "low-confidence",
requestId: "request-1",
target: "human-review",
userId: "user-1",
}),
[
{
action: "manual-reply",
note: "handled",
resolvedAt: "2026-05-18T01:00:00.000Z",
resolvedBy: "operator@example.com",
},
],
),
).toContain("sourceChain: onboarding > supervisor");
});
+23 -3
View File
@@ -5,12 +5,14 @@ import { loadEnvironmentFromNodeEnv } from "@common/env-loader";
import { connectGarnetForCli } from "@common/garnet-cli";
import { initLogger } from "@obs/logger";
import {
getResolutionHistory,
getSupervisorReview,
getSupervisorReviewStats,
listSupervisorReview,
resolveSupervisorReview,
type SupervisorReviewAction,
type SupervisorReviewItem,
type SupervisorReviewResolution,
type SupervisorReviewStats,
} from "@skills/supervisor/review-queue";
import {
@@ -95,12 +97,24 @@ export function formatReviewList(items: SupervisorReviewItem[]): string {
return rows.map((row) => row.join("\t")).join("\n");
}
export function formatReviewShow(item: SupervisorReviewItem): string {
export function formatReviewShow(
item: SupervisorReviewItem,
history?: SupervisorReviewResolution[],
): string {
const packet = item.packet;
const evidence =
packet?.evidence
.map((entry) => `${entry.id}:${entry.kind}:${entry.summary}`)
.join("\n") || "-";
const historyLines =
history?.map((resolution) =>
[
`${resolution.resolvedAt} ${resolution.action} by ${resolution.resolvedBy}`,
resolution.note ? `note=${resolution.note}` : null,
]
.filter((value): value is string => Boolean(value))
.join(" "),
) ?? [];
return [
`id: ${item.id}`,
@@ -124,6 +138,9 @@ export function formatReviewShow(item: SupervisorReviewItem): string {
`note: ${stringifyOptional(item.resolution.note)}`,
].join("\n")
: "[resolution]\n-",
...(history
? ["[history]", ...(historyLines.length > 0 ? historyLines : ["-"])]
: []),
].join("\n");
}
@@ -191,10 +208,13 @@ async function handleReviewShow(
console.error(`[review] entry not found: ${id}`);
return;
}
const history = hasFlag(flags, "history")
? await getResolutionHistory(connection.garnetClient, id)
: undefined;
console.info(
hasFlag(flags, "json")
? JSON.stringify(item, null, 2)
: formatReviewShow(item),
? JSON.stringify({ ...item, ...(history ? { history } : {}) }, null, 2)
: formatReviewShow(item, history),
);
} finally {
await connection.close();