tricu

A lazy functional language based on Tree Calculus
Log | Files | Refs | README | LICENSE

protocol.ts (2555B)


      1 import type { TreeFormat, TreeFile } from './tree-export.js';
      2 import type { RuntimeStats } from './runtime-backends.js';
      3 import type { BundleHash, ExportInfo } from './bundle.js';
      4 import type { OutputType, ValueView } from './codecs.js';
      5 import type { Trace } from './io.js';
      6 export type RequestId = number & { readonly __requestId: unique symbol };
      7 export interface CatalogueEntry {
      8   id: string; title: string; hash: BundleHash; source: string; sourceSha256: string;
      9   export: string; arguments: unknown[]; output: OutputType; mode: 'pure' | 'io';
     10   category?: 'Basic Examples' | 'Practical Examples' | 'Language & Runtime Explorations';
     11   environment?: string;
     12   presets?: Record<string, { arguments: unknown[]; output: OutputType; mode: 'pure' | 'io' }>;
     13 }
     14 export type InspectionReply = { type: 'inspected'; id: number; io: true } | { type: 'inspected'; id: number; result: ValueView } | { type: 'inspection-error'; id: number; message: string; fatal: boolean };
     15 export type ClientMessage = { type: 'io-command'; command: import('./io-session.js').Command } | { type: 'io-stop' } |  { type: 'inspect'; id: number; name: string; output: import('./auto-interpretation.js').InspectionFormat }
     16   | { type: 'run-io'; name: string; output: OutputType; step: boolean }
     17   | { type: 'load'; hash: BundleHash; localId?: string }
     18   | { type: 'run'; export: string; arguments: unknown; expression?: string; output: OutputType; mode: 'pure' | 'io'; step: boolean }
     19   | { type: 'download' }
     20   | { type: 'export'; export: string; format: TreeFormat }
     21   | { type: 'resume'; id: RequestId };
     22 export type WorkerMessage = InspectionReply | { type: 'io-version'; version: 2 }
     23   | { type: 'io-open'; run: string } | { type: 'io-event'; event: import('./io-events.js').Event } | { type: 'io-close'; run: string; settled: boolean } | { type: 'module-exported'; bytes: Uint8Array; hash: BundleHash; manifest: string }
     24   | { type: 'module-export-error'; message: string }
     25   | { type: 'state'; state: 'running' }
     26   | { type: 'state'; state: 'step'; id: RequestId }
     27   | { type: 'loaded'; hash: BundleHash; exports: ExportInfo[]; nodes: number; metadata: Record<string, string>; source: string | null }
     28   | { type: 'trace'; phase: 'before'; event: Trace }
     29   | { type: 'done'; result: ValueView; stats: RuntimeStats }
     30   | { type: 'exported'; hash: BundleHash; export: string; format: TreeFormat; file: TreeFile }
     31   | { type: 'downloaded'; hash: BundleHash; bytes: Uint8Array }
     32   | { type: 'export-error'; message: string }
     33   | { type: 'error'; message: string; fatal?: boolean };