Implement RPC contract validation baseline
This commit is contained in:
@@ -85,6 +85,15 @@ export const MemoSectionReviewSchema = z.object({
|
||||
});
|
||||
export type MemoSectionReview = z.infer<typeof MemoSectionReviewSchema>;
|
||||
|
||||
export const MemoSchema = z.object({
|
||||
status: z.enum(["draft", "review", "final"]),
|
||||
sections: z.array(MemoSectionSchema),
|
||||
citations: z.array(MemoCitationSchema),
|
||||
annotations: z.array(MemoAnnotationSchema),
|
||||
sectionReviews: z.array(MemoSectionReviewSchema)
|
||||
});
|
||||
export type Memo = z.infer<typeof MemoSchema>;
|
||||
|
||||
export const CatalystSchema = z.object({
|
||||
id: z.string(),
|
||||
date: z.string(),
|
||||
@@ -174,19 +183,9 @@ export const SnapshotSchema = z.object({
|
||||
});
|
||||
export type Snapshot = z.infer<typeof SnapshotSchema>;
|
||||
|
||||
export type ClientSettings = {
|
||||
theme: "light" | "dark" | "system";
|
||||
density: "comfortable" | "compact" | "dense";
|
||||
sidebarWidth: number;
|
||||
navCollapsed: Record<string, boolean>;
|
||||
keybindings: Record<string, string>;
|
||||
};
|
||||
export type ClientSettings = z.infer<typeof import("./rpcSchemas.js").ClientSettingsSchema>;
|
||||
|
||||
export type ServerSettings = {
|
||||
agentConfigs: Record<string, unknown>;
|
||||
dataSources: Record<string, boolean>;
|
||||
exportPipelines: Record<string, unknown>;
|
||||
};
|
||||
export type ServerSettings = z.infer<typeof import("./rpcSchemas.js").ServerSettingsSchema>;
|
||||
|
||||
export type RpcRequestMap = {
|
||||
"portfolio.get": undefined;
|
||||
@@ -239,11 +238,13 @@ export type RpcRequestMap = {
|
||||
"agent.configure": { agentId: string; config: Record<string, unknown> };
|
||||
"agent.getTrace": { agentId: string; runId: string };
|
||||
"agent.runPipeline": { companyId: string; pipeline: string };
|
||||
"validation.run": { companyId: string; agentType?: "sv" | "qa" | "rt" | "all" };
|
||||
"validation.getStatus": { companyId: string; sectionId?: string };
|
||||
"export.list": { companyId?: string };
|
||||
"export.create": { type: string; companyId: string; options?: Record<string, unknown> };
|
||||
"export.create": { type: "pdf" | "excel" | "ppt"; companyId: string; options?: Record<string, unknown> };
|
||||
"export.download": { exportId: string };
|
||||
"settings.get": { scope: "client" | "server" };
|
||||
"settings.update": { scope: "client" | "server"; changes: Record<string, unknown> };
|
||||
"settings.update": import("./rpcSchemas.js").SettingsUpdatePayload;
|
||||
};
|
||||
|
||||
export type RpcResponseMap = {
|
||||
@@ -289,6 +290,12 @@ export type RpcResponseMap = {
|
||||
"agent.configure": { ok: boolean };
|
||||
"agent.getTrace": { steps: Array<{ step: number; label: string; detail: string }> };
|
||||
"agent.runPipeline": { runIds: string[] };
|
||||
"validation.run": {
|
||||
sourceVerification?: { passed: boolean; confidence: string; issues: Array<{ severity: string; message: string; suggestion?: string }>; notes: string; timestamp: string };
|
||||
modelQA?: { passed: boolean; confidence: string; issues: Array<{ severity: string; message: string; suggestion?: string }>; notes: string; timestamp: string };
|
||||
redTeam?: { passed: boolean; confidence: string; issues: Array<{ severity: string; message: string; suggestion?: string }>; notes: string; timestamp: string };
|
||||
};
|
||||
"validation.getStatus": { validationState: "verified" | "flagged" | "unverified" | "failed"; lastValidated?: string };
|
||||
"export.list": { exports: ExportRecord[] };
|
||||
"export.create": { exportId: string };
|
||||
"export.download": { data: ArrayBuffer };
|
||||
@@ -311,3 +318,114 @@ export type RpcResult<T extends RpcMethod> =
|
||||
export type RpcClient = {
|
||||
call<T extends RpcMethod>(method: T, payload: RpcRequestMap[T]): Promise<RpcResult<T>>;
|
||||
};
|
||||
|
||||
// ============== SSE Events ==============
|
||||
|
||||
export type ServerEventType =
|
||||
| "agent.progress"
|
||||
| "agent.completed"
|
||||
| "agent.failed"
|
||||
| "agent.started"
|
||||
| "agent.streaming"
|
||||
| "validation.updated"
|
||||
| "memo.updated"
|
||||
| "model.updated";
|
||||
|
||||
export type AgentProgressEvent = {
|
||||
type: "agent.progress";
|
||||
data: {
|
||||
runId: string;
|
||||
agentId: string;
|
||||
companyId: string;
|
||||
progress: number;
|
||||
action: string;
|
||||
timestamp: string;
|
||||
};
|
||||
};
|
||||
|
||||
export type AgentCompletedEvent = {
|
||||
type: "agent.completed";
|
||||
data: {
|
||||
runId: string;
|
||||
agentId: string;
|
||||
companyId: string;
|
||||
output: unknown;
|
||||
duration: number;
|
||||
timestamp: string;
|
||||
};
|
||||
};
|
||||
|
||||
export type AgentFailedEvent = {
|
||||
type: "agent.failed";
|
||||
data: {
|
||||
runId: string;
|
||||
agentId: string;
|
||||
companyId: string;
|
||||
error: string;
|
||||
timestamp: string;
|
||||
};
|
||||
};
|
||||
|
||||
export type AgentStartedEvent = {
|
||||
type: "agent.started";
|
||||
data: {
|
||||
runId: string;
|
||||
agentId: string;
|
||||
companyId: string;
|
||||
pipeline?: string;
|
||||
timestamp: string;
|
||||
};
|
||||
};
|
||||
|
||||
export type AgentStreamingEvent = {
|
||||
type: "agent.streaming";
|
||||
data: {
|
||||
runId: string;
|
||||
agentId: string;
|
||||
companyId: string;
|
||||
chunk: string;
|
||||
timestamp: string;
|
||||
};
|
||||
};
|
||||
|
||||
export type ValidationUpdatedEvent = {
|
||||
type: "validation.updated";
|
||||
data: {
|
||||
companyId: string;
|
||||
sectionId?: string;
|
||||
validationState: "verified" | "flagged" | "unverified" | "failed";
|
||||
agentId: string;
|
||||
notes?: string;
|
||||
timestamp: string;
|
||||
};
|
||||
};
|
||||
|
||||
export type MemoUpdatedEvent = {
|
||||
type: "memo.updated";
|
||||
data: {
|
||||
companyId: string;
|
||||
sectionId: string;
|
||||
content: string;
|
||||
updatedAt: string;
|
||||
};
|
||||
};
|
||||
|
||||
export type ModelUpdatedEvent = {
|
||||
type: "model.updated";
|
||||
data: {
|
||||
companyId: string;
|
||||
tab: string;
|
||||
cell?: { row: number; col: number };
|
||||
timestamp: string;
|
||||
};
|
||||
};
|
||||
|
||||
export type ServerEvent =
|
||||
| AgentProgressEvent
|
||||
| AgentCompletedEvent
|
||||
| AgentFailedEvent
|
||||
| AgentStartedEvent
|
||||
| AgentStreamingEvent
|
||||
| ValidationUpdatedEvent
|
||||
| MemoUpdatedEvent
|
||||
| ModelUpdatedEvent;
|
||||
|
||||
Reference in New Issue
Block a user