feat(engine): expose canonical replay sessions through native workers
This commit is contained in:
parent
417a7bd21e
commit
e3635f23cf
26 changed files with 2693 additions and 33 deletions
|
|
@ -1,8 +1,9 @@
|
|||
import { z } from 'zod';
|
||||
import { replayTraceSchema } from '../contracts/native-replay';
|
||||
import { BacktestConfigSchema } from '../types';
|
||||
|
||||
const finite = z.number().finite();
|
||||
export const nativeWorkerRequestSchema = z.object({
|
||||
const legacyRequestSchema = z.object({
|
||||
type: z.literal('run'),
|
||||
config: BacktestConfigSchema,
|
||||
data: z.array(
|
||||
|
|
@ -20,6 +21,8 @@ export const nativeWorkerRequestSchema = z.object({
|
|||
),
|
||||
});
|
||||
|
||||
export const nativeWorkerRequestSchema = z.union([legacyRequestSchema, replayTraceSchema]);
|
||||
|
||||
export const nativeWorkerMessageSchema = z.discriminatedUnion('type', [
|
||||
z.object({ type: z.literal('progress'), progress: finite.min(0).max(100), message: z.string() }),
|
||||
z.object({ type: z.literal('result'), result: z.string() }),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue